diff --git a/.gitignore b/.gitignore index 57e8804d7c3..c54c8018ea8 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,4 @@ scripts/ior.js scripts/*.js.map coverage/ internal/ +**/.DS_Store diff --git a/Jakefile b/Jakefile index dc8070fd751..ca1ee20a3ce 100644 --- a/Jakefile +++ b/Jakefile @@ -8,6 +8,7 @@ var child_process = require("child_process"); // Variables var compilerDirectory = "src/compiler/"; var servicesDirectory = "src/services/"; +var serverDirectory = "src/server/"; var harnessDirectory = "src/harness/"; var libraryDirectory = "src/lib/"; var scriptsDirectory = "scripts/"; @@ -64,8 +65,10 @@ var servicesSources = [ return path.join(compilerDirectory, f); }).concat([ "breakpoints.ts", + "navigateTo.ts", "navigationBar.ts", "outliningElementsCollector.ts", + "patternMatcher.ts", "services.ts", "shims.ts", "signatureHelp.ts", @@ -90,6 +93,16 @@ var servicesSources = [ return path.join(servicesDirectory, f); })); +var serverSources = [ + "node.d.ts", + "editorServices.ts", + "protocol.d.ts", + "session.ts", + "server.ts" +].map(function (f) { + return path.join(serverDirectory, f); +}); + var definitionsRoots = [ "compiler/types.d.ts", "compiler/scanner.d.ts", @@ -127,9 +140,17 @@ var harnessSources = [ "incrementalParser.ts", "services/colorization.ts", "services/documentRegistry.ts", - "services/preProcessFile.ts" + "services/preProcessFile.ts", + "services/patternMatcher.ts" ].map(function (f) { return path.join(unittestsDirectory, f); +})).concat([ + "protocol.d.ts", + "session.ts", + "client.ts", + "editorServices.ts", +].map(function (f) { + return path.join(serverDirectory, f); })); var librarySourceMap = [ @@ -327,6 +348,7 @@ var tscFile = path.join(builtLocalDirectory, compilerFilename); compileFile(tscFile, compilerSources, [builtLocalDirectory, copyright].concat(compilerSources), [copyright], /*useBuiltCompiler:*/ false); var servicesFile = path.join(builtLocalDirectory, "typescriptServices.js"); +var nodePackageFile = path.join(builtLocalDirectory, "typescript.js"); compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, @@ -336,7 +358,10 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca /*preserveConstEnums*/ true, /*keepComments*/ false, /*noResolve*/ false, - /*stripInternal*/ false); + /*stripInternal*/ false, + /*callback*/ function () { + jake.cpR(servicesFile, nodePackageFile, {silent: true}); + }); var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts"); var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts"); @@ -378,9 +403,12 @@ compileFile(nodeDefinitionsFile, servicesSources,[builtLocalDirectory, copyright jake.rmRf(tempDirPath, {silent: true}); }); +var serverFile = path.join(builtLocalDirectory, "tsserver.js"); +compileFile(serverFile, serverSources,[builtLocalDirectory, copyright].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true); + // Local target to build the compiler and services desc("Builds the full compiler and services"); -task("local", ["generate-diagnostics", "lib", tscFile, servicesFile, nodeDefinitionsFile]); +task("local", ["generate-diagnostics", "lib", tscFile, servicesFile, nodeDefinitionsFile, serverFile]); // Local target to build only tsc.js desc("Builds only the compiler"); @@ -435,7 +463,7 @@ task("generate-spec", [specMd]) // Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory desc("Makes a new LKG out of the built js files"); task("LKG", ["clean", "release", "local"].concat(libraryTargets), function() { - var expectedFiles = [tscFile, servicesFile, nodeDefinitionsFile, standaloneDefinitionsFile, internalNodeDefinitionsFile, internalStandaloneDefinitionsFile].concat(libraryTargets); + var expectedFiles = [tscFile, servicesFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, internalNodeDefinitionsFile, internalStandaloneDefinitionsFile].concat(libraryTargets); var missingFiles = expectedFiles.filter(function (f) { return !fs.existsSync(f); }); @@ -542,7 +570,7 @@ task("runtests", ["tests", builtLocalDirectory], function() { } if (tests && tests.toLocaleLowerCase() === "rwc") { - testTimeout = 50000; + testTimeout = 100000; } colors = process.env.colors || process.env.color diff --git a/bin/lib.core.es6.d.ts b/bin/lib.core.es6.d.ts index d5898b35a71..13326cb1380 100644 --- a/bin/lib.core.es6.d.ts +++ b/bin/lib.core.es6.d.ts @@ -1164,7 +1164,7 @@ interface ArrayConstructor { } declare var Array: ArrayConstructor; -declare type PropertyKey = string | number | Symbol; +declare type PropertyKey = string | number | symbol; interface Symbol { /** Returns a string representation of an object. */ @@ -1173,7 +1173,7 @@ interface Symbol { /** Returns the primitive value of the specified object. */ valueOf(): Object; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface SymbolConstructor { @@ -1186,21 +1186,21 @@ interface SymbolConstructor { * Returns a new unique Symbol value. * @param description Description of the new Symbol object. */ - (description?: string|number): Symbol; + (description?: string|number): symbol; /** * Returns a Symbol object from the global symbol registry matching the given key if found. * Otherwise, returns a new symbol with this key. * @param key key to search for. */ - for(key: string): Symbol; + for(key: string): symbol; /** * Returns a key from the global symbol registry matching the given Symbol if found. * Otherwise, returns a undefined. * @param sym Symbol to find the key for. */ - keyFor(sym: Symbol): string; + keyFor(sym: symbol): string; // Well-known Symbols @@ -1208,42 +1208,42 @@ interface SymbolConstructor { * A method that determines if a constructor object recognizes an object as one of the * constructor’s instances. Called by the semantics of the instanceof operator. */ - hasInstance: Symbol; + hasInstance: symbol; /** * A Boolean value that if true indicates that an object should flatten to its array elements * by Array.prototype.concat. */ - isConcatSpreadable: Symbol; + isConcatSpreadable: symbol; /** * A Boolean value that if true indicates that an object may be used as a regular expression. */ - isRegExp: Symbol; + isRegExp: symbol; /** * A method that returns the default iterator for an object.Called by the semantics of the * for-of statement. */ - iterator: Symbol; + iterator: symbol; /** * A method that converts an object to a corresponding primitive value.Called by the ToPrimitive * abstract operation. */ - toPrimitive: Symbol; + toPrimitive: symbol; /** * A String value that is used in the creation of the default string description of an object. * Called by the built- in method Object.prototype.toString. */ - toStringTag: Symbol; + toStringTag: symbol; /** * An Object whose own property names are property names that are excluded from the with * environment bindings of the associated objects. */ - unscopables: Symbol; + unscopables: symbol; } declare var Symbol: SymbolConstructor; @@ -1274,7 +1274,7 @@ interface ObjectConstructor { * Returns an array of all symbol properties found directly on object o. * @param o Object to retrieve the symbols from. */ - getOwnPropertySymbols(o: any): Symbol[]; + getOwnPropertySymbols(o: any): symbol[]; /** * Returns true if the values are the same value, false otherwise. @@ -1396,7 +1396,7 @@ interface ArrayLike { interface Array { /** Iterator */ - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; /** * Returns an array of key, value pairs for every entry in the array @@ -1495,7 +1495,7 @@ interface ArrayConstructor { interface String { /** Iterator */ - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; /** * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point @@ -1613,12 +1613,12 @@ interface IteratorResult { } interface Iterator { - //[Symbol.iterator](): Iterator; + [Symbol.iterator](): Iterator; next(): IteratorResult; } interface Iterable { - //[Symbol.iterator](): Iterator; + [Symbol.iterator](): Iterator; } interface GeneratorFunction extends Function { @@ -1640,7 +1640,7 @@ interface Generator extends Iterator { next(value?: any): IteratorResult; throw (exception: any): IteratorResult; return (value: T): IteratorResult; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface Math { @@ -1754,11 +1754,11 @@ interface Math { */ cbrt(x: number): number; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface RegExp { - // [Symbol.isRegExp]: boolean; + [Symbol.isRegExp]: boolean; /** * Matches a string with a regular expression, and returns an array containing the results of @@ -1815,8 +1815,8 @@ interface Map { set(key: K, value?: V): Map; size: number; values(): Iterator; - // [Symbol.iterator]():Iterator<[K,V]>; - // [Symbol.toStringTag]: string; + [Symbol.iterator]():Iterator<[K,V]>; + [Symbol.toStringTag]: string; } interface MapConstructor { @@ -1832,7 +1832,7 @@ interface WeakMap { get(key: K): V; has(key: K): boolean; set(key: K, value?: V): WeakMap; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface WeakMapConstructor { @@ -1852,8 +1852,8 @@ interface Set { keys(): Iterator; size: number; values(): Iterator; - // [Symbol.iterator]():Iterator; - // [Symbol.toStringTag]: string; + [Symbol.iterator]():Iterator; + [Symbol.toStringTag]: string; } interface SetConstructor { @@ -1868,7 +1868,7 @@ interface WeakSet { clear(): void; delete(value: T): boolean; has(value: T): boolean; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface WeakSetConstructor { @@ -1879,7 +1879,7 @@ interface WeakSetConstructor { declare var WeakSet: WeakSetConstructor; interface JSON { - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } /** @@ -1899,7 +1899,7 @@ interface ArrayBuffer { */ slice(begin: number, end?: number): ArrayBuffer; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface ArrayBufferConstructor { @@ -2036,7 +2036,7 @@ interface DataView { */ setUint32(byteOffset: number, value: number, littleEndian: boolean): void; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface DataViewConstructor { @@ -2303,7 +2303,7 @@ interface Int8Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int8ArrayConstructor { @@ -2593,7 +2593,7 @@ interface Uint8Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint8ArrayConstructor { @@ -2883,7 +2883,7 @@ interface Uint8ClampedArray { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint8ClampedArrayConstructor { @@ -3173,7 +3173,7 @@ interface Int16Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int16ArrayConstructor { @@ -3463,7 +3463,7 @@ interface Uint16Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint16ArrayConstructor { @@ -3753,7 +3753,7 @@ interface Int32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int32ArrayConstructor { @@ -4043,7 +4043,7 @@ interface Uint32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint32ArrayConstructor { @@ -4333,7 +4333,7 @@ interface Float32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Float32ArrayConstructor { @@ -4623,7 +4623,7 @@ interface Float64Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Float64ArrayConstructor { @@ -4687,7 +4687,7 @@ declare var Reflect: { getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; getPrototypeOf(target: any): any; has(target: any, propertyKey: string): boolean; - has(target: any, propertyKey: Symbol): boolean; + has(target: any, propertyKey: symbol): boolean; isExtensible(target: any): boolean; ownKeys(target: any): Array; preventExtensions(target: any): boolean; diff --git a/bin/lib.es6.d.ts b/bin/lib.es6.d.ts index a66c28662fd..dfb025a0c36 100644 --- a/bin/lib.es6.d.ts +++ b/bin/lib.es6.d.ts @@ -1164,7 +1164,7 @@ interface ArrayConstructor { } declare var Array: ArrayConstructor; -declare type PropertyKey = string | number | Symbol; +declare type PropertyKey = string | number | symbol; interface Symbol { /** Returns a string representation of an object. */ @@ -1173,7 +1173,7 @@ interface Symbol { /** Returns the primitive value of the specified object. */ valueOf(): Object; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface SymbolConstructor { @@ -1186,21 +1186,21 @@ interface SymbolConstructor { * Returns a new unique Symbol value. * @param description Description of the new Symbol object. */ - (description?: string|number): Symbol; + (description?: string|number): symbol; /** * Returns a Symbol object from the global symbol registry matching the given key if found. * Otherwise, returns a new symbol with this key. * @param key key to search for. */ - for(key: string): Symbol; + for(key: string): symbol; /** * Returns a key from the global symbol registry matching the given Symbol if found. * Otherwise, returns a undefined. * @param sym Symbol to find the key for. */ - keyFor(sym: Symbol): string; + keyFor(sym: symbol): string; // Well-known Symbols @@ -1208,42 +1208,42 @@ interface SymbolConstructor { * A method that determines if a constructor object recognizes an object as one of the * constructor’s instances. Called by the semantics of the instanceof operator. */ - hasInstance: Symbol; + hasInstance: symbol; /** * A Boolean value that if true indicates that an object should flatten to its array elements * by Array.prototype.concat. */ - isConcatSpreadable: Symbol; + isConcatSpreadable: symbol; /** * A Boolean value that if true indicates that an object may be used as a regular expression. */ - isRegExp: Symbol; + isRegExp: symbol; /** * A method that returns the default iterator for an object.Called by the semantics of the * for-of statement. */ - iterator: Symbol; + iterator: symbol; /** * A method that converts an object to a corresponding primitive value.Called by the ToPrimitive * abstract operation. */ - toPrimitive: Symbol; + toPrimitive: symbol; /** * A String value that is used in the creation of the default string description of an object. * Called by the built- in method Object.prototype.toString. */ - toStringTag: Symbol; + toStringTag: symbol; /** * An Object whose own property names are property names that are excluded from the with * environment bindings of the associated objects. */ - unscopables: Symbol; + unscopables: symbol; } declare var Symbol: SymbolConstructor; @@ -1274,7 +1274,7 @@ interface ObjectConstructor { * Returns an array of all symbol properties found directly on object o. * @param o Object to retrieve the symbols from. */ - getOwnPropertySymbols(o: any): Symbol[]; + getOwnPropertySymbols(o: any): symbol[]; /** * Returns true if the values are the same value, false otherwise. @@ -1396,7 +1396,7 @@ interface ArrayLike { interface Array { /** Iterator */ - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; /** * Returns an array of key, value pairs for every entry in the array @@ -1495,7 +1495,7 @@ interface ArrayConstructor { interface String { /** Iterator */ - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; /** * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point @@ -1613,12 +1613,12 @@ interface IteratorResult { } interface Iterator { - //[Symbol.iterator](): Iterator; + [Symbol.iterator](): Iterator; next(): IteratorResult; } interface Iterable { - //[Symbol.iterator](): Iterator; + [Symbol.iterator](): Iterator; } interface GeneratorFunction extends Function { @@ -1640,7 +1640,7 @@ interface Generator extends Iterator { next(value?: any): IteratorResult; throw (exception: any): IteratorResult; return (value: T): IteratorResult; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface Math { @@ -1754,11 +1754,11 @@ interface Math { */ cbrt(x: number): number; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface RegExp { - // [Symbol.isRegExp]: boolean; + [Symbol.isRegExp]: boolean; /** * Matches a string with a regular expression, and returns an array containing the results of @@ -1815,8 +1815,8 @@ interface Map { set(key: K, value?: V): Map; size: number; values(): Iterator; - // [Symbol.iterator]():Iterator<[K,V]>; - // [Symbol.toStringTag]: string; + [Symbol.iterator]():Iterator<[K,V]>; + [Symbol.toStringTag]: string; } interface MapConstructor { @@ -1832,7 +1832,7 @@ interface WeakMap { get(key: K): V; has(key: K): boolean; set(key: K, value?: V): WeakMap; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface WeakMapConstructor { @@ -1852,8 +1852,8 @@ interface Set { keys(): Iterator; size: number; values(): Iterator; - // [Symbol.iterator]():Iterator; - // [Symbol.toStringTag]: string; + [Symbol.iterator]():Iterator; + [Symbol.toStringTag]: string; } interface SetConstructor { @@ -1868,7 +1868,7 @@ interface WeakSet { clear(): void; delete(value: T): boolean; has(value: T): boolean; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface WeakSetConstructor { @@ -1879,7 +1879,7 @@ interface WeakSetConstructor { declare var WeakSet: WeakSetConstructor; interface JSON { - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } /** @@ -1899,7 +1899,7 @@ interface ArrayBuffer { */ slice(begin: number, end?: number): ArrayBuffer; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface ArrayBufferConstructor { @@ -2036,7 +2036,7 @@ interface DataView { */ setUint32(byteOffset: number, value: number, littleEndian: boolean): void; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface DataViewConstructor { @@ -2303,7 +2303,7 @@ interface Int8Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int8ArrayConstructor { @@ -2593,7 +2593,7 @@ interface Uint8Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint8ArrayConstructor { @@ -2883,7 +2883,7 @@ interface Uint8ClampedArray { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint8ClampedArrayConstructor { @@ -3173,7 +3173,7 @@ interface Int16Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int16ArrayConstructor { @@ -3463,7 +3463,7 @@ interface Uint16Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint16ArrayConstructor { @@ -3753,7 +3753,7 @@ interface Int32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int32ArrayConstructor { @@ -4043,7 +4043,7 @@ interface Uint32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint32ArrayConstructor { @@ -4333,7 +4333,7 @@ interface Float32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Float32ArrayConstructor { @@ -4623,7 +4623,7 @@ interface Float64Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Float64ArrayConstructor { @@ -4687,7 +4687,7 @@ declare var Reflect: { getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; getPrototypeOf(target: any): any; has(target: any, propertyKey: string): boolean; - has(target: any, propertyKey: Symbol): boolean; + has(target: any, propertyKey: symbol): boolean; isExtensible(target: any): boolean; ownKeys(target: any): Array; preventExtensions(target: any): boolean; diff --git a/bin/tsc.js b/bin/tsc.js index 35f23f04758..945a2115041 100644 --- a/bin/tsc.js +++ b/bin/tsc.js @@ -304,19 +304,24 @@ var ts; ts.concatenateDiagnosticMessageChains = concatenateDiagnosticMessageChains; function compareValues(a, b) { if (a === b) - return 0 /* EqualTo */; + return 0; if (a === undefined) - return -1 /* LessThan */; + return -1; if (b === undefined) - return 1 /* GreaterThan */; - return a < b ? -1 /* LessThan */ : 1 /* GreaterThan */; + return 1; + return a < b ? -1 : 1; } ts.compareValues = compareValues; function getDiagnosticFileName(diagnostic) { return diagnostic.file ? diagnostic.file.fileName : undefined; } function compareDiagnostics(d1, d2) { - return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(d1.code, d2.code) || compareMessageText(d1.messageText, d2.messageText) || 0 /* EqualTo */; + return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || + compareValues(d1.start, d2.start) || + compareValues(d1.length, d2.length) || + compareValues(d1.code, d2.code) || + compareMessageText(d1.messageText, d2.messageText) || + 0; } ts.compareDiagnostics = compareDiagnostics; function compareMessageText(text1, text2) { @@ -331,9 +336,9 @@ var ts; text2 = typeof text2 === "string" ? undefined : text2.next; } if (!text1 && !text2) { - return 0 /* EqualTo */; + return 0; } - return text1 ? 1 /* GreaterThan */ : -1 /* LessThan */; + return text1 ? 1 : -1; } function sortAndDeduplicateDiagnostics(diagnostics) { return deduplicateSortedDiagnostics(diagnostics.sort(compareDiagnostics)); @@ -347,7 +352,7 @@ var ts; var previousDiagnostic = diagnostics[0]; for (var i = 1; i < diagnostics.length; i++) { var currentDiagnostic = diagnostics[i]; - var isDupe = compareDiagnostics(currentDiagnostic, previousDiagnostic) === 0 /* EqualTo */; + var isDupe = compareDiagnostics(currentDiagnostic, previousDiagnostic) === 0; if (!isDupe) { newDiagnostics.push(currentDiagnostic); previousDiagnostic = currentDiagnostic; @@ -361,8 +366,8 @@ var ts; } ts.normalizeSlashes = normalizeSlashes; function getRootLength(path) { - if (path.charCodeAt(0) === 47 /* slash */) { - if (path.charCodeAt(1) !== 47 /* slash */) + if (path.charCodeAt(0) === 47) { + if (path.charCodeAt(1) !== 47) return 1; var p1 = path.indexOf("/", 2); if (p1 < 0) @@ -372,8 +377,8 @@ var ts; return p1 + 1; return p2 + 1; } - if (path.charCodeAt(1) === 58 /* colon */) { - if (path.charCodeAt(2) === 47 /* slash */) + if (path.charCodeAt(1) === 58) { + if (path.charCodeAt(2) === 47) return 3; return 2; } @@ -444,7 +449,7 @@ var ts; var urlLength = url.length; var rootLength = url.indexOf("://") + "://".length; while (rootLength < urlLength) { - if (url.charCodeAt(rootLength) === 47 /* slash */) { + if (url.charCodeAt(rootLength) === 47) { rootLength++; } else { @@ -564,7 +569,7 @@ var ts; } ts.escapeString = escapeString; function getDefaultLibFileName(options) { - return options.target === 2 /* ES6 */ ? "lib.es6.d.ts" : "lib.d.ts"; + return options.target === 2 ? "lib.es6.d.ts" : "lib.d.ts"; } ts.getDefaultLibFileName = getDefaultLibFileName; function Symbol(flags, name) { @@ -596,7 +601,7 @@ var ts; }; var Debug; (function (Debug) { - var currentAssertionLevel = 0 /* None */; + var currentAssertionLevel = 0; function shouldAssert(level) { return currentAssertionLevel >= level; } @@ -812,9 +817,7 @@ var ts; watchFile: function (fileName, callback) { _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); return { - close: function () { - _fs.unwatchFile(fileName, fileChanged); - } + close: function () { _fs.unwatchFile(fileName, fileChanged); } }; function fileChanged(curr, prev) { if (+curr.mtime <= +prev.mtime) { @@ -870,570 +873,585 @@ var ts; var ts; (function (ts) { ts.Diagnostics = { - Unterminated_string_literal: { code: 1002, category: 1 /* Error */, key: "Unterminated string literal." }, - Identifier_expected: { code: 1003, category: 1 /* Error */, key: "Identifier expected." }, - _0_expected: { code: 1005, category: 1 /* Error */, key: "'{0}' expected." }, - A_file_cannot_have_a_reference_to_itself: { code: 1006, category: 1 /* Error */, key: "A file cannot have a reference to itself." }, - Trailing_comma_not_allowed: { code: 1009, category: 1 /* Error */, key: "Trailing comma not allowed." }, - Asterisk_Slash_expected: { code: 1010, category: 1 /* Error */, key: "'*/' expected." }, - Unexpected_token: { code: 1012, category: 1 /* Error */, key: "Unexpected token." }, - Catch_clause_parameter_cannot_have_a_type_annotation: { code: 1013, category: 1 /* Error */, key: "Catch clause parameter cannot have a type annotation." }, - A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: 1 /* Error */, key: "A rest parameter must be last in a parameter list." }, - Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: 1 /* Error */, key: "Parameter cannot have question mark and initializer." }, - A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: 1 /* Error */, key: "A required parameter cannot follow an optional parameter." }, - An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: 1 /* Error */, key: "An index signature cannot have a rest parameter." }, - An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: 1 /* Error */, key: "An index signature parameter cannot have an accessibility modifier." }, - An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: 1 /* Error */, key: "An index signature parameter cannot have a question mark." }, - An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: 1 /* Error */, key: "An index signature parameter cannot have an initializer." }, - An_index_signature_must_have_a_type_annotation: { code: 1021, category: 1 /* Error */, key: "An index signature must have a type annotation." }, - An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: 1 /* Error */, key: "An index signature parameter must have a type annotation." }, - An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: 1 /* Error */, key: "An index signature parameter type must be 'string' or 'number'." }, - A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: 1 /* Error */, key: "A class or interface declaration can only have one 'extends' clause." }, - An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: 1 /* Error */, key: "An 'extends' clause must precede an 'implements' clause." }, - A_class_can_only_extend_a_single_class: { code: 1026, category: 1 /* Error */, key: "A class can only extend a single class." }, - A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: 1 /* Error */, key: "A class declaration can only have one 'implements' clause." }, - Accessibility_modifier_already_seen: { code: 1028, category: 1 /* Error */, key: "Accessibility modifier already seen." }, - _0_modifier_must_precede_1_modifier: { code: 1029, category: 1 /* Error */, key: "'{0}' modifier must precede '{1}' modifier." }, - _0_modifier_already_seen: { code: 1030, category: 1 /* Error */, key: "'{0}' modifier already seen." }, - _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a class element." }, - An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: 1 /* Error */, key: "An interface declaration cannot have an 'implements' clause." }, - super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: 1 /* Error */, key: "'super' must be followed by an argument list or member access." }, - Only_ambient_modules_can_use_quoted_names: { code: 1035, category: 1 /* Error */, key: "Only ambient modules can use quoted names." }, - Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: 1 /* Error */, key: "Statements are not allowed in ambient contexts." }, - A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: 1 /* Error */, key: "A 'declare' modifier cannot be used in an already ambient context." }, - Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: 1 /* Error */, key: "Initializers are not allowed in ambient contexts." }, - _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a module element." }, - A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: 1 /* Error */, key: "A 'declare' modifier cannot be used with an interface declaration." }, - A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: 1 /* Error */, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, - A_rest_parameter_cannot_be_optional: { code: 1047, category: 1 /* Error */, key: "A rest parameter cannot be optional." }, - A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: 1 /* Error */, key: "A rest parameter cannot have an initializer." }, - A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: 1 /* Error */, key: "A 'set' accessor must have exactly one parameter." }, - A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: 1 /* Error */, key: "A 'set' accessor cannot have an optional parameter." }, - A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: 1 /* Error */, key: "A 'set' accessor parameter cannot have an initializer." }, - A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: 1 /* Error */, key: "A 'set' accessor cannot have rest parameter." }, - A_get_accessor_cannot_have_parameters: { code: 1054, category: 1 /* Error */, key: "A 'get' accessor cannot have parameters." }, - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: 1 /* Error */, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, - Enum_member_must_have_initializer: { code: 1061, category: 1 /* Error */, key: "Enum member must have initializer." }, - An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: 1 /* Error */, key: "An export assignment cannot be used in an internal module." }, - Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: 1 /* Error */, key: "Ambient enum elements can only have integer literal initializers." }, - Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: 1 /* Error */, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, - A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: 1 /* Error */, key: "A 'declare' modifier cannot be used with an import declaration." }, - Invalid_reference_directive_syntax: { code: 1084, category: 1 /* Error */, key: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: 1 /* Error */, key: "Octal literals are not available when targeting ECMAScript 5 and higher." }, - An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: 1 /* Error */, key: "An accessor cannot be declared in an ambient context." }, - _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a constructor declaration." }, - _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: 1 /* Error */, key: "'{0}' modifier cannot appear on a parameter." }, - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: 1 /* Error */, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, - Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: 1 /* Error */, key: "Type parameters cannot appear on a constructor declaration." }, - Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: 1 /* Error */, key: "Type annotation cannot appear on a constructor declaration." }, - An_accessor_cannot_have_type_parameters: { code: 1094, category: 1 /* Error */, key: "An accessor cannot have type parameters." }, - A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: 1 /* Error */, key: "A 'set' accessor cannot have a return type annotation." }, - An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: 1 /* Error */, key: "An index signature must have exactly one parameter." }, - _0_list_cannot_be_empty: { code: 1097, category: 1 /* Error */, key: "'{0}' list cannot be empty." }, - Type_parameter_list_cannot_be_empty: { code: 1098, category: 1 /* Error */, key: "Type parameter list cannot be empty." }, - Type_argument_list_cannot_be_empty: { code: 1099, category: 1 /* Error */, key: "Type argument list cannot be empty." }, - Invalid_use_of_0_in_strict_mode: { code: 1100, category: 1 /* Error */, key: "Invalid use of '{0}' in strict mode." }, - with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: 1 /* Error */, key: "'with' statements are not allowed in strict mode." }, - delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: 1 /* Error */, key: "'delete' cannot be called on an identifier in strict mode." }, - A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: 1 /* Error */, key: "A 'continue' statement can only be used within an enclosing iteration statement." }, - A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: 1 /* Error */, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, - Jump_target_cannot_cross_function_boundary: { code: 1107, category: 1 /* Error */, key: "Jump target cannot cross function boundary." }, - A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: 1 /* Error */, key: "A 'return' statement can only be used within a function body." }, - Expression_expected: { code: 1109, category: 1 /* Error */, key: "Expression expected." }, - Type_expected: { code: 1110, category: 1 /* Error */, key: "Type expected." }, - A_class_member_cannot_be_declared_optional: { code: 1112, category: 1 /* Error */, key: "A class member cannot be declared optional." }, - A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: 1 /* Error */, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, - Duplicate_label_0: { code: 1114, category: 1 /* Error */, key: "Duplicate label '{0}'" }, - A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: 1 /* Error */, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, - A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: 1 /* Error */, key: "A 'break' statement can only jump to a label of an enclosing statement." }, - An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: 1 /* Error */, key: "An object literal cannot have multiple properties with the same name in strict mode." }, - An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: 1 /* Error */, key: "An object literal cannot have multiple get/set accessors with the same name." }, - An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: 1 /* Error */, key: "An object literal cannot have property and accessor with the same name." }, - An_export_assignment_cannot_have_modifiers: { code: 1120, category: 1 /* Error */, key: "An export assignment cannot have modifiers." }, - Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: 1 /* Error */, key: "Octal literals are not allowed in strict mode." }, - A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: 1 /* Error */, key: "A tuple type element list cannot be empty." }, - Variable_declaration_list_cannot_be_empty: { code: 1123, category: 1 /* Error */, key: "Variable declaration list cannot be empty." }, - Digit_expected: { code: 1124, category: 1 /* Error */, key: "Digit expected." }, - Hexadecimal_digit_expected: { code: 1125, category: 1 /* Error */, key: "Hexadecimal digit expected." }, - Unexpected_end_of_text: { code: 1126, category: 1 /* Error */, key: "Unexpected end of text." }, - Invalid_character: { code: 1127, category: 1 /* Error */, key: "Invalid character." }, - Declaration_or_statement_expected: { code: 1128, category: 1 /* Error */, key: "Declaration or statement expected." }, - Statement_expected: { code: 1129, category: 1 /* Error */, key: "Statement expected." }, - case_or_default_expected: { code: 1130, category: 1 /* Error */, key: "'case' or 'default' expected." }, - Property_or_signature_expected: { code: 1131, category: 1 /* Error */, key: "Property or signature expected." }, - Enum_member_expected: { code: 1132, category: 1 /* Error */, key: "Enum member expected." }, - Type_reference_expected: { code: 1133, category: 1 /* Error */, key: "Type reference expected." }, - Variable_declaration_expected: { code: 1134, category: 1 /* Error */, key: "Variable declaration expected." }, - Argument_expression_expected: { code: 1135, category: 1 /* Error */, key: "Argument expression expected." }, - Property_assignment_expected: { code: 1136, category: 1 /* Error */, key: "Property assignment expected." }, - Expression_or_comma_expected: { code: 1137, category: 1 /* Error */, key: "Expression or comma expected." }, - Parameter_declaration_expected: { code: 1138, category: 1 /* Error */, key: "Parameter declaration expected." }, - Type_parameter_declaration_expected: { code: 1139, category: 1 /* Error */, key: "Type parameter declaration expected." }, - Type_argument_expected: { code: 1140, category: 1 /* Error */, key: "Type argument expected." }, - String_literal_expected: { code: 1141, category: 1 /* Error */, key: "String literal expected." }, - Line_break_not_permitted_here: { code: 1142, category: 1 /* Error */, key: "Line break not permitted here." }, - or_expected: { code: 1144, category: 1 /* Error */, key: "'{' or ';' expected." }, - Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: 1 /* Error */, key: "Modifiers not permitted on index signature members." }, - Declaration_expected: { code: 1146, category: 1 /* Error */, key: "Declaration expected." }, - Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: 1 /* Error */, key: "Import declarations in an internal module cannot reference an external module." }, - Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: 1 /* Error */, key: "Cannot compile external modules unless the '--module' flag is provided." }, - File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: 1 /* Error */, key: "File name '{0}' differs from already included file name '{1}' only in casing" }, - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: 1 /* Error */, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, - var_let_or_const_expected: { code: 1152, category: 1 /* Error */, key: "'var', 'let' or 'const' expected." }, - let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: 1 /* Error */, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." }, - const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: 1 /* Error */, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." }, - const_declarations_must_be_initialized: { code: 1155, category: 1 /* Error */, key: "'const' declarations must be initialized" }, - const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: 1 /* Error */, key: "'const' declarations can only be declared inside a block." }, - let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: 1 /* Error */, key: "'let' declarations can only be declared inside a block." }, - Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: 1 /* Error */, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." }, - Unterminated_template_literal: { code: 1160, category: 1 /* Error */, key: "Unterminated template literal." }, - Unterminated_regular_expression_literal: { code: 1161, category: 1 /* Error */, key: "Unterminated regular expression literal." }, - An_object_member_cannot_be_declared_optional: { code: 1162, category: 1 /* Error */, key: "An object member cannot be declared optional." }, - yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: 1 /* Error */, key: "'yield' expression must be contained_within a generator declaration." }, - Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: 1 /* Error */, key: "Computed property names are not allowed in enums." }, - Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: 1 /* Error */, key: "Computed property names are not allowed in an ambient context." }, - Computed_property_names_are_not_allowed_in_class_property_declarations: { code: 1166, category: 1 /* Error */, key: "Computed property names are not allowed in class property declarations." }, - Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: 1 /* Error */, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, - Computed_property_names_are_not_allowed_in_method_overloads: { code: 1168, category: 1 /* Error */, key: "Computed property names are not allowed in method overloads." }, - Computed_property_names_are_not_allowed_in_interfaces: { code: 1169, category: 1 /* Error */, key: "Computed property names are not allowed in interfaces." }, - Computed_property_names_are_not_allowed_in_type_literals: { code: 1170, category: 1 /* Error */, key: "Computed property names are not allowed in type literals." }, - A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: 1 /* Error */, key: "A comma expression is not allowed in a computed property name." }, - extends_clause_already_seen: { code: 1172, category: 1 /* Error */, key: "'extends' clause already seen." }, - extends_clause_must_precede_implements_clause: { code: 1173, category: 1 /* Error */, key: "'extends' clause must precede 'implements' clause." }, - Classes_can_only_extend_a_single_class: { code: 1174, category: 1 /* Error */, key: "Classes can only extend a single class." }, - implements_clause_already_seen: { code: 1175, category: 1 /* Error */, key: "'implements' clause already seen." }, - Interface_declaration_cannot_have_implements_clause: { code: 1176, category: 1 /* Error */, key: "Interface declaration cannot have 'implements' clause." }, - Binary_digit_expected: { code: 1177, category: 1 /* Error */, key: "Binary digit expected." }, - Octal_digit_expected: { code: 1178, category: 1 /* Error */, key: "Octal digit expected." }, - Unexpected_token_expected: { code: 1179, category: 1 /* Error */, key: "Unexpected token. '{' expected." }, - Property_destructuring_pattern_expected: { code: 1180, category: 1 /* Error */, key: "Property destructuring pattern expected." }, - Array_element_destructuring_pattern_expected: { code: 1181, category: 1 /* Error */, key: "Array element destructuring pattern expected." }, - A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: 1 /* Error */, key: "A destructuring declaration must have an initializer." }, - Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: 1 /* Error */, key: "Destructuring declarations are not allowed in ambient contexts." }, - An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: 1 /* Error */, key: "An implementation cannot be declared in ambient contexts." }, - Modifiers_cannot_appear_here: { code: 1184, category: 1 /* Error */, key: "Modifiers cannot appear here." }, - Merge_conflict_marker_encountered: { code: 1185, category: 1 /* Error */, key: "Merge conflict marker encountered." }, - A_rest_element_cannot_have_an_initializer: { code: 1186, category: 1 /* Error */, key: "A rest element cannot have an initializer." }, - A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: 1 /* Error */, key: "A parameter property may not be a binding pattern." }, - Duplicate_identifier_0: { code: 2300, category: 1 /* Error */, key: "Duplicate identifier '{0}'." }, - Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1 /* 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: 1 /* Error */, key: "Static members cannot reference class type parameters." }, - Circular_definition_of_import_alias_0: { code: 2303, category: 1 /* Error */, key: "Circular definition of import alias '{0}'." }, - Cannot_find_name_0: { code: 2304, category: 1 /* Error */, key: "Cannot find name '{0}'." }, - Module_0_has_no_exported_member_1: { code: 2305, category: 1 /* Error */, key: "Module '{0}' has no exported member '{1}'." }, - File_0_is_not_an_external_module: { code: 2306, category: 1 /* Error */, key: "File '{0}' is not an external module." }, - Cannot_find_external_module_0: { code: 2307, category: 1 /* Error */, key: "Cannot find external module '{0}'." }, - A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: 1 /* Error */, key: "A module cannot have more than one export assignment." }, - An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: 1 /* Error */, key: "An export assignment cannot be used in a module with other exported elements." }, - Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: 1 /* Error */, key: "Type '{0}' recursively references itself as a base type." }, - A_class_may_only_extend_another_class: { code: 2311, category: 1 /* Error */, key: "A class may only extend another class." }, - An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: 1 /* Error */, key: "An interface may only extend a class or another interface." }, - Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: 1 /* Error */, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, - Generic_type_0_requires_1_type_argument_s: { code: 2314, category: 1 /* Error */, key: "Generic type '{0}' requires {1} type argument(s)." }, - Type_0_is_not_generic: { code: 2315, category: 1 /* Error */, key: "Type '{0}' is not generic." }, - Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1 /* Error */, key: "Global type '{0}' must be a class or interface type." }, - Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1 /* Error */, key: "Global type '{0}' must have {1} type parameter(s)." }, - Cannot_find_global_type_0: { code: 2318, category: 1 /* Error */, key: "Cannot find global type '{0}'." }, - Named_properties_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1 /* Error */, key: "Named properties '{0}' of types '{1}' and '{2}' are not identical." }, - Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1 /* Error */, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, - Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1 /* Error */, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, - Type_0_is_not_assignable_to_type_1: { code: 2322, category: 1 /* Error */, key: "Type '{0}' is not assignable to type '{1}'." }, - Property_0_is_missing_in_type_1: { code: 2324, category: 1 /* Error */, key: "Property '{0}' is missing in type '{1}'." }, - Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: 1 /* Error */, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, - Types_of_property_0_are_incompatible: { code: 2326, category: 1 /* Error */, key: "Types of property '{0}' are incompatible." }, - Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: 1 /* Error */, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, - Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: 1 /* Error */, key: "Types of parameters '{0}' and '{1}' are incompatible." }, - Index_signature_is_missing_in_type_0: { code: 2329, category: 1 /* Error */, key: "Index signature is missing in type '{0}'." }, - Index_signatures_are_incompatible: { code: 2330, category: 1 /* Error */, key: "Index signatures are incompatible." }, - this_cannot_be_referenced_in_a_module_body: { code: 2331, category: 1 /* Error */, key: "'this' cannot be referenced in a module body." }, - this_cannot_be_referenced_in_current_location: { code: 2332, category: 1 /* Error */, key: "'this' cannot be referenced in current location." }, - this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: 1 /* Error */, key: "'this' cannot be referenced in constructor arguments." }, - this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: 1 /* Error */, key: "'this' cannot be referenced in a static property initializer." }, - super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: 1 /* Error */, key: "'super' can only be referenced in a derived class." }, - super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: 1 /* Error */, key: "'super' cannot be referenced in constructor arguments." }, - Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: 1 /* Error */, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, - super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: 1 /* Error */, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, - Property_0_does_not_exist_on_type_1: { code: 2339, category: 1 /* Error */, key: "Property '{0}' does not exist on type '{1}'." }, - Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1 /* Error */, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, - Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1 /* Error */, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_or_any: { code: 2342, category: 1 /* Error */, key: "An index expression argument must be of type 'string', 'number', or 'any'." }, - Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1 /* Error */, key: "Type '{0}' does not satisfy the constraint '{1}'." }, - Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1 /* Error */, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, - Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1 /* Error */, key: "Supplied parameters do not match any signature of call target." }, - Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: 1 /* Error */, key: "Untyped function calls may not accept type arguments." }, - Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: 1 /* Error */, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: 1 /* Error */, key: "Cannot invoke an expression whose type lacks a call signature." }, - Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: 1 /* Error */, key: "Only a void function can be called with the 'new' keyword." }, - Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: 1 /* Error */, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, - Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: 1 /* Error */, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, - No_best_common_type_exists_among_return_expressions: { code: 2354, category: 1 /* Error */, key: "No best common type exists among return expressions." }, - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: 1 /* Error */, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, - An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: 1 /* Error */, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1 /* Error */, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, - The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1 /* Error */, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, - The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1 /* Error */, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, - The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number: { code: 2360, category: 1 /* Error */, key: "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'." }, - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1 /* Error */, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, - The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1 /* Error */, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1 /* Error */, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: 1 /* Error */, key: "Invalid left-hand side of assignment expression." }, - Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: 1 /* Error */, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, - Type_parameter_name_cannot_be_0: { code: 2368, category: 1 /* Error */, key: "Type parameter name cannot be '{0}'" }, - A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: 1 /* Error */, key: "A parameter property is only allowed in a constructor implementation." }, - A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: 1 /* Error */, key: "A rest parameter must be of an array type." }, - A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: 1 /* Error */, key: "A parameter initializer is only allowed in a function or constructor implementation." }, - Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: 1 /* Error */, key: "Parameter '{0}' cannot be referenced in its initializer." }, - Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: 1 /* Error */, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, - Duplicate_string_index_signature: { code: 2374, category: 1 /* Error */, key: "Duplicate string index signature." }, - Duplicate_number_index_signature: { code: 2375, category: 1 /* Error */, key: "Duplicate number index signature." }, - A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: 1 /* Error */, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, - Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: 1 /* Error */, key: "Constructors for derived classes must contain a 'super' call." }, - A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: 1 /* Error */, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, - Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: 1 /* Error */, key: "Getter and setter accessors do not agree in visibility." }, - get_and_set_accessor_must_have_the_same_type: { code: 2380, category: 1 /* Error */, key: "'get' and 'set' accessor must have the same type." }, - A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: 1 /* Error */, key: "A signature with an implementation cannot use a string literal type." }, - Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: 1 /* Error */, key: "Specialized overload signature is not assignable to any non-specialized signature." }, - Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: 1 /* Error */, key: "Overload signatures must all be exported or not exported." }, - Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: 1 /* Error */, key: "Overload signatures must all be ambient or non-ambient." }, - Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: 1 /* Error */, key: "Overload signatures must all be public, private or protected." }, - Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: 1 /* Error */, key: "Overload signatures must all be optional or required." }, - Function_overload_must_be_static: { code: 2387, category: 1 /* Error */, key: "Function overload must be static." }, - Function_overload_must_not_be_static: { code: 2388, category: 1 /* Error */, key: "Function overload must not be static." }, - Function_implementation_name_must_be_0: { code: 2389, category: 1 /* Error */, key: "Function implementation name must be '{0}'." }, - Constructor_implementation_is_missing: { code: 2390, category: 1 /* Error */, key: "Constructor implementation is missing." }, - Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: 1 /* Error */, key: "Function implementation is missing or not immediately following the declaration." }, - Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: 1 /* Error */, key: "Multiple constructor implementations are not allowed." }, - Duplicate_function_implementation: { code: 2393, category: 1 /* Error */, key: "Duplicate function implementation." }, - Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: 1 /* Error */, key: "Overload signature is not compatible with function implementation." }, - Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: 1 /* Error */, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, - Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: 1 /* Error */, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, - Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: 1 /* Error */, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, - Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: 1 /* Error */, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, - Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: 1 /* Error */, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, - Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: 1 /* Error */, key: "Expression resolves to '_super' that compiler uses to capture base class reference." }, - Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: 1 /* Error */, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, - The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: 1 /* Error */, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, - The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: 1 /* Error */, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, - Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: 1 /* Error */, key: "Invalid left-hand side in 'for...in' statement." }, - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: 1 /* Error */, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, - Setters_cannot_return_a_value: { code: 2408, category: 1 /* Error */, key: "Setters cannot return a value." }, - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: 1 /* Error */, key: "Return type of constructor signature must be assignable to the instance type of the class" }, - All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: 1 /* Error */, key: "All symbols within a 'with' block will be resolved to 'any'." }, - Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: 1 /* Error */, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, - Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: 1 /* Error */, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, - Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: 1 /* Error */, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, - Class_name_cannot_be_0: { code: 2414, category: 1 /* Error */, key: "Class name cannot be '{0}'" }, - Class_0_incorrectly_extends_base_class_1: { code: 2415, category: 1 /* Error */, key: "Class '{0}' incorrectly extends base class '{1}'." }, - Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: 1 /* Error */, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, - Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: 1 /* Error */, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, - Class_0_incorrectly_implements_interface_1: { code: 2420, category: 1 /* Error */, key: "Class '{0}' incorrectly implements interface '{1}'." }, - A_class_may_only_implement_another_class_or_interface: { code: 2422, category: 1 /* Error */, key: "A class may only implement another class or interface." }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: 1 /* Error */, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: 1 /* Error */, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, - Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: 1 /* Error */, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, - Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: 1 /* Error */, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, - Interface_name_cannot_be_0: { code: 2427, category: 1 /* Error */, key: "Interface name cannot be '{0}'" }, - All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: 1 /* Error */, key: "All declarations of an interface must have identical type parameters." }, - Interface_0_incorrectly_extends_interface_1: { code: 2430, category: 1 /* Error */, key: "Interface '{0}' incorrectly extends interface '{1}'." }, - Enum_name_cannot_be_0: { code: 2431, category: 1 /* Error */, key: "Enum name cannot be '{0}'" }, - In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: 1 /* Error */, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, - A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: 1 /* Error */, key: "A module declaration cannot be in a different file from a class or function with which it is merged" }, - A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: 1 /* Error */, key: "A module declaration cannot be located prior to a class or function with which it is merged" }, - Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: 1 /* Error */, key: "Ambient external modules cannot be nested in other modules." }, - Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: 1 /* Error */, key: "Ambient external module declaration cannot specify relative module name." }, - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: 1 /* Error */, key: "Module '{0}' is hidden by a local declaration with the same name" }, - Import_name_cannot_be_0: { code: 2438, category: 1 /* Error */, key: "Import name cannot be '{0}'" }, - Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: 1 /* Error */, key: "Import declaration in an ambient external module declaration cannot reference external module through relative external module name." }, - Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: 1 /* Error */, key: "Import declaration conflicts with local declaration of '{0}'" }, - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: 1 /* Error */, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, - Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: 1 /* Error */, key: "Types have separate declarations of a private property '{0}'." }, - Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: 1 /* Error */, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, - Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: 1 /* Error */, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, - Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: 1 /* Error */, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, - Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: 1 /* Error */, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, - The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: 1 /* Error */, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, - Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: 1 /* Error */, key: "Block-scoped variable '{0}' used before its declaration." }, - The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: 1 /* Error */, key: "The operand of an increment or decrement operator cannot be a constant." }, - Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: 1 /* Error */, key: "Left-hand side of assignment expression cannot be a constant." }, - Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: 1 /* Error */, key: "Cannot redeclare block-scoped variable '{0}'." }, - An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: 1 /* Error */, key: "An enum member cannot have a numeric name." }, - The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: 1 /* Error */, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, - Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: 1 /* Error */, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, - Type_alias_0_circularly_references_itself: { code: 2456, category: 1 /* Error */, key: "Type alias '{0}' circularly references itself." }, - Type_alias_name_cannot_be_0: { code: 2457, category: 1 /* Error */, key: "Type alias name cannot be '{0}'" }, - An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: 1 /* Error */, key: "An AMD module cannot have multiple name assignments." }, - Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: 1 /* Error */, key: "Type '{0}' has no property '{1}' and no string index signature." }, - Type_0_has_no_property_1: { code: 2460, category: 1 /* Error */, key: "Type '{0}' has no property '{1}'." }, - Type_0_is_not_an_array_type: { code: 2461, category: 1 /* Error */, key: "Type '{0}' is not an array type." }, - A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: 1 /* Error */, key: "A rest element must be last in an array destructuring pattern" }, - A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: 1 /* Error */, key: "A binding pattern parameter cannot be optional in an implementation signature." }, - A_computed_property_name_must_be_of_type_string_number_or_any: { code: 2464, category: 1 /* Error */, key: "A computed property name must be of type 'string', 'number', or 'any'." }, - this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: 1 /* Error */, key: "'this' cannot be referenced in a computed property name." }, - super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: 1 /* Error */, key: "'super' cannot be referenced in a computed property name." }, - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2466, category: 1 /* Error */, key: "A computed property name cannot reference a type parameter from its containing type." }, - Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1 /* Error */, key: "Import declaration '{0}' is using private name '{1}'." }, - Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1 /* Error */, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, - Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: 1 /* Error */, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: 1 /* Error */, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: 1 /* Error */, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: 1 /* Error */, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: 1 /* Error */, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, - Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: 1 /* Error */, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: 1 /* Error */, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, - Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: 1 /* Error */, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: 1 /* Error */, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, - Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: 1 /* Error */, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, - Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: 1 /* Error */, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, - Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: 1 /* Error */, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, - Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: 1 /* Error */, key: "Exported variable '{0}' has or is using private name '{1}'." }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: 1 /* Error */, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: 1 /* Error */, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: 1 /* Error */, key: "Public static property '{0}' of exported class has or is using private name '{1}'." }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: 1 /* Error */, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: 1 /* Error */, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: 1 /* Error */, key: "Public property '{0}' of exported class has or is using private name '{1}'." }, - Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: 1 /* Error */, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, - Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: 1 /* Error */, key: "Property '{0}' of exported interface has or is using private name '{1}'." }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: 1 /* Error */, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: 1 /* Error */, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: 1 /* Error */, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: 1 /* Error */, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: 1 /* Error */, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: 1 /* Error */, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: 1 /* Error */, key: "Return type of public static property getter from exported class has or is using private name '{0}'." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: 1 /* Error */, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: 1 /* Error */, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: 1 /* Error */, key: "Return type of public property getter from exported class has or is using private name '{0}'." }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: 1 /* Error */, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: 1 /* Error */, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: 1 /* Error */, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: 1 /* Error */, key: "Return type of call signature from exported interface has or is using private name '{0}'." }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: 1 /* Error */, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: 1 /* Error */, key: "Return type of index signature from exported interface has or is using private name '{0}'." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: 1 /* Error */, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: 1 /* Error */, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: 1 /* Error */, key: "Return type of public static method from exported class has or is using private name '{0}'." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: 1 /* Error */, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: 1 /* Error */, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: 1 /* Error */, key: "Return type of public method from exported class has or is using private name '{0}'." }, - Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: 1 /* Error */, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: 1 /* Error */, key: "Return type of method from exported interface has or is using private name '{0}'." }, - Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: 1 /* Error */, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: 1 /* Error */, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, - Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: 1 /* Error */, key: "Return type of exported function has or is using private name '{0}'." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: 1 /* Error */, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: 1 /* Error */, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: 1 /* Error */, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: 1 /* Error */, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: 1 /* Error */, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: 1 /* Error */, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: 1 /* Error */, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: 1 /* Error */, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: 1 /* Error */, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: 1 /* Error */, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: 1 /* Error */, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: 1 /* Error */, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: 1 /* Error */, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: 1 /* Error */, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: 1 /* Error */, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: 1 /* Error */, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1 /* Error */, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1 /* Error */, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, - Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1 /* Error */, key: "Exported type alias '{0}' has or is using private name '{1}'." }, - Enum_declarations_must_all_be_const_or_non_const: { code: 4082, category: 1 /* Error */, key: "Enum declarations must all be const or non-const." }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 4083, category: 1 /* Error */, key: "In 'const' enum declarations member initializer must be constant expression." }, - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 4084, category: 1 /* Error */, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 4085, category: 1 /* Error */, key: "A const enum member can only be accessed using a string literal." }, - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 4086, category: 1 /* Error */, key: "'const' enum member initializer was evaluated to a non-finite value." }, - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 4087, category: 1 /* Error */, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, - Property_0_does_not_exist_on_const_enum_1: { code: 4088, category: 1 /* Error */, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, - The_current_host_does_not_support_the_0_option: { code: 5001, category: 1 /* Error */, key: "The current host does not support the '{0}' option." }, - Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1 /* Error */, key: "Cannot find the common subdirectory path for the input files." }, - Cannot_read_file_0_Colon_1: { code: 5012, category: 1 /* Error */, key: "Cannot read file '{0}': {1}" }, - Unsupported_file_encoding: { code: 5013, category: 1 /* Error */, key: "Unsupported file encoding." }, - Unknown_compiler_option_0: { code: 5023, category: 1 /* Error */, key: "Unknown compiler option '{0}'." }, - Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: 1 /* Error */, key: "Compiler option '{0}' requires a value of type {1}." }, - Could_not_write_file_0_Colon_1: { code: 5033, category: 1 /* Error */, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: 1 /* Error */, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: 1 /* Error */, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, - Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: 1 /* Error */, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, - Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: 1 /* Error */, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, - Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: 1 /* Error */, key: "Option 'project' cannot be mixed with source files on a command line." }, - Concatenate_and_emit_output_to_single_file: { code: 6001, category: 2 /* Message */, key: "Concatenate and emit output to single file." }, - Generates_corresponding_d_ts_file: { code: 6002, category: 2 /* Message */, key: "Generates corresponding '.d.ts' file." }, - Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: 2 /* Message */, key: "Specifies the location where debugger should locate map files instead of generated locations." }, - Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: 2 /* Message */, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, - Watch_input_files: { code: 6005, category: 2 /* Message */, key: "Watch input files." }, - Redirect_output_structure_to_the_directory: { code: 6006, category: 2 /* Message */, key: "Redirect output structure to the directory." }, - Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: 2 /* Message */, key: "Do not erase const enum declarations in generated code." }, - Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: 2 /* Message */, key: "Do not emit outputs if any type checking errors were reported." }, - Do_not_emit_comments_to_output: { code: 6009, category: 2 /* Message */, key: "Do not emit comments to output." }, - Do_not_emit_outputs: { code: 6010, category: 2 /* Message */, key: "Do not emit outputs." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: 2 /* Message */, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, - Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: 2 /* Message */, key: "Specify module code generation: 'commonjs' or 'amd'" }, - Print_this_message: { code: 6017, category: 2 /* Message */, key: "Print this message." }, - Print_the_compiler_s_version: { code: 6019, category: 2 /* Message */, key: "Print the compiler's version." }, - Compile_the_project_in_the_given_directory: { code: 6020, category: 2 /* Message */, key: "Compile the project in the given directory." }, - Syntax_Colon_0: { code: 6023, category: 2 /* Message */, key: "Syntax: {0}" }, - options: { code: 6024, category: 2 /* Message */, key: "options" }, - file: { code: 6025, category: 2 /* Message */, key: "file" }, - Examples_Colon_0: { code: 6026, category: 2 /* Message */, key: "Examples: {0}" }, - Options_Colon: { code: 6027, category: 2 /* Message */, key: "Options:" }, - Version_0: { code: 6029, category: 2 /* Message */, key: "Version {0}" }, - Insert_command_line_options_and_files_from_a_file: { code: 6030, category: 2 /* Message */, key: "Insert command line options and files from a file." }, - File_change_detected_Starting_incremental_compilation: { code: 6032, category: 2 /* Message */, key: "File change detected. Starting incremental compilation..." }, - KIND: { code: 6034, category: 2 /* Message */, key: "KIND" }, - FILE: { code: 6035, category: 2 /* Message */, key: "FILE" }, - VERSION: { code: 6036, category: 2 /* Message */, key: "VERSION" }, - LOCATION: { code: 6037, category: 2 /* Message */, key: "LOCATION" }, - DIRECTORY: { code: 6038, category: 2 /* Message */, key: "DIRECTORY" }, - Compilation_complete_Watching_for_file_changes: { code: 6042, category: 2 /* Message */, key: "Compilation complete. Watching for file changes." }, - Generates_corresponding_map_file: { code: 6043, category: 2 /* Message */, key: "Generates corresponding '.map' file." }, - Compiler_option_0_expects_an_argument: { code: 6044, category: 1 /* Error */, key: "Compiler option '{0}' expects an argument." }, - Unterminated_quoted_string_in_response_file_0: { code: 6045, category: 1 /* Error */, key: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: 1 /* Error */, key: "Argument for '--module' option must be 'commonjs' or 'amd'." }, - Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: 1 /* 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: 1 /* Error */, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, - Unsupported_locale_0: { code: 6049, category: 1 /* Error */, key: "Unsupported locale '{0}'." }, - Unable_to_open_file_0: { code: 6050, category: 1 /* Error */, key: "Unable to open file '{0}'." }, - Corrupted_locale_file_0: { code: 6051, category: 1 /* Error */, key: "Corrupted locale file {0}." }, - Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: 2 /* Message */, key: "Raise error on expressions and declarations with an implied 'any' type." }, - File_0_not_found: { code: 6053, category: 1 /* Error */, key: "File '{0}' not found." }, - File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: 1 /* Error */, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, - Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: 2 /* Message */, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, - Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: 2 /* Message */, key: "Do not emit declarations for code that has an '@internal' annotation." }, - Variable_0_implicitly_has_an_1_type: { code: 7005, category: 1 /* Error */, key: "Variable '{0}' implicitly has an '{1}' type." }, - Parameter_0_implicitly_has_an_1_type: { code: 7006, category: 1 /* Error */, key: "Parameter '{0}' implicitly has an '{1}' type." }, - Member_0_implicitly_has_an_1_type: { code: 7008, category: 1 /* Error */, key: "Member '{0}' implicitly has an '{1}' type." }, - new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: 1 /* Error */, key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, - _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: 1 /* Error */, key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, - Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: 1 /* Error */, key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, - Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: 1 /* Error */, key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: 1 /* Error */, key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, - Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: 1 /* Error */, key: "Index signature of object type implicitly has an 'any' type." }, - Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1 /* Error */, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, - Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1 /* Error */, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, - Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1 /* Error */, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: 1 /* Error */, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, - _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: 1 /* Error */, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, - _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: { code: 7023, category: 1 /* Error */, key: "'{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." }, - Function_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: { code: 7024, category: 1 /* Error */, key: "Function 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." }, - You_cannot_rename_this_element: { code: 8000, category: 1 /* Error */, key: "You cannot rename this element." }, - You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: 1 /* Error */, key: "You cannot rename elements that are defined in the standard TypeScript library." }, - yield_expressions_are_not_currently_supported: { code: 9000, category: 1 /* Error */, key: "'yield' expressions are not currently supported." }, - Generators_are_not_currently_supported: { code: 9001, category: 1 /* Error */, key: "Generators are not currently supported." }, - The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: 1 /* Error */, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." } + Unterminated_string_literal: { code: 1002, category: 1, key: "Unterminated string literal." }, + Identifier_expected: { code: 1003, category: 1, key: "Identifier expected." }, + _0_expected: { code: 1005, category: 1, key: "'{0}' expected." }, + A_file_cannot_have_a_reference_to_itself: { code: 1006, category: 1, key: "A file cannot have a reference to itself." }, + Trailing_comma_not_allowed: { code: 1009, category: 1, key: "Trailing comma not allowed." }, + Asterisk_Slash_expected: { code: 1010, category: 1, key: "'*/' expected." }, + Unexpected_token: { code: 1012, category: 1, key: "Unexpected token." }, + Catch_clause_parameter_cannot_have_a_type_annotation: { code: 1013, category: 1, key: "Catch clause parameter cannot have a type annotation." }, + A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: 1, key: "A rest parameter must be last in a parameter list." }, + Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: 1, key: "Parameter cannot have question mark and initializer." }, + A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: 1, key: "A required parameter cannot follow an optional parameter." }, + An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: 1, key: "An index signature cannot have a rest parameter." }, + An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: 1, key: "An index signature parameter cannot have an accessibility modifier." }, + An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: 1, key: "An index signature parameter cannot have a question mark." }, + An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: 1, key: "An index signature parameter cannot have an initializer." }, + An_index_signature_must_have_a_type_annotation: { code: 1021, category: 1, key: "An index signature must have a type annotation." }, + An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: 1, key: "An index signature parameter must have a type annotation." }, + An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: 1, key: "An index signature parameter type must be 'string' or 'number'." }, + A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: 1, key: "A class or interface declaration can only have one 'extends' clause." }, + An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: 1, key: "An 'extends' clause must precede an 'implements' clause." }, + A_class_can_only_extend_a_single_class: { code: 1026, category: 1, key: "A class can only extend a single class." }, + A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: 1, key: "A class declaration can only have one 'implements' clause." }, + Accessibility_modifier_already_seen: { code: 1028, category: 1, key: "Accessibility modifier already seen." }, + _0_modifier_must_precede_1_modifier: { code: 1029, category: 1, key: "'{0}' modifier must precede '{1}' modifier." }, + _0_modifier_already_seen: { code: 1030, category: 1, key: "'{0}' modifier already seen." }, + _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: 1, key: "'{0}' modifier cannot appear on a class element." }, + An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: 1, key: "An interface declaration cannot have an 'implements' clause." }, + super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: 1, key: "'super' must be followed by an argument list or member access." }, + Only_ambient_modules_can_use_quoted_names: { code: 1035, category: 1, key: "Only ambient modules can use quoted names." }, + Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: 1, key: "Statements are not allowed in ambient contexts." }, + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: 1, key: "A 'declare' modifier cannot be used in an already ambient context." }, + Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: 1, key: "Initializers are not allowed in ambient contexts." }, + _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: 1, key: "'{0}' modifier cannot appear on a module element." }, + A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: 1, key: "A 'declare' modifier cannot be used with an interface declaration." }, + A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: 1, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, + A_rest_parameter_cannot_be_optional: { code: 1047, category: 1, key: "A rest parameter cannot be optional." }, + A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: 1, key: "A rest parameter cannot have an initializer." }, + A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: 1, key: "A 'set' accessor must have exactly one parameter." }, + A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: 1, key: "A 'set' accessor cannot have an optional parameter." }, + A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: 1, key: "A 'set' accessor parameter cannot have an initializer." }, + A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: 1, key: "A 'set' accessor cannot have rest parameter." }, + A_get_accessor_cannot_have_parameters: { code: 1054, category: 1, key: "A 'get' accessor cannot have parameters." }, + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: 1, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, + Enum_member_must_have_initializer: { code: 1061, category: 1, key: "Enum member must have initializer." }, + An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: 1, key: "An export assignment cannot be used in an internal module." }, + Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: 1, key: "Ambient enum elements can only have integer literal initializers." }, + Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: 1, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, + A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: 1, key: "A 'declare' modifier cannot be used with an import declaration." }, + Invalid_reference_directive_syntax: { code: 1084, category: 1, key: "Invalid 'reference' directive syntax." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: 1, key: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: 1, key: "An accessor cannot be declared in an ambient context." }, + _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: 1, key: "'{0}' modifier cannot appear on a constructor declaration." }, + _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: 1, key: "'{0}' modifier cannot appear on a parameter." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: 1, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, + Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: 1, key: "Type parameters cannot appear on a constructor declaration." }, + Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: 1, key: "Type annotation cannot appear on a constructor declaration." }, + An_accessor_cannot_have_type_parameters: { code: 1094, category: 1, key: "An accessor cannot have type parameters." }, + A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: 1, key: "A 'set' accessor cannot have a return type annotation." }, + An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: 1, key: "An index signature must have exactly one parameter." }, + _0_list_cannot_be_empty: { code: 1097, category: 1, key: "'{0}' list cannot be empty." }, + Type_parameter_list_cannot_be_empty: { code: 1098, category: 1, key: "Type parameter list cannot be empty." }, + Type_argument_list_cannot_be_empty: { code: 1099, category: 1, key: "Type argument list cannot be empty." }, + Invalid_use_of_0_in_strict_mode: { code: 1100, category: 1, key: "Invalid use of '{0}' in strict mode." }, + with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: 1, key: "'with' statements are not allowed in strict mode." }, + delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: 1, key: "'delete' cannot be called on an identifier in strict mode." }, + A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: 1, key: "A 'continue' statement can only be used within an enclosing iteration statement." }, + A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: 1, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, + Jump_target_cannot_cross_function_boundary: { code: 1107, category: 1, key: "Jump target cannot cross function boundary." }, + A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: 1, key: "A 'return' statement can only be used within a function body." }, + Expression_expected: { code: 1109, category: 1, key: "Expression expected." }, + Type_expected: { code: 1110, category: 1, key: "Type expected." }, + A_class_member_cannot_be_declared_optional: { code: 1112, category: 1, key: "A class member cannot be declared optional." }, + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: 1, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, + Duplicate_label_0: { code: 1114, category: 1, key: "Duplicate label '{0}'" }, + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: 1, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, + A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: 1, key: "A 'break' statement can only jump to a label of an enclosing statement." }, + An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: 1, key: "An object literal cannot have multiple properties with the same name in strict mode." }, + An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: 1, key: "An object literal cannot have multiple get/set accessors with the same name." }, + An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: 1, key: "An object literal cannot have property and accessor with the same name." }, + An_export_assignment_cannot_have_modifiers: { code: 1120, category: 1, key: "An export assignment cannot have modifiers." }, + Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: 1, key: "Octal literals are not allowed in strict mode." }, + A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: 1, key: "A tuple type element list cannot be empty." }, + Variable_declaration_list_cannot_be_empty: { code: 1123, category: 1, key: "Variable declaration list cannot be empty." }, + Digit_expected: { code: 1124, category: 1, key: "Digit expected." }, + Hexadecimal_digit_expected: { code: 1125, category: 1, key: "Hexadecimal digit expected." }, + Unexpected_end_of_text: { code: 1126, category: 1, key: "Unexpected end of text." }, + Invalid_character: { code: 1127, category: 1, key: "Invalid character." }, + Declaration_or_statement_expected: { code: 1128, category: 1, key: "Declaration or statement expected." }, + Statement_expected: { code: 1129, category: 1, key: "Statement expected." }, + case_or_default_expected: { code: 1130, category: 1, key: "'case' or 'default' expected." }, + Property_or_signature_expected: { code: 1131, category: 1, key: "Property or signature expected." }, + Enum_member_expected: { code: 1132, category: 1, key: "Enum member expected." }, + Type_reference_expected: { code: 1133, category: 1, key: "Type reference expected." }, + Variable_declaration_expected: { code: 1134, category: 1, key: "Variable declaration expected." }, + Argument_expression_expected: { code: 1135, category: 1, key: "Argument expression expected." }, + Property_assignment_expected: { code: 1136, category: 1, key: "Property assignment expected." }, + Expression_or_comma_expected: { code: 1137, category: 1, key: "Expression or comma expected." }, + Parameter_declaration_expected: { code: 1138, category: 1, key: "Parameter declaration expected." }, + Type_parameter_declaration_expected: { code: 1139, category: 1, key: "Type parameter declaration expected." }, + Type_argument_expected: { code: 1140, category: 1, key: "Type argument expected." }, + String_literal_expected: { code: 1141, category: 1, key: "String literal expected." }, + Line_break_not_permitted_here: { code: 1142, category: 1, key: "Line break not permitted here." }, + or_expected: { code: 1144, category: 1, key: "'{' or ';' expected." }, + Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: 1, key: "Modifiers not permitted on index signature members." }, + Declaration_expected: { code: 1146, category: 1, key: "Declaration expected." }, + Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: 1, key: "Import declarations in an internal module cannot reference an external module." }, + Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: 1, key: "Cannot compile external modules unless the '--module' flag is provided." }, + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: 1, key: "File name '{0}' differs from already included file name '{1}' only in casing" }, + new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: 1, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, + var_let_or_const_expected: { code: 1152, category: 1, key: "'var', 'let' or 'const' expected." }, + let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: 1, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." }, + const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: 1, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." }, + const_declarations_must_be_initialized: { code: 1155, category: 1, key: "'const' declarations must be initialized" }, + const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: 1, key: "'const' declarations can only be declared inside a block." }, + let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: 1, key: "'let' declarations can only be declared inside a block." }, + Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: 1, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." }, + Unterminated_template_literal: { code: 1160, category: 1, key: "Unterminated template literal." }, + Unterminated_regular_expression_literal: { code: 1161, category: 1, key: "Unterminated regular expression literal." }, + An_object_member_cannot_be_declared_optional: { code: 1162, category: 1, key: "An object member cannot be declared optional." }, + yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: 1, key: "'yield' expression must be contained_within a generator declaration." }, + Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: 1, key: "Computed property names are not allowed in enums." }, + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: 1, key: "A computed property name in an ambient context must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: 1, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, + Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: 1, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: 1, key: "A computed property name in a method overload must directly refer to a built-in symbol." }, + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: 1, key: "A computed property name in an interface must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: 1, key: "A computed property name in a type literal must directly refer to a built-in symbol." }, + A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: 1, key: "A comma expression is not allowed in a computed property name." }, + extends_clause_already_seen: { code: 1172, category: 1, key: "'extends' clause already seen." }, + extends_clause_must_precede_implements_clause: { code: 1173, category: 1, key: "'extends' clause must precede 'implements' clause." }, + Classes_can_only_extend_a_single_class: { code: 1174, category: 1, key: "Classes can only extend a single class." }, + implements_clause_already_seen: { code: 1175, category: 1, key: "'implements' clause already seen." }, + Interface_declaration_cannot_have_implements_clause: { code: 1176, category: 1, key: "Interface declaration cannot have 'implements' clause." }, + Binary_digit_expected: { code: 1177, category: 1, key: "Binary digit expected." }, + Octal_digit_expected: { code: 1178, category: 1, key: "Octal digit expected." }, + Unexpected_token_expected: { code: 1179, category: 1, key: "Unexpected token. '{' expected." }, + Property_destructuring_pattern_expected: { code: 1180, category: 1, key: "Property destructuring pattern expected." }, + Array_element_destructuring_pattern_expected: { code: 1181, category: 1, key: "Array element destructuring pattern expected." }, + A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: 1, key: "A destructuring declaration must have an initializer." }, + Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: 1, key: "Destructuring declarations are not allowed in ambient contexts." }, + An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: 1, key: "An implementation cannot be declared in ambient contexts." }, + Modifiers_cannot_appear_here: { code: 1184, category: 1, key: "Modifiers cannot appear here." }, + Merge_conflict_marker_encountered: { code: 1185, category: 1, key: "Merge conflict marker encountered." }, + A_rest_element_cannot_have_an_initializer: { code: 1186, category: 1, key: "A rest element cannot have an initializer." }, + A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: 1, key: "A parameter property may not be a binding pattern." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: 1, key: "Only a single variable declaration is allowed in a 'for...of' statement." }, + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: 1, key: "The variable declaration of a 'for...in' statement cannot have an initializer." }, + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: 1, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, + Duplicate_identifier_0: { code: 2300, category: 1, key: "Duplicate identifier '{0}'." }, + Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1, 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: 1, key: "Static members cannot reference class type parameters." }, + Circular_definition_of_import_alias_0: { code: 2303, category: 1, key: "Circular definition of import alias '{0}'." }, + Cannot_find_name_0: { code: 2304, category: 1, key: "Cannot find name '{0}'." }, + Module_0_has_no_exported_member_1: { code: 2305, category: 1, key: "Module '{0}' has no exported member '{1}'." }, + File_0_is_not_an_external_module: { code: 2306, category: 1, key: "File '{0}' is not an external module." }, + Cannot_find_external_module_0: { code: 2307, category: 1, key: "Cannot find external module '{0}'." }, + A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: 1, key: "A module cannot have more than one export assignment." }, + An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: 1, key: "An export assignment cannot be used in a module with other exported elements." }, + Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: 1, key: "Type '{0}' recursively references itself as a base type." }, + A_class_may_only_extend_another_class: { code: 2311, category: 1, key: "A class may only extend another class." }, + An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: 1, key: "An interface may only extend a class or another interface." }, + Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: 1, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, + Generic_type_0_requires_1_type_argument_s: { code: 2314, category: 1, key: "Generic type '{0}' requires {1} type argument(s)." }, + Type_0_is_not_generic: { code: 2315, category: 1, key: "Type '{0}' is not generic." }, + Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1, key: "Global type '{0}' must be a class or interface type." }, + Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1, key: "Global type '{0}' must have {1} type parameter(s)." }, + Cannot_find_global_type_0: { code: 2318, category: 1, key: "Cannot find global type '{0}'." }, + Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, + Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, + Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, + Type_0_is_not_assignable_to_type_1: { code: 2322, category: 1, key: "Type '{0}' is not assignable to type '{1}'." }, + Property_0_is_missing_in_type_1: { code: 2324, category: 1, key: "Property '{0}' is missing in type '{1}'." }, + Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: 1, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, + Types_of_property_0_are_incompatible: { code: 2326, category: 1, key: "Types of property '{0}' are incompatible." }, + Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: 1, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, + Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: 1, key: "Types of parameters '{0}' and '{1}' are incompatible." }, + Index_signature_is_missing_in_type_0: { code: 2329, category: 1, key: "Index signature is missing in type '{0}'." }, + Index_signatures_are_incompatible: { code: 2330, category: 1, key: "Index signatures are incompatible." }, + this_cannot_be_referenced_in_a_module_body: { code: 2331, category: 1, key: "'this' cannot be referenced in a module body." }, + this_cannot_be_referenced_in_current_location: { code: 2332, category: 1, key: "'this' cannot be referenced in current location." }, + this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: 1, key: "'this' cannot be referenced in constructor arguments." }, + this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: 1, key: "'this' cannot be referenced in a static property initializer." }, + super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: 1, key: "'super' can only be referenced in a derived class." }, + super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: 1, key: "'super' cannot be referenced in constructor arguments." }, + Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: 1, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, + super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: 1, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, + Property_0_does_not_exist_on_type_1: { code: 2339, category: 1, key: "Property '{0}' does not exist on type '{1}'." }, + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, + Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1, key: "Property '{0}' is private and only accessible within class '{1}'." }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: 1, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, + Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1, key: "Type '{0}' does not satisfy the constraint '{1}'." }, + Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, + Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1, key: "Supplied parameters do not match any signature of call target." }, + Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: 1, key: "Untyped function calls may not accept type arguments." }, + Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: 1, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, + Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: 1, key: "Cannot invoke an expression whose type lacks a call signature." }, + Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: 1, key: "Only a void function can be called with the 'new' keyword." }, + Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: 1, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, + Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: 1, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + No_best_common_type_exists_among_return_expressions: { code: 2354, category: 1, key: "No best common type exists among return expressions." }, + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: 1, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, + An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: 1, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, + The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, + The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: 1, key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, + The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: 1, key: "Invalid left-hand side of assignment expression." }, + Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: 1, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, + Type_parameter_name_cannot_be_0: { code: 2368, category: 1, key: "Type parameter name cannot be '{0}'" }, + A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: 1, key: "A parameter property is only allowed in a constructor implementation." }, + A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: 1, key: "A rest parameter must be of an array type." }, + A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: 1, key: "A parameter initializer is only allowed in a function or constructor implementation." }, + Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: 1, key: "Parameter '{0}' cannot be referenced in its initializer." }, + Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: 1, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, + Duplicate_string_index_signature: { code: 2374, category: 1, key: "Duplicate string index signature." }, + Duplicate_number_index_signature: { code: 2375, category: 1, key: "Duplicate number index signature." }, + A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: 1, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, + Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: 1, key: "Constructors for derived classes must contain a 'super' call." }, + A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: 1, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, + Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: 1, key: "Getter and setter accessors do not agree in visibility." }, + get_and_set_accessor_must_have_the_same_type: { code: 2380, category: 1, key: "'get' and 'set' accessor must have the same type." }, + A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: 1, key: "A signature with an implementation cannot use a string literal type." }, + Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: 1, key: "Specialized overload signature is not assignable to any non-specialized signature." }, + Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: 1, key: "Overload signatures must all be exported or not exported." }, + Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: 1, key: "Overload signatures must all be ambient or non-ambient." }, + Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: 1, key: "Overload signatures must all be public, private or protected." }, + Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: 1, key: "Overload signatures must all be optional or required." }, + Function_overload_must_be_static: { code: 2387, category: 1, key: "Function overload must be static." }, + Function_overload_must_not_be_static: { code: 2388, category: 1, key: "Function overload must not be static." }, + Function_implementation_name_must_be_0: { code: 2389, category: 1, key: "Function implementation name must be '{0}'." }, + Constructor_implementation_is_missing: { code: 2390, category: 1, key: "Constructor implementation is missing." }, + Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: 1, key: "Function implementation is missing or not immediately following the declaration." }, + Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: 1, key: "Multiple constructor implementations are not allowed." }, + Duplicate_function_implementation: { code: 2393, category: 1, key: "Duplicate function implementation." }, + Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: 1, key: "Overload signature is not compatible with function implementation." }, + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: 1, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, + Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: 1, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, + Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: 1, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, + Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: 1, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, + Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: 1, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, + Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: 1, key: "Expression resolves to '_super' that compiler uses to capture base class reference." }, + Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: 1, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, + The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: 1, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, + The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: 1, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, + Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: 1, key: "Invalid left-hand side in 'for...in' statement." }, + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: 1, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, + Setters_cannot_return_a_value: { code: 2408, category: 1, key: "Setters cannot return a value." }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: 1, key: "Return type of constructor signature must be assignable to the instance type of the class" }, + All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: 1, key: "All symbols within a 'with' block will be resolved to 'any'." }, + Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: 1, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, + Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: 1, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, + Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: 1, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, + Class_name_cannot_be_0: { code: 2414, category: 1, key: "Class name cannot be '{0}'" }, + Class_0_incorrectly_extends_base_class_1: { code: 2415, category: 1, key: "Class '{0}' incorrectly extends base class '{1}'." }, + Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: 1, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, + Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: 1, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, + Class_0_incorrectly_implements_interface_1: { code: 2420, category: 1, key: "Class '{0}' incorrectly implements interface '{1}'." }, + A_class_may_only_implement_another_class_or_interface: { code: 2422, category: 1, key: "A class may only implement another class or interface." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, + Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: 1, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, + Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: 1, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, + Interface_name_cannot_be_0: { code: 2427, category: 1, key: "Interface name cannot be '{0}'" }, + All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: 1, key: "All declarations of an interface must have identical type parameters." }, + Interface_0_incorrectly_extends_interface_1: { code: 2430, category: 1, key: "Interface '{0}' incorrectly extends interface '{1}'." }, + Enum_name_cannot_be_0: { code: 2431, category: 1, key: "Enum name cannot be '{0}'" }, + In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: 1, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, + A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: 1, key: "A module declaration cannot be in a different file from a class or function with which it is merged" }, + A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: 1, key: "A module declaration cannot be located prior to a class or function with which it is merged" }, + Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: 1, key: "Ambient external modules cannot be nested in other modules." }, + Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: 1, key: "Ambient external module declaration cannot specify relative module name." }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: 1, key: "Module '{0}' is hidden by a local declaration with the same name" }, + Import_name_cannot_be_0: { code: 2438, category: 1, key: "Import name cannot be '{0}'" }, + Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: 1, key: "Import declaration in an ambient external module declaration cannot reference external module through relative external module name." }, + Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: 1, key: "Import declaration conflicts with local declaration of '{0}'" }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: 1, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, + Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: 1, key: "Types have separate declarations of a private property '{0}'." }, + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: 1, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, + Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: 1, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: 1, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: 1, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, + The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: 1, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, + Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: 1, key: "Block-scoped variable '{0}' used before its declaration." }, + The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: 1, key: "The operand of an increment or decrement operator cannot be a constant." }, + Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: 1, key: "Left-hand side of assignment expression cannot be a constant." }, + Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: 1, key: "Cannot redeclare block-scoped variable '{0}'." }, + An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: 1, key: "An enum member cannot have a numeric name." }, + The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: 1, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, + Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: 1, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, + Type_alias_0_circularly_references_itself: { code: 2456, category: 1, key: "Type alias '{0}' circularly references itself." }, + Type_alias_name_cannot_be_0: { code: 2457, category: 1, key: "Type alias name cannot be '{0}'" }, + An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: 1, key: "An AMD module cannot have multiple name assignments." }, + Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: 1, key: "Type '{0}' has no property '{1}' and no string index signature." }, + Type_0_has_no_property_1: { code: 2460, category: 1, key: "Type '{0}' has no property '{1}'." }, + Type_0_is_not_an_array_type: { code: 2461, category: 1, key: "Type '{0}' is not an array type." }, + A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: 1, key: "A rest element must be last in an array destructuring pattern" }, + A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: 1, key: "A binding pattern parameter cannot be optional in an implementation signature." }, + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: 1, key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, + this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: 1, key: "'this' cannot be referenced in a computed property name." }, + super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: 1, key: "'super' cannot be referenced in a computed property name." }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: 1, key: "A computed property name cannot reference a type parameter from its containing type." }, + Cannot_find_global_value_0: { code: 2468, category: 1, key: "Cannot find global value '{0}'." }, + The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: 1, key: "The '{0}' operator cannot be applied to type 'symbol'." }, + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: 1, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: 1, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: 1, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, + Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: 1, key: "Enum declarations must all be const or non-const." }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: 1, key: "In 'const' enum declarations member initializer must be constant expression." }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: 1, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: 1, key: "A const enum member can only be accessed using a string literal." }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: 1, key: "'const' enum member initializer was evaluated to a non-finite value." }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: 1, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, + Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: 1, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: 1, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: 1, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, + for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: 1, key: "'for...of' statements are only available when targeting ECMAScript 6 or higher." }, + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: 1, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, + Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1, key: "Import declaration '{0}' is using private name '{1}'." }, + Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, + Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: 1, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: 1, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: 1, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: 1, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: 1, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: 1, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: 1, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, + Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: 1, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: 1, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: 1, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, + Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, + Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, + Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: 1, key: "Exported variable '{0}' has or is using private name '{1}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: 1, key: "Public static property '{0}' of exported class has or is using private name '{1}'." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: 1, key: "Public property '{0}' of exported class has or is using private name '{1}'." }, + Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: 1, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, + Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: 1, key: "Property '{0}' of exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: 1, key: "Return type of public static property getter from exported class has or is using private name '{0}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: 1, key: "Return type of public property getter from exported class has or is using private name '{0}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: 1, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: 1, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: 1, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: 1, key: "Return type of call signature from exported interface has or is using private name '{0}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: 1, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: 1, key: "Return type of index signature from exported interface has or is using private name '{0}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: 1, key: "Return type of public static method from exported class has or is using private name '{0}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: 1, key: "Return type of public method from exported class has or is using private name '{0}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: 1, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: 1, key: "Return type of method from exported interface has or is using private name '{0}'." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: 1, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: 1, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, + Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: 1, key: "Return type of exported function has or is using private name '{0}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: 1, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: 1, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: 1, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, + Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1, key: "Exported type alias '{0}' has or is using private name '{1}'." }, + The_current_host_does_not_support_the_0_option: { code: 5001, category: 1, key: "The current host does not support the '{0}' option." }, + Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1, key: "Cannot find the common subdirectory path for the input files." }, + Cannot_read_file_0_Colon_1: { code: 5012, category: 1, key: "Cannot read file '{0}': {1}" }, + Unsupported_file_encoding: { code: 5013, category: 1, key: "Unsupported file encoding." }, + Unknown_compiler_option_0: { code: 5023, category: 1, key: "Unknown compiler option '{0}'." }, + Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: 1, key: "Compiler option '{0}' requires a value of type {1}." }, + Could_not_write_file_0_Colon_1: { code: 5033, category: 1, key: "Could not write file '{0}': {1}" }, + Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: 1, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: 1, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: 1, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, + Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: 1, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, + Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: 1, key: "Option 'project' cannot be mixed with source files on a command line." }, + Concatenate_and_emit_output_to_single_file: { code: 6001, category: 2, key: "Concatenate and emit output to single file." }, + Generates_corresponding_d_ts_file: { code: 6002, category: 2, key: "Generates corresponding '.d.ts' file." }, + Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: 2, key: "Specifies the location where debugger should locate map files instead of generated locations." }, + Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: 2, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, + Watch_input_files: { code: 6005, category: 2, key: "Watch input files." }, + Redirect_output_structure_to_the_directory: { code: 6006, category: 2, key: "Redirect output structure to the directory." }, + Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: 2, key: "Do not erase const enum declarations in generated code." }, + Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: 2, key: "Do not emit outputs if any type checking errors were reported." }, + Do_not_emit_comments_to_output: { code: 6009, category: 2, key: "Do not emit comments to output." }, + Do_not_emit_outputs: { code: 6010, category: 2, key: "Do not emit outputs." }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: 2, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, + Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: 2, key: "Specify module code generation: 'commonjs' or 'amd'" }, + Print_this_message: { code: 6017, category: 2, key: "Print this message." }, + Print_the_compiler_s_version: { code: 6019, category: 2, key: "Print the compiler's version." }, + Compile_the_project_in_the_given_directory: { code: 6020, category: 2, key: "Compile the project in the given directory." }, + Syntax_Colon_0: { code: 6023, category: 2, key: "Syntax: {0}" }, + options: { code: 6024, category: 2, key: "options" }, + file: { code: 6025, category: 2, key: "file" }, + Examples_Colon_0: { code: 6026, category: 2, key: "Examples: {0}" }, + Options_Colon: { code: 6027, category: 2, key: "Options:" }, + Version_0: { code: 6029, category: 2, key: "Version {0}" }, + Insert_command_line_options_and_files_from_a_file: { code: 6030, category: 2, key: "Insert command line options and files from a file." }, + File_change_detected_Starting_incremental_compilation: { code: 6032, category: 2, key: "File change detected. Starting incremental compilation..." }, + KIND: { code: 6034, category: 2, key: "KIND" }, + FILE: { code: 6035, category: 2, key: "FILE" }, + VERSION: { code: 6036, category: 2, key: "VERSION" }, + LOCATION: { code: 6037, category: 2, key: "LOCATION" }, + DIRECTORY: { code: 6038, category: 2, key: "DIRECTORY" }, + Compilation_complete_Watching_for_file_changes: { code: 6042, category: 2, key: "Compilation complete. Watching for file changes." }, + Generates_corresponding_map_file: { code: 6043, category: 2, key: "Generates corresponding '.map' file." }, + Compiler_option_0_expects_an_argument: { code: 6044, category: 1, key: "Compiler option '{0}' expects an argument." }, + Unterminated_quoted_string_in_response_file_0: { code: 6045, category: 1, key: "Unterminated quoted string in response file '{0}'." }, + Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: 1, key: "Argument for '--module' option must be 'commonjs' or 'amd'." }, + Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: 1, 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: 1, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, + Unsupported_locale_0: { code: 6049, category: 1, key: "Unsupported locale '{0}'." }, + Unable_to_open_file_0: { code: 6050, category: 1, key: "Unable to open file '{0}'." }, + Corrupted_locale_file_0: { code: 6051, category: 1, key: "Corrupted locale file {0}." }, + Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: 2, key: "Raise error on expressions and declarations with an implied 'any' type." }, + File_0_not_found: { code: 6053, category: 1, key: "File '{0}' not found." }, + File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: 1, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, + Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: 2, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, + Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: 2, key: "Do not emit declarations for code that has an '@internal' annotation." }, + Variable_0_implicitly_has_an_1_type: { code: 7005, category: 1, key: "Variable '{0}' implicitly has an '{1}' type." }, + Parameter_0_implicitly_has_an_1_type: { code: 7006, category: 1, key: "Parameter '{0}' implicitly has an '{1}' type." }, + Member_0_implicitly_has_an_1_type: { code: 7008, category: 1, key: "Member '{0}' implicitly has an '{1}' type." }, + new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: 1, key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, + _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: 1, key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, + Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: 1, key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, + Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: 1, key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: 1, key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, + Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: 1, key: "Index signature of object type implicitly has an 'any' type." }, + Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, + Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, + Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: 1, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, + _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: 1, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, + _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: { code: 7023, category: 1, key: "'{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." }, + Function_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: { code: 7024, category: 1, key: "Function 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." }, + You_cannot_rename_this_element: { code: 8000, category: 1, key: "You cannot rename this element." }, + You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: 1, key: "You cannot rename elements that are defined in the standard TypeScript library." }, + yield_expressions_are_not_currently_supported: { code: 9000, category: 1, key: "'yield' expressions are not currently supported." }, + Generators_are_not_currently_supported: { code: 9001, category: 1, key: "Generators are not currently supported." }, + The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: 1, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, + for_of_statements_are_not_currently_supported: { code: 9003, category: 1, key: "'for...of' statements are not currently supported." } }; })(ts || (ts = {})); var ts; (function (ts) { var textToToken = { - "any": 110 /* AnyKeyword */, - "boolean": 111 /* BooleanKeyword */, - "break": 65 /* BreakKeyword */, - "case": 66 /* CaseKeyword */, - "catch": 67 /* CatchKeyword */, - "class": 68 /* ClassKeyword */, - "continue": 70 /* ContinueKeyword */, - "const": 69 /* ConstKeyword */, - "constructor": 112 /* ConstructorKeyword */, - "debugger": 71 /* DebuggerKeyword */, - "declare": 113 /* DeclareKeyword */, - "default": 72 /* DefaultKeyword */, - "delete": 73 /* DeleteKeyword */, - "do": 74 /* DoKeyword */, - "else": 75 /* ElseKeyword */, - "enum": 76 /* EnumKeyword */, - "export": 77 /* ExportKeyword */, - "extends": 78 /* ExtendsKeyword */, - "false": 79 /* FalseKeyword */, - "finally": 80 /* FinallyKeyword */, - "for": 81 /* ForKeyword */, - "function": 82 /* FunctionKeyword */, - "get": 114 /* GetKeyword */, - "if": 83 /* IfKeyword */, - "implements": 101 /* ImplementsKeyword */, - "import": 84 /* ImportKeyword */, - "in": 85 /* InKeyword */, - "instanceof": 86 /* InstanceOfKeyword */, - "interface": 102 /* InterfaceKeyword */, - "let": 103 /* LetKeyword */, - "module": 115 /* ModuleKeyword */, - "new": 87 /* NewKeyword */, - "null": 88 /* NullKeyword */, - "number": 117 /* NumberKeyword */, - "package": 104 /* PackageKeyword */, - "private": 105 /* PrivateKeyword */, - "protected": 106 /* ProtectedKeyword */, - "public": 107 /* PublicKeyword */, - "require": 116 /* RequireKeyword */, - "return": 89 /* ReturnKeyword */, - "set": 118 /* SetKeyword */, - "static": 108 /* StaticKeyword */, - "string": 119 /* StringKeyword */, - "super": 90 /* SuperKeyword */, - "switch": 91 /* SwitchKeyword */, - "this": 92 /* ThisKeyword */, - "throw": 93 /* ThrowKeyword */, - "true": 94 /* TrueKeyword */, - "try": 95 /* TryKeyword */, - "type": 120 /* TypeKeyword */, - "typeof": 96 /* TypeOfKeyword */, - "var": 97 /* VarKeyword */, - "void": 98 /* VoidKeyword */, - "while": 99 /* WhileKeyword */, - "with": 100 /* WithKeyword */, - "yield": 109 /* YieldKeyword */, - "{": 14 /* OpenBraceToken */, - "}": 15 /* CloseBraceToken */, - "(": 16 /* OpenParenToken */, - ")": 17 /* CloseParenToken */, - "[": 18 /* OpenBracketToken */, - "]": 19 /* CloseBracketToken */, - ".": 20 /* DotToken */, - "...": 21 /* DotDotDotToken */, - ";": 22 /* SemicolonToken */, - ",": 23 /* CommaToken */, - "<": 24 /* LessThanToken */, - ">": 25 /* GreaterThanToken */, - "<=": 26 /* LessThanEqualsToken */, - ">=": 27 /* GreaterThanEqualsToken */, - "==": 28 /* EqualsEqualsToken */, - "!=": 29 /* ExclamationEqualsToken */, - "===": 30 /* EqualsEqualsEqualsToken */, - "!==": 31 /* ExclamationEqualsEqualsToken */, - "=>": 32 /* EqualsGreaterThanToken */, - "+": 33 /* PlusToken */, - "-": 34 /* MinusToken */, - "*": 35 /* AsteriskToken */, - "/": 36 /* SlashToken */, - "%": 37 /* PercentToken */, - "++": 38 /* PlusPlusToken */, - "--": 39 /* MinusMinusToken */, - "<<": 40 /* LessThanLessThanToken */, - ">>": 41 /* GreaterThanGreaterThanToken */, - ">>>": 42 /* GreaterThanGreaterThanGreaterThanToken */, - "&": 43 /* AmpersandToken */, - "|": 44 /* BarToken */, - "^": 45 /* CaretToken */, - "!": 46 /* ExclamationToken */, - "~": 47 /* TildeToken */, - "&&": 48 /* AmpersandAmpersandToken */, - "||": 49 /* BarBarToken */, - "?": 50 /* QuestionToken */, - ":": 51 /* ColonToken */, - "=": 52 /* EqualsToken */, - "+=": 53 /* PlusEqualsToken */, - "-=": 54 /* MinusEqualsToken */, - "*=": 55 /* AsteriskEqualsToken */, - "/=": 56 /* SlashEqualsToken */, - "%=": 57 /* PercentEqualsToken */, - "<<=": 58 /* LessThanLessThanEqualsToken */, - ">>=": 59 /* GreaterThanGreaterThanEqualsToken */, - ">>>=": 60 /* GreaterThanGreaterThanGreaterThanEqualsToken */, - "&=": 61 /* AmpersandEqualsToken */, - "|=": 62 /* BarEqualsToken */, - "^=": 63 /* CaretEqualsToken */ + "any": 110, + "boolean": 111, + "break": 65, + "case": 66, + "catch": 67, + "class": 68, + "continue": 70, + "const": 69, + "constructor": 112, + "debugger": 71, + "declare": 113, + "default": 72, + "delete": 73, + "do": 74, + "else": 75, + "enum": 76, + "export": 77, + "extends": 78, + "false": 79, + "finally": 80, + "for": 81, + "function": 82, + "get": 114, + "if": 83, + "implements": 101, + "import": 84, + "in": 85, + "instanceof": 86, + "interface": 102, + "let": 103, + "module": 115, + "new": 87, + "null": 88, + "number": 117, + "package": 104, + "private": 105, + "protected": 106, + "public": 107, + "require": 116, + "return": 89, + "set": 118, + "static": 108, + "string": 119, + "super": 90, + "switch": 91, + "symbol": 120, + "this": 92, + "throw": 93, + "true": 94, + "try": 95, + "type": 121, + "typeof": 96, + "var": 97, + "void": 98, + "while": 99, + "with": 100, + "yield": 109, + "of": 122, + "{": 14, + "}": 15, + "(": 16, + ")": 17, + "[": 18, + "]": 19, + ".": 20, + "...": 21, + ";": 22, + ",": 23, + "<": 24, + ">": 25, + "<=": 26, + ">=": 27, + "==": 28, + "!=": 29, + "===": 30, + "!==": 31, + "=>": 32, + "+": 33, + "-": 34, + "*": 35, + "/": 36, + "%": 37, + "++": 38, + "--": 39, + "<<": 40, + ">>": 41, + ">>>": 42, + "&": 43, + "|": 44, + "^": 45, + "!": 46, + "~": 47, + "&&": 48, + "||": 49, + "?": 50, + ":": 51, + "=": 52, + "+=": 53, + "-=": 54, + "*=": 55, + "/=": 56, + "%=": 57, + "<<=": 58, + ">>=": 59, + ">>>=": 60, + "&=": 61, + "|=": 62, + "^=": 63 }; 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,]; @@ -1462,10 +1480,11 @@ var ts; return false; } function isUnicodeIdentifierStart(code, languageVersion) { - return languageVersion >= 1 /* ES5 */ ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); + return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); } + ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart; function isUnicodeIdentifierPart(code, languageVersion) { - return languageVersion >= 1 /* ES5 */ ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) : lookupInUnicodeMap(code, unicodeES3IdentifierPart); + return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) : lookupInUnicodeMap(code, unicodeES3IdentifierPart); } function makeReverseMap(source) { var result = []; @@ -1488,16 +1507,16 @@ var ts; while (pos < text.length) { var ch = text.charCodeAt(pos++); switch (ch) { - case 13 /* carriageReturn */: - if (text.charCodeAt(pos) === 10 /* lineFeed */) { + case 13: + if (text.charCodeAt(pos) === 10) { pos++; } - case 10 /* lineFeed */: + case 10: result.push(lineStart); lineStart = pos; break; default: - if (ch > 127 /* maxAsciiCharacter */ && isLineBreak(ch)) { + if (ch > 127 && isLineBreak(ch)) { result.push(lineStart); lineStart = pos; } @@ -1508,15 +1527,15 @@ var ts; return result; } ts.computeLineStarts = computeLineStarts; - function getPositionFromLineAndCharacter(sourceFile, line, character) { - return computePositionFromLineAndCharacter(getLineStarts(sourceFile), line, character); + function getPositionOfLineAndCharacter(sourceFile, line, character) { + return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character); } - ts.getPositionFromLineAndCharacter = getPositionFromLineAndCharacter; - function computePositionFromLineAndCharacter(lineStarts, line, character) { - ts.Debug.assert(line > 0 && line <= lineStarts.length); - return lineStarts[line - 1] + character - 1; + ts.getPositionOfLineAndCharacter = getPositionOfLineAndCharacter; + function computePositionOfLineAndCharacter(lineStarts, line, character) { + ts.Debug.assert(line >= 0 && line < lineStarts.length); + return lineStarts[line] + character; } - ts.computePositionFromLineAndCharacter = computePositionFromLineAndCharacter; + ts.computePositionOfLineAndCharacter = computePositionOfLineAndCharacter; function getLineStarts(sourceFile) { return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text)); } @@ -1524,11 +1543,11 @@ var ts; function computeLineAndCharacterOfPosition(lineStarts, position) { var lineNumber = ts.binarySearch(lineStarts, position); if (lineNumber < 0) { - lineNumber = (~lineNumber) - 1; + lineNumber = ~lineNumber - 1; } return { - line: lineNumber + 1, - character: position - lineStarts[lineNumber] + 1 + line: lineNumber, + character: position - lineStarts[lineNumber] }; } ts.computeLineAndCharacterOfPosition = computeLineAndCharacterOfPosition; @@ -1538,42 +1557,44 @@ var ts; ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { - return ch === 32 /* space */ || ch === 9 /* tab */ || ch === 11 /* verticalTab */ || ch === 12 /* formFeed */ || ch === 160 /* nonBreakingSpace */ || ch === 5760 /* ogham */ || ch >= 8192 /* enQuad */ && ch <= 8203 /* zeroWidthSpace */ || ch === 8239 /* narrowNoBreakSpace */ || ch === 8287 /* mathematicalSpace */ || ch === 12288 /* ideographicSpace */ || ch === 65279 /* byteOrderMark */; + return ch === 32 || ch === 9 || ch === 11 || ch === 12 || + ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || + ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; } ts.isWhiteSpace = isWhiteSpace; function isLineBreak(ch) { - return ch === 10 /* lineFeed */ || ch === 13 /* carriageReturn */ || ch === 8232 /* lineSeparator */ || ch === 8233 /* paragraphSeparator */ || ch === 133 /* nextLine */; + return ch === 10 || ch === 13 || ch === 8232 || ch === 8233 || ch === 133; } ts.isLineBreak = isLineBreak; function isDigit(ch) { - return ch >= 48 /* _0 */ && ch <= 57 /* _9 */; + return ch >= 48 && ch <= 57; } function isOctalDigit(ch) { - return ch >= 48 /* _0 */ && ch <= 55 /* _7 */; + return ch >= 48 && ch <= 55; } ts.isOctalDigit = isOctalDigit; function skipTrivia(text, pos, stopAfterLineBreak) { while (true) { var ch = text.charCodeAt(pos); switch (ch) { - case 13 /* carriageReturn */: - if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) { + case 13: + if (text.charCodeAt(pos + 1) === 10) { pos++; } - case 10 /* lineFeed */: + case 10: pos++; if (stopAfterLineBreak) { return pos; } continue; - case 9 /* tab */: - case 11 /* verticalTab */: - case 12 /* formFeed */: - case 32 /* space */: + case 9: + case 11: + case 12: + case 32: pos++; continue; - case 47 /* slash */: - if (text.charCodeAt(pos + 1) === 47 /* slash */) { + case 47: + if (text.charCodeAt(pos + 1) === 47) { pos += 2; while (pos < text.length) { if (isLineBreak(text.charCodeAt(pos))) { @@ -1583,10 +1604,10 @@ var ts; } continue; } - if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { + if (text.charCodeAt(pos + 1) === 42) { pos += 2; while (pos < text.length) { - if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { + if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) { pos += 2; break; } @@ -1595,16 +1616,16 @@ var ts; continue; } break; - case 60 /* lessThan */: - case 61 /* equals */: - case 62 /* greaterThan */: + case 60: + case 61: + case 62: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos); continue; } break; default: - if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch) || isLineBreak(ch))) { + if (ch > 127 && (isWhiteSpace(ch) || isLineBreak(ch))) { pos++; continue; } @@ -1625,7 +1646,8 @@ var ts; return false; } } - return ch === 61 /* equals */ || text.charCodeAt(pos + mergeConflictMarkerLength) === 32 /* space */; + return ch === 61 || + text.charCodeAt(pos + mergeConflictMarkerLength) === 32; } } return false; @@ -1636,16 +1658,16 @@ var ts; } var ch = text.charCodeAt(pos); var len = text.length; - if (ch === 60 /* lessThan */ || ch === 62 /* greaterThan */) { + if (ch === 60 || ch === 62) { while (pos < len && !isLineBreak(text.charCodeAt(pos))) { pos++; } } else { - ts.Debug.assert(ch === 61 /* equals */); + ts.Debug.assert(ch === 61); while (pos < len) { var ch = text.charCodeAt(pos); - if (ch === 62 /* greaterThan */ && isConflictMarkerTrivia(text, pos)) { + if (ch === 62 && isConflictMarkerTrivia(text, pos)) { break; } pos++; @@ -1659,10 +1681,10 @@ var ts; while (true) { var ch = text.charCodeAt(pos); switch (ch) { - case 13 /* carriageReturn */: - if (text.charCodeAt(pos + 1) === 10 /* lineFeed */) + case 13: + if (text.charCodeAt(pos + 1) === 10) pos++; - case 10 /* lineFeed */: + case 10: pos++; if (trailing) { return result; @@ -1672,19 +1694,19 @@ var ts; result[result.length - 1].hasTrailingNewLine = true; } continue; - case 9 /* tab */: - case 11 /* verticalTab */: - case 12 /* formFeed */: - case 32 /* space */: + case 9: + case 11: + case 12: + case 32: pos++; continue; - case 47 /* slash */: + case 47: var nextChar = text.charCodeAt(pos + 1); var hasTrailingNewLine = false; - if (nextChar === 47 /* slash */ || nextChar === 42 /* asterisk */) { + if (nextChar === 47 || nextChar === 42) { var startPos = pos; pos += 2; - if (nextChar === 47 /* slash */) { + if (nextChar === 47) { while (pos < text.length) { if (isLineBreak(text.charCodeAt(pos))) { hasTrailingNewLine = true; @@ -1695,7 +1717,7 @@ var ts; } else { while (pos < text.length) { - if (text.charCodeAt(pos) === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { + if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) { pos += 2; break; } @@ -1711,7 +1733,7 @@ var ts; } break; default: - if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch) || isLineBreak(ch))) { + if (ch > 127 && (isWhiteSpace(ch) || isLineBreak(ch))) { if (result && result.length && isLineBreak(ch)) { result[result.length - 1].hasTrailingNewLine = true; } @@ -1732,11 +1754,15 @@ var ts; } ts.getTrailingCommentRanges = getTrailingCommentRanges; function isIdentifierStart(ch, languageVersion) { - return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } ts.isIdentifierStart = isIdentifierStart; function isIdentifierPart(ch, languageVersion) { - 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); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } ts.isIdentifierPart = isIdentifierPart; function createScanner(languageVersion, skipTrivia, text, onError) { @@ -1754,24 +1780,28 @@ var ts; } } 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); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch === 36 || ch === 95 || + ch > 127 && 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); + 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))) pos++; - if (text.charCodeAt(pos) === 46 /* dot */) { + if (text.charCodeAt(pos) === 46) { pos++; while (isDigit(text.charCodeAt(pos))) pos++; } var end = pos; - if (text.charCodeAt(pos) === 69 /* E */ || text.charCodeAt(pos) === 101 /* e */) { + if (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101) { pos++; - if (text.charCodeAt(pos) === 43 /* plus */ || text.charCodeAt(pos) === 45 /* minus */) + if (text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) pos++; if (isDigit(text.charCodeAt(pos))) { pos++; @@ -1797,14 +1827,14 @@ var ts; var value = 0; while (digits < count || !mustMatchCount) { var ch = text.charCodeAt(pos); - if (ch >= 48 /* _0 */ && ch <= 57 /* _9 */) { - value = value * 16 + ch - 48 /* _0 */; + if (ch >= 48 && ch <= 57) { + value = value * 16 + ch - 48; } - else if (ch >= 65 /* A */ && ch <= 70 /* F */) { - value = value * 16 + ch - 65 /* A */ + 10; + else if (ch >= 65 && ch <= 70) { + value = value * 16 + ch - 65 + 10; } - else if (ch >= 97 /* a */ && ch <= 102 /* f */) { - value = value * 16 + ch - 97 /* a */ + 10; + else if (ch >= 97 && ch <= 102) { + value = value * 16 + ch - 97 + 10; } else { break; @@ -1834,7 +1864,7 @@ var ts; pos++; break; } - if (ch === 92 /* backslash */) { + if (ch === 92) { result += text.substring(start, pos); result += scanEscapeSequence(); start = pos; @@ -1851,7 +1881,7 @@ var ts; return result; } function scanTemplateAndSetTokenValue() { - var startedWithBacktick = text.charCodeAt(pos) === 96 /* backtick */; + var startedWithBacktick = text.charCodeAt(pos) === 96; pos++; var start = pos; var contents = ""; @@ -1861,32 +1891,32 @@ var ts; contents += text.substring(start, pos); tokenIsUnterminated = true; error(ts.Diagnostics.Unterminated_template_literal); - resultingToken = startedWithBacktick ? 10 /* NoSubstitutionTemplateLiteral */ : 13 /* TemplateTail */; + resultingToken = startedWithBacktick ? 10 : 13; break; } var currChar = text.charCodeAt(pos); - if (currChar === 96 /* backtick */) { + if (currChar === 96) { contents += text.substring(start, pos); pos++; - resultingToken = startedWithBacktick ? 10 /* NoSubstitutionTemplateLiteral */ : 13 /* TemplateTail */; + resultingToken = startedWithBacktick ? 10 : 13; break; } - if (currChar === 36 /* $ */ && pos + 1 < len && text.charCodeAt(pos + 1) === 123 /* openBrace */) { + if (currChar === 36 && pos + 1 < len && text.charCodeAt(pos + 1) === 123) { contents += text.substring(start, pos); pos += 2; - resultingToken = startedWithBacktick ? 11 /* TemplateHead */ : 12 /* TemplateMiddle */; + resultingToken = startedWithBacktick ? 11 : 12; break; } - if (currChar === 92 /* backslash */) { + if (currChar === 92) { contents += text.substring(start, pos); contents += scanEscapeSequence(); start = pos; continue; } - if (currChar === 13 /* carriageReturn */) { + if (currChar === 13) { contents += text.substring(start, pos); pos++; - if (pos < len && text.charCodeAt(pos) === 10 /* lineFeed */) { + if (pos < len && text.charCodeAt(pos) === 10) { pos++; } contents += "\n"; @@ -1907,27 +1937,27 @@ var ts; } var ch = text.charCodeAt(pos++); switch (ch) { - case 48 /* _0 */: + case 48: return "\0"; - case 98 /* b */: + case 98: return "\b"; - case 116 /* t */: + case 116: return "\t"; - case 110 /* n */: + case 110: return "\n"; - case 118 /* v */: + case 118: return "\v"; - case 102 /* f */: + case 102: return "\f"; - case 114 /* r */: + case 114: return "\r"; - case 39 /* singleQuote */: + case 39: return "\'"; - case 34 /* doubleQuote */: + case 34: return "\""; - case 120 /* x */: - case 117 /* u */: - var ch = scanHexDigits(ch === 120 /* x */ ? 2 : 4, true); + case 120: + case 117: + var ch = scanHexDigits(ch === 120 ? 2 : 4, true); if (ch >= 0) { return String.fromCharCode(ch); } @@ -1935,20 +1965,20 @@ var ts; error(ts.Diagnostics.Hexadecimal_digit_expected); return ""; } - case 13 /* carriageReturn */: - if (pos < len && text.charCodeAt(pos) === 10 /* lineFeed */) { + case 13: + if (pos < len && text.charCodeAt(pos) === 10) { pos++; } - case 10 /* lineFeed */: - case 8232 /* lineSeparator */: - case 8233 /* paragraphSeparator */: + case 10: + case 8232: + case 8233: return ""; default: return String.fromCharCode(ch); } } function peekUnicodeEscape() { - if (pos + 5 < len && text.charCodeAt(pos + 1) === 117 /* u */) { + if (pos + 5 < len && text.charCodeAt(pos + 1) === 117) { var start = pos; pos += 2; var value = scanHexDigits(4, true); @@ -1965,7 +1995,7 @@ var ts; if (isIdentifierPart(ch)) { pos++; } - else if (ch === 92 /* backslash */) { + else if (ch === 92) { ch = peekUnicodeEscape(); if (!(ch >= 0 && isIdentifierPart(ch))) { break; @@ -1986,11 +2016,11 @@ var ts; var len = tokenValue.length; if (len >= 2 && len <= 11) { var ch = tokenValue.charCodeAt(0); - if (ch >= 97 /* a */ && ch <= 122 /* z */ && hasOwnProperty.call(textToToken, tokenValue)) { + if (ch >= 97 && ch <= 122 && hasOwnProperty.call(textToToken, tokenValue)) { return token = textToToken[tokenValue]; } } - return token = 64 /* Identifier */; + return token = 64; } function scanBinaryOrOctalDigits(base) { ts.Debug.assert(base !== 2 || base !== 8, "Expected either base 2 or base 8"); @@ -1998,7 +2028,7 @@ var ts; var numberOfDigits = 0; while (true) { var ch = text.charCodeAt(pos); - var valueOfCh = ch - 48 /* _0 */; + var valueOfCh = ch - 48; if (!isDigit(ch) || valueOfCh >= base) { break; } @@ -2018,30 +2048,30 @@ var ts; while (true) { tokenPos = pos; if (pos >= len) { - return token = 1 /* EndOfFileToken */; + return token = 1; } var ch = text.charCodeAt(pos); switch (ch) { - case 10 /* lineFeed */: - case 13 /* carriageReturn */: + case 10: + case 13: precedingLineBreak = true; if (skipTrivia) { pos++; continue; } else { - if (ch === 13 /* carriageReturn */ && pos + 1 < len && text.charCodeAt(pos + 1) === 10 /* lineFeed */) { + if (ch === 13 && pos + 1 < len && text.charCodeAt(pos + 1) === 10) { pos += 2; } else { pos++; } - return token = 4 /* NewLineTrivia */; + return token = 4; } - case 9 /* tab */: - case 11 /* verticalTab */: - case 12 /* formFeed */: - case 32 /* space */: + case 9: + case 11: + case 12: + case 32: if (skipTrivia) { pos++; continue; @@ -2050,73 +2080,73 @@ var ts; while (pos < len && isWhiteSpace(text.charCodeAt(pos))) { pos++; } - return token = 5 /* WhitespaceTrivia */; + return token = 5; } - case 33 /* exclamation */: - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 31 /* ExclamationEqualsEqualsToken */; + case 33: + if (text.charCodeAt(pos + 1) === 61) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 31; } - return pos += 2, token = 29 /* ExclamationEqualsToken */; + return pos += 2, token = 29; } - return pos++, token = 46 /* ExclamationToken */; - case 34 /* doubleQuote */: - case 39 /* singleQuote */: + return pos++, token = 46; + case 34: + case 39: tokenValue = scanString(); - return token = 8 /* StringLiteral */; - case 96 /* backtick */: + return token = 8; + case 96: return token = scanTemplateAndSetTokenValue(); - case 37 /* percent */: - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 57 /* PercentEqualsToken */; + case 37: + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 57; } - return pos++, token = 37 /* PercentToken */; - case 38 /* ampersand */: - if (text.charCodeAt(pos + 1) === 38 /* ampersand */) { - return pos += 2, token = 48 /* AmpersandAmpersandToken */; + return pos++, token = 37; + case 38: + if (text.charCodeAt(pos + 1) === 38) { + return pos += 2, token = 48; } - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 61 /* AmpersandEqualsToken */; + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 61; } - return pos++, token = 43 /* AmpersandToken */; - case 40 /* openParen */: - return pos++, token = 16 /* OpenParenToken */; - case 41 /* closeParen */: - return pos++, token = 17 /* CloseParenToken */; - case 42 /* asterisk */: - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 55 /* AsteriskEqualsToken */; + return pos++, token = 43; + case 40: + return pos++, token = 16; + case 41: + return pos++, token = 17; + case 42: + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 55; } - return pos++, token = 35 /* AsteriskToken */; - case 43 /* plus */: - if (text.charCodeAt(pos + 1) === 43 /* plus */) { - return pos += 2, token = 38 /* PlusPlusToken */; + return pos++, token = 35; + case 43: + if (text.charCodeAt(pos + 1) === 43) { + return pos += 2, token = 38; } - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 53 /* PlusEqualsToken */; + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 53; } - return pos++, token = 33 /* PlusToken */; - case 44 /* comma */: - return pos++, token = 23 /* CommaToken */; - case 45 /* minus */: - if (text.charCodeAt(pos + 1) === 45 /* minus */) { - return pos += 2, token = 39 /* MinusMinusToken */; + return pos++, token = 33; + case 44: + return pos++, token = 23; + case 45: + if (text.charCodeAt(pos + 1) === 45) { + return pos += 2, token = 39; } - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 54 /* MinusEqualsToken */; + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 54; } - return pos++, token = 34 /* MinusToken */; - case 46 /* dot */: + return pos++, token = 34; + case 46: if (isDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanNumber(); - return token = 7 /* NumericLiteral */; + return token = 7; } - if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) { - return pos += 3, token = 21 /* DotDotDotToken */; + if (text.charCodeAt(pos + 1) === 46 && text.charCodeAt(pos + 2) === 46) { + return pos += 3, token = 21; } - return pos++, token = 20 /* DotToken */; - case 47 /* slash */: - if (text.charCodeAt(pos + 1) === 47 /* slash */) { + return pos++, token = 20; + case 47: + if (text.charCodeAt(pos + 1) === 47) { pos += 2; while (pos < len) { if (isLineBreak(text.charCodeAt(pos))) { @@ -2128,15 +2158,15 @@ var ts; continue; } else { - return token = 2 /* SingleLineCommentTrivia */; + return token = 2; } } - if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { + if (text.charCodeAt(pos + 1) === 42) { pos += 2; var commentClosed = false; while (pos < len) { var ch = text.charCodeAt(pos); - if (ch === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { + if (ch === 42 && text.charCodeAt(pos + 1) === 47) { pos += 2; commentClosed = true; break; @@ -2154,15 +2184,15 @@ var ts; } else { tokenIsUnterminated = !commentClosed; - return token = 3 /* MultiLineCommentTrivia */; + return token = 3; } } - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 56 /* SlashEqualsToken */; + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 56; } - return pos++, token = 36 /* SlashToken */; - case 48 /* _0 */: - if (pos + 2 < len && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) { + return pos++, token = 36; + case 48: + if (pos + 2 < len && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) { pos += 2; var value = scanHexDigits(1, false); if (value < 0) { @@ -2170,9 +2200,9 @@ var ts; value = 0; } tokenValue = "" + value; - return token = 7 /* NumericLiteral */; + return token = 7; } - else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 66 /* B */ || text.charCodeAt(pos + 1) === 98 /* b */)) { + else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) { pos += 2; var value = scanBinaryOrOctalDigits(2); if (value < 0) { @@ -2180,9 +2210,9 @@ var ts; value = 0; } tokenValue = "" + value; - return token = 7 /* NumericLiteral */; + return token = 7; } - else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 79 /* O */ || text.charCodeAt(pos + 1) === 111 /* o */)) { + else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) { pos += 2; var value = scanBinaryOrOctalDigits(8); if (value < 0) { @@ -2190,104 +2220,104 @@ var ts; value = 0; } tokenValue = "" + value; - return token = 7 /* NumericLiteral */; + return token = 7; } if (pos + 1 < len && isOctalDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanOctalDigits(); - return token = 7 /* NumericLiteral */; + return token = 7; } - case 49 /* _1 */: - case 50 /* _2 */: - case 51 /* _3 */: - case 52 /* _4 */: - case 53 /* _5 */: - case 54 /* _6 */: - case 55 /* _7 */: - case 56 /* _8 */: - case 57 /* _9 */: + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: tokenValue = "" + scanNumber(); - return token = 7 /* NumericLiteral */; - case 58 /* colon */: - return pos++, token = 51 /* ColonToken */; - case 59 /* semicolon */: - return pos++, token = 22 /* SemicolonToken */; - case 60 /* lessThan */: + return token = 7; + case 58: + return pos++, token = 51; + case 59: + return pos++, token = 22; + case 60: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); if (skipTrivia) { continue; } else { - return token = 6 /* ConflictMarkerTrivia */; + return token = 6; } } - if (text.charCodeAt(pos + 1) === 60 /* lessThan */) { - if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 58 /* LessThanLessThanEqualsToken */; + if (text.charCodeAt(pos + 1) === 60) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 58; } - return pos += 2, token = 40 /* LessThanLessThanToken */; + return pos += 2, token = 40; } - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 26 /* LessThanEqualsToken */; + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 26; } - return pos++, token = 24 /* LessThanToken */; - case 61 /* equals */: + return pos++, token = 24; + case 61: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); if (skipTrivia) { continue; } else { - return token = 6 /* ConflictMarkerTrivia */; + return token = 6; } } - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 30 /* EqualsEqualsEqualsToken */; + if (text.charCodeAt(pos + 1) === 61) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 30; } - return pos += 2, token = 28 /* EqualsEqualsToken */; + return pos += 2, token = 28; } - if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { - return pos += 2, token = 32 /* EqualsGreaterThanToken */; + if (text.charCodeAt(pos + 1) === 62) { + return pos += 2, token = 32; } - return pos++, token = 52 /* EqualsToken */; - case 62 /* greaterThan */: + return pos++, token = 52; + case 62: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); if (skipTrivia) { continue; } else { - return token = 6 /* ConflictMarkerTrivia */; + return token = 6; } } - return pos++, token = 25 /* GreaterThanToken */; - case 63 /* question */: - return pos++, token = 50 /* QuestionToken */; - case 91 /* openBracket */: - return pos++, token = 18 /* OpenBracketToken */; - case 93 /* closeBracket */: - return pos++, token = 19 /* CloseBracketToken */; - case 94 /* caret */: - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 63 /* CaretEqualsToken */; + return pos++, token = 25; + case 63: + return pos++, token = 50; + case 91: + return pos++, token = 18; + case 93: + return pos++, token = 19; + case 94: + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 63; } - return pos++, token = 45 /* CaretToken */; - case 123 /* openBrace */: - return pos++, token = 14 /* OpenBraceToken */; - case 124 /* bar */: - if (text.charCodeAt(pos + 1) === 124 /* bar */) { - return pos += 2, token = 49 /* BarBarToken */; + return pos++, token = 45; + case 123: + return pos++, token = 14; + case 124: + if (text.charCodeAt(pos + 1) === 124) { + return pos += 2, token = 49; } - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 62 /* BarEqualsToken */; + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 62; } - return pos++, token = 44 /* BarToken */; - case 125 /* closeBrace */: - return pos++, token = 15 /* CloseBraceToken */; - case 126 /* tilde */: - return pos++, token = 47 /* TildeToken */; - case 92 /* backslash */: + return pos++, token = 44; + case 125: + return pos++, token = 15; + case 126: + return pos++, token = 47; + case 92: var ch = peekUnicodeEscape(); if (ch >= 0 && isIdentifierStart(ch)) { pos += 6; @@ -2295,14 +2325,14 @@ var ts; return token = getIdentifierToken(); } error(ts.Diagnostics.Invalid_character); - return pos++, token = 0 /* Unknown */; + return pos++, token = 0; default: if (isIdentifierStart(ch)) { pos++; while (pos < len && isIdentifierPart(ch = text.charCodeAt(pos))) pos++; tokenValue = text.substring(tokenPos, pos); - if (ch === 92 /* backslash */) { + if (ch === 92) { tokenValue += scanIdentifierParts(); } return token = getIdentifierToken(); @@ -2317,32 +2347,32 @@ var ts; continue; } error(ts.Diagnostics.Invalid_character); - return pos++, token = 0 /* Unknown */; + return pos++, token = 0; } } } function reScanGreaterToken() { - if (token === 25 /* GreaterThanToken */) { - if (text.charCodeAt(pos) === 62 /* greaterThan */) { - if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { - if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 60 /* GreaterThanGreaterThanGreaterThanEqualsToken */; + if (token === 25) { + if (text.charCodeAt(pos) === 62) { + if (text.charCodeAt(pos + 1) === 62) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 60; } - return pos += 2, token = 42 /* GreaterThanGreaterThanGreaterThanToken */; + return pos += 2, token = 42; } - if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 59 /* GreaterThanGreaterThanEqualsToken */; + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 59; } - return pos++, token = 41 /* GreaterThanGreaterThanToken */; + return pos++, token = 41; } - if (text.charCodeAt(pos) === 61 /* equals */) { - return pos++, token = 27 /* GreaterThanEqualsToken */; + if (text.charCodeAt(pos) === 61) { + return pos++, token = 27; } } return token; } function reScanSlashToken() { - if (token === 36 /* SlashToken */ || token === 56 /* SlashEqualsToken */) { + if (token === 36 || token === 56) { var p = tokenPos + 1; var inEscape = false; var inCharacterClass = false; @@ -2361,17 +2391,17 @@ var ts; if (inEscape) { inEscape = false; } - else if (ch === 47 /* slash */ && !inCharacterClass) { + else if (ch === 47 && !inCharacterClass) { p++; break; } - else if (ch === 91 /* openBracket */) { + else if (ch === 91) { inCharacterClass = true; } - else if (ch === 92 /* backslash */) { + else if (ch === 92) { inEscape = true; } - else if (ch === 93 /* closeBracket */) { + else if (ch === 93) { inCharacterClass = false; } p++; @@ -2381,12 +2411,12 @@ var ts; } pos = p; tokenValue = text.substring(tokenPos, pos); - token = 9 /* RegularExpressionLiteral */; + token = 9; } return token; } function reScanTemplateToken() { - ts.Debug.assert(token === 15 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'"); + ts.Debug.assert(token === 15, "'reScanTemplateToken' should only be called on a '}'"); pos = tokenPos; return token = scanTemplateAndSetTokenValue(); } @@ -2423,7 +2453,7 @@ var ts; pos = textPos; startPos = textPos; tokenPos = textPos; - token = 0 /* Unknown */; + token = 0; precedingLineBreak = false; } setText(text); @@ -2435,8 +2465,8 @@ var ts; getTokenText: function () { return text.substring(tokenPos, pos); }, getTokenValue: function () { return tokenValue; }, hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 64 /* Identifier */ || token > 100 /* LastReservedWord */; }, - isReservedWord: function () { return token >= 65 /* FirstReservedWord */ && token <= 100 /* LastReservedWord */; }, + isIdentifier: function () { return token === 64 || token > 100; }, + isReservedWord: function () { return token >= 65 && token <= 100; }, isUnterminated: function () { return tokenIsUnterminated; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, @@ -2478,13 +2508,10 @@ var ts; writeParameter: writeText, writeSymbol: writeText, writeLine: function () { return str += " "; }, - increaseIndent: function () { - }, - decreaseIndent: function () { - }, + increaseIndent: function () { }, + decreaseIndent: function () { }, clear: function () { return str = ""; }, - trackSymbol: function () { - } + trackSymbol: function () { } }; } return stringWriters.pop(); @@ -2501,29 +2528,35 @@ var ts; ts.getFullWidth = getFullWidth; function containsParseError(node) { aggregateChildData(node); - return (node.parserContextFlags & 32 /* ThisNodeOrAnySubNodesHasError */) !== 0; + return (node.parserContextFlags & 32) !== 0; } ts.containsParseError = containsParseError; function aggregateChildData(node) { - if (!(node.parserContextFlags & 64 /* HasAggregatedChildData */)) { - var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16 /* ThisNodeHasError */) !== 0) || ts.forEachChild(node, containsParseError); + if (!(node.parserContextFlags & 64)) { + var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || + ts.forEachChild(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { - node.parserContextFlags |= 32 /* ThisNodeOrAnySubNodesHasError */; + node.parserContextFlags |= 32; } - node.parserContextFlags |= 64 /* HasAggregatedChildData */; + node.parserContextFlags |= 64; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 207 /* SourceFile */) { + while (node && node.kind !== 210) { node = node.parent; } return node; } ts.getSourceFileOfNode = getSourceFileOfNode; + function getStartPositionOfLine(line, sourceFile) { + ts.Debug.assert(line >= 0); + return ts.getLineStarts(sourceFile)[line]; + } + ts.getStartPositionOfLine = getStartPositionOfLine; function nodePosToString(node) { var file = getSourceFileOfNode(node); var loc = ts.getLineAndCharacterOfPosition(file, node.pos); - return file.fileName + "(" + loc.line + "," + loc.character + ")"; + return file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + ")"; } ts.nodePosToString = nodePosToString; function getStartPosOfNode(node) { @@ -2534,7 +2567,7 @@ var ts; if (!node) { return true; } - return node.pos === node.end && node.kind !== 1 /* EndOfFileToken */; + return node.pos === node.end && node.kind !== 1; } ts.nodeIsMissing = nodeIsMissing; function nodeIsPresent(node) { @@ -2568,11 +2601,11 @@ var ts; } ts.getTextOfNode = getTextOfNode; function escapeIdentifier(identifier) { - return identifier.length >= 2 && identifier.charCodeAt(0) === 95 /* _ */ && identifier.charCodeAt(1) === 95 /* _ */ ? "_" + identifier : identifier; + return identifier.length >= 2 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 ? "_" + identifier : identifier; } ts.escapeIdentifier = escapeIdentifier; function unescapeIdentifier(identifier) { - return identifier.length >= 3 && identifier.charCodeAt(0) === 95 /* _ */ && identifier.charCodeAt(1) === 95 /* _ */ && identifier.charCodeAt(2) === 95 /* _ */ ? identifier.substr(1) : identifier; + return identifier.length >= 3 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 && identifier.charCodeAt(2) === 95 ? identifier.substr(1) : identifier; } ts.unescapeIdentifier = unescapeIdentifier; function declarationNameToString(name) { @@ -2605,13 +2638,13 @@ var ts; function getErrorSpanForNode(node) { var errorSpan; switch (node.kind) { - case 188 /* VariableDeclaration */: - case 146 /* BindingElement */: - case 191 /* ClassDeclaration */: - case 192 /* InterfaceDeclaration */: - case 195 /* ModuleDeclaration */: - case 194 /* EnumDeclaration */: - case 206 /* EnumMember */: + case 191: + case 148: + case 194: + case 195: + case 198: + case 197: + case 209: errorSpan = node.name; break; } @@ -2623,15 +2656,15 @@ var ts; } ts.isExternalModule = isExternalModule; function isDeclarationFile(file) { - return (file.flags & 1024 /* DeclarationFile */) !== 0; + return (file.flags & 1024) !== 0; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 194 /* EnumDeclaration */ && isConst(node); + return node.kind === 197 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 146 /* BindingElement */ || isBindingPattern(node))) { + while (node && (node.kind === 148 || isBindingPattern(node))) { node = node.parent; } return node; @@ -2639,34 +2672,34 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 188 /* VariableDeclaration */) { + if (node.kind === 191) { node = node.parent; } - if (node && node.kind === 189 /* VariableDeclarationList */) { + if (node && node.kind === 192) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 171 /* VariableStatement */) { + if (node && node.kind === 173) { flags |= node.flags; } return flags; } ts.getCombinedNodeFlags = getCombinedNodeFlags; function isConst(node) { - return !!(getCombinedNodeFlags(node) & 4096 /* Const */); + return !!(getCombinedNodeFlags(node) & 4096); } ts.isConst = isConst; function isLet(node) { - return !!(getCombinedNodeFlags(node) & 2048 /* Let */); + return !!(getCombinedNodeFlags(node) & 2048); } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 173 /* ExpressionStatement */ && node.expression.kind === 8 /* StringLiteral */; + return node.kind === 175 && node.expression.kind === 8; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { sourceFileOfNode = sourceFileOfNode || getSourceFileOfNode(node); - if (node.kind === 124 /* Parameter */ || node.kind === 123 /* TypeParameter */) { + if (node.kind === 126 || node.kind === 125) { return ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)); } else { @@ -2677,7 +2710,9 @@ var ts; function getJsDocComments(node, sourceFileOfNode) { return ts.filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment); function isJsDocComment(comment) { - 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 sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && + sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && + sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; } } ts.getJsDocComments = getJsDocComments; @@ -2686,21 +2721,22 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 181 /* ReturnStatement */: + case 184: return visitor(node); - case 170 /* Block */: - case 174 /* IfStatement */: - case 175 /* DoStatement */: - case 176 /* WhileStatement */: - case 177 /* ForStatement */: - case 178 /* ForInStatement */: - case 182 /* WithStatement */: - case 183 /* SwitchStatement */: - case 200 /* CaseClause */: - case 201 /* DefaultClause */: - case 184 /* LabeledStatement */: - case 186 /* TryStatement */: - case 203 /* CatchClause */: + case 172: + case 176: + case 177: + case 178: + case 179: + case 180: + case 181: + case 185: + case 186: + case 203: + case 204: + case 187: + case 189: + case 206: return ts.forEachChild(node, traverse); } } @@ -2709,22 +2745,22 @@ var ts; function isAnyFunction(node) { if (node) { switch (node.kind) { - case 129 /* Constructor */: - case 156 /* FunctionExpression */: - case 190 /* FunctionDeclaration */: - case 157 /* ArrowFunction */: - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: - case 130 /* GetAccessor */: - case 131 /* SetAccessor */: - case 132 /* CallSignature */: - case 133 /* ConstructSignature */: - case 134 /* IndexSignature */: - case 136 /* FunctionType */: - case 137 /* ConstructorType */: - case 156 /* FunctionExpression */: - case 157 /* ArrowFunction */: - case 190 /* FunctionDeclaration */: + case 131: + case 158: + case 193: + case 159: + case 130: + case 129: + case 132: + case 133: + case 134: + case 135: + case 136: + case 138: + case 139: + case 158: + case 159: + case 193: return true; } } @@ -2732,11 +2768,11 @@ var ts; } ts.isAnyFunction = isAnyFunction; function isFunctionBlock(node) { - return node && node.kind === 170 /* Block */ && isAnyFunction(node.parent); + return node && node.kind === 172 && isAnyFunction(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 128 /* MethodDeclaration */ && node.parent.kind === 148 /* ObjectLiteralExpression */; + return node && node.kind === 130 && node.parent.kind === 150; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function getContainingFunction(node) { @@ -2755,28 +2791,28 @@ var ts; return undefined; } switch (node.kind) { - case 122 /* ComputedPropertyName */: - if (node.parent.parent.kind === 191 /* ClassDeclaration */) { + case 124: + if (node.parent.parent.kind === 194) { return node; } node = node.parent; break; - case 157 /* ArrowFunction */: + case 159: if (!includeArrowFunctions) { continue; } - case 190 /* FunctionDeclaration */: - case 156 /* FunctionExpression */: - case 195 /* ModuleDeclaration */: - case 126 /* PropertyDeclaration */: - case 125 /* PropertySignature */: - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: - case 129 /* Constructor */: - case 130 /* GetAccessor */: - case 131 /* SetAccessor */: - case 194 /* EnumDeclaration */: - case 207 /* SourceFile */: + case 193: + case 158: + case 198: + case 128: + case 127: + case 130: + case 129: + case 131: + case 132: + case 133: + case 197: + case 210: return node; } } @@ -2788,32 +2824,32 @@ var ts; if (!node) return node; switch (node.kind) { - case 122 /* ComputedPropertyName */: - if (node.parent.parent.kind === 191 /* ClassDeclaration */) { + case 124: + if (node.parent.parent.kind === 194) { return node; } node = node.parent; break; - case 190 /* FunctionDeclaration */: - case 156 /* FunctionExpression */: - case 157 /* ArrowFunction */: + case 193: + case 158: + case 159: if (!includeFunctions) { continue; } - case 126 /* PropertyDeclaration */: - case 125 /* PropertySignature */: - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: - case 129 /* Constructor */: - case 130 /* GetAccessor */: - case 131 /* SetAccessor */: + case 128: + case 127: + case 130: + case 129: + case 131: + case 132: + case 133: return node; } } } ts.getSuperContainer = getSuperContainer; function getInvokedExpression(node) { - if (node.kind === 153 /* TaggedTemplateExpression */) { + if (node.kind === 155) { return node.tag; } return node.expression; @@ -2821,78 +2857,82 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function isExpression(node) { switch (node.kind) { - case 92 /* ThisKeyword */: - case 90 /* SuperKeyword */: - case 88 /* NullKeyword */: - case 94 /* TrueKeyword */: - case 79 /* FalseKeyword */: - case 9 /* RegularExpressionLiteral */: - case 147 /* ArrayLiteralExpression */: - case 148 /* ObjectLiteralExpression */: - case 149 /* PropertyAccessExpression */: - case 150 /* ElementAccessExpression */: - case 151 /* CallExpression */: - case 152 /* NewExpression */: - case 153 /* TaggedTemplateExpression */: - case 154 /* TypeAssertionExpression */: - case 155 /* ParenthesizedExpression */: - case 156 /* FunctionExpression */: - case 157 /* ArrowFunction */: - case 160 /* VoidExpression */: - case 158 /* DeleteExpression */: - case 159 /* TypeOfExpression */: - case 161 /* PrefixUnaryExpression */: - case 162 /* PostfixUnaryExpression */: - case 163 /* BinaryExpression */: - case 164 /* ConditionalExpression */: - case 167 /* SpreadElementExpression */: - case 165 /* TemplateExpression */: - case 10 /* NoSubstitutionTemplateLiteral */: - case 168 /* OmittedExpression */: + case 92: + case 90: + case 88: + case 94: + case 79: + case 9: + case 149: + case 150: + case 151: + case 152: + case 153: + case 154: + case 155: + case 156: + case 157: + case 158: + case 159: + case 162: + case 160: + case 161: + case 163: + case 164: + case 165: + case 166: + case 169: + case 167: + case 10: + case 170: return true; - case 121 /* QualifiedName */: - while (node.parent.kind === 121 /* QualifiedName */) { + case 123: + while (node.parent.kind === 123) { node = node.parent; } - return node.parent.kind === 138 /* TypeQuery */; - case 64 /* Identifier */: - if (node.parent.kind === 138 /* TypeQuery */) { + return node.parent.kind === 140; + case 64: + if (node.parent.kind === 140) { return true; } - case 7 /* NumericLiteral */: - case 8 /* StringLiteral */: + case 7: + case 8: var parent = node.parent; switch (parent.kind) { - case 188 /* VariableDeclaration */: - case 124 /* Parameter */: - case 126 /* PropertyDeclaration */: - case 125 /* PropertySignature */: - case 206 /* EnumMember */: - case 204 /* PropertyAssignment */: - case 146 /* BindingElement */: + case 191: + case 126: + case 128: + case 127: + case 209: + case 207: + case 148: return parent.initializer === node; - case 173 /* ExpressionStatement */: - case 174 /* IfStatement */: - case 175 /* DoStatement */: - case 176 /* WhileStatement */: - case 181 /* ReturnStatement */: - case 182 /* WithStatement */: - case 183 /* SwitchStatement */: - case 200 /* CaseClause */: - case 185 /* ThrowStatement */: - case 183 /* SwitchStatement */: + case 175: + case 176: + case 177: + case 178: + case 184: + case 185: + case 186: + case 203: + case 188: + case 186: return parent.expression === node; - case 177 /* ForStatement */: + case 179: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 189 /* VariableDeclarationList */) || forStatement.condition === node || forStatement.iterator === node; - case 178 /* ForInStatement */: + return (forStatement.initializer === node && forStatement.initializer.kind !== 192) || + forStatement.condition === node || + forStatement.iterator === node; + case 180: + case 181: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 189 /* VariableDeclarationList */) || forInStatement.expression === node; - case 154 /* TypeAssertionExpression */: + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 192) || + forInStatement.expression === node; + case 156: return node === parent.expression; - case 169 /* TemplateSpan */: + case 171: return node === parent.expression; - case 122 /* ComputedPropertyName */: + case 124: return node === parent.expression; default: if (isExpression(parent)) { @@ -2905,11 +2945,12 @@ var ts; ts.isExpression = isExpression; function isInstantiatedModule(node, preserveConstEnums) { var moduleState = ts.getModuleInstanceState(node); - return moduleState === 1 /* Instantiated */ || (preserveConstEnums && moduleState === 2 /* ConstEnumOnly */); + return moduleState === 1 || + (preserveConstEnums && moduleState === 2); } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportDeclaration(node) { - return node.kind === 197 /* ImportDeclaration */ && node.moduleReference.kind === 199 /* ExternalModuleReference */; + return node.kind === 200 && node.moduleReference.kind === 202; } ts.isExternalModuleImportDeclaration = isExternalModuleImportDeclaration; function getExternalModuleImportDeclarationExpression(node) { @@ -2918,25 +2959,25 @@ var ts; } ts.getExternalModuleImportDeclarationExpression = getExternalModuleImportDeclarationExpression; function isInternalModuleImportDeclaration(node) { - return node.kind === 197 /* ImportDeclaration */ && node.moduleReference.kind !== 199 /* ExternalModuleReference */; + return node.kind === 200 && node.moduleReference.kind !== 202; } ts.isInternalModuleImportDeclaration = isInternalModuleImportDeclaration; function hasDotDotDotToken(node) { - return node && node.kind === 124 /* Parameter */ && node.dotDotDotToken !== undefined; + return node && node.kind === 126 && node.dotDotDotToken !== undefined; } ts.hasDotDotDotToken = hasDotDotDotToken; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 124 /* Parameter */: + case 126: return node.questionToken !== undefined; - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: + case 130: + case 129: return node.questionToken !== undefined; - case 205 /* ShorthandPropertyAssignment */: - case 204 /* PropertyAssignment */: - case 126 /* PropertyDeclaration */: - case 125 /* PropertySignature */: + case 208: + case 207: + case 128: + case 127: return node.questionToken !== undefined; } } @@ -2948,24 +2989,24 @@ var ts; } ts.hasRestParameters = hasRestParameters; function isLiteralKind(kind) { - return 7 /* FirstLiteralToken */ <= kind && kind <= 10 /* LastLiteralToken */; + return 7 <= kind && kind <= 10; } ts.isLiteralKind = isLiteralKind; function isTextualLiteralKind(kind) { - return kind === 8 /* StringLiteral */ || kind === 10 /* NoSubstitutionTemplateLiteral */; + return kind === 8 || kind === 10; } ts.isTextualLiteralKind = isTextualLiteralKind; function isTemplateLiteralKind(kind) { - return 10 /* FirstTemplateToken */ <= kind && kind <= 13 /* LastTemplateToken */; + return 10 <= kind && kind <= 13; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return node.kind === 145 /* ArrayBindingPattern */ || node.kind === 144 /* ObjectBindingPattern */; + return node.kind === 147 || node.kind === 146; } ts.isBindingPattern = isBindingPattern; function isInAmbientContext(node) { while (node) { - if (node.flags & (2 /* Ambient */ | 1024 /* DeclarationFile */)) { + if (node.flags & (2 | 1024)) { return true; } node = node.parent; @@ -2975,27 +3016,27 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 123 /* TypeParameter */: - case 124 /* Parameter */: - case 188 /* VariableDeclaration */: - case 146 /* BindingElement */: - case 126 /* PropertyDeclaration */: - case 125 /* PropertySignature */: - case 204 /* PropertyAssignment */: - case 205 /* ShorthandPropertyAssignment */: - case 206 /* EnumMember */: - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: - case 190 /* FunctionDeclaration */: - case 130 /* GetAccessor */: - case 131 /* SetAccessor */: - case 129 /* Constructor */: - case 191 /* ClassDeclaration */: - case 192 /* InterfaceDeclaration */: - case 193 /* TypeAliasDeclaration */: - case 194 /* EnumDeclaration */: - case 195 /* ModuleDeclaration */: - case 197 /* ImportDeclaration */: + case 125: + case 126: + case 191: + case 148: + case 128: + case 127: + case 207: + case 208: + case 209: + case 130: + case 129: + case 193: + case 132: + case 133: + case 131: + case 194: + case 195: + case 196: + case 197: + case 198: + case 200: return true; } return false; @@ -3003,24 +3044,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 180 /* BreakStatement */: - case 179 /* ContinueStatement */: - case 187 /* DebuggerStatement */: - case 175 /* DoStatement */: - case 173 /* ExpressionStatement */: - case 172 /* EmptyStatement */: - case 178 /* ForInStatement */: - case 177 /* ForStatement */: - case 174 /* IfStatement */: - case 184 /* LabeledStatement */: - case 181 /* ReturnStatement */: - case 183 /* SwitchStatement */: - case 93 /* ThrowKeyword */: - case 186 /* TryStatement */: - case 171 /* VariableStatement */: - case 176 /* WhileStatement */: - case 182 /* WithStatement */: - case 198 /* ExportAssignment */: + case 183: + case 182: + case 190: + case 177: + case 175: + case 174: + case 180: + case 181: + case 179: + case 176: + case 187: + case 184: + case 186: + case 93: + case 189: + case 173: + case 178: + case 185: + case 201: return true; default: return false; @@ -3028,31 +3070,31 @@ var ts; } ts.isStatement = isStatement; function isDeclarationOrFunctionExpressionOrCatchVariableName(name) { - if (name.kind !== 64 /* Identifier */ && name.kind !== 8 /* StringLiteral */ && name.kind !== 7 /* NumericLiteral */) { + if (name.kind !== 64 && name.kind !== 8 && name.kind !== 7) { return false; } var parent = name.parent; - if (isDeclaration(parent) || parent.kind === 156 /* FunctionExpression */) { + if (isDeclaration(parent) || parent.kind === 158) { return parent.name === name; } - if (parent.kind === 203 /* CatchClause */) { + if (parent.kind === 206) { return parent.name === name; } return false; } ts.isDeclarationOrFunctionExpressionOrCatchVariableName = isDeclarationOrFunctionExpressionOrCatchVariableName; function getClassBaseTypeNode(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 78 /* ExtendsKeyword */); + var heritageClause = getHeritageClause(node.heritageClauses, 78); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } ts.getClassBaseTypeNode = getClassBaseTypeNode; function getClassImplementedTypeNodes(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 101 /* ImplementsKeyword */); + var heritageClause = getHeritageClause(node.heritageClauses, 101); return heritageClause ? heritageClause.types : undefined; } ts.getClassImplementedTypeNodes = getClassImplementedTypeNodes; function getInterfaceBaseTypeNodes(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 78 /* ExtendsKeyword */); + var heritageClause = getHeritageClause(node.heritageClauses, 78); return heritageClause ? heritageClause.types : undefined; } ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; @@ -3077,16 +3119,16 @@ var ts; ts.tryResolveScriptReference = tryResolveScriptReference; function getAncestor(node, kind) { switch (kind) { - case 191 /* ClassDeclaration */: + case 194: while (node) { switch (node.kind) { - case 191 /* ClassDeclaration */: + case 194: return node; - case 194 /* EnumDeclaration */: - case 192 /* InterfaceDeclaration */: - case 193 /* TypeAliasDeclaration */: - case 195 /* ModuleDeclaration */: - case 197 /* ImportDeclaration */: + case 197: + case 195: + case 196: + case 198: + case 200: return undefined; default: node = node.parent; @@ -3141,22 +3183,54 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 65 /* FirstKeyword */ <= token && token <= 120 /* LastKeyword */; + return 65 <= token && token <= 122; } ts.isKeyword = isKeyword; function isTrivia(token) { - return 2 /* FirstTriviaToken */ <= token && token <= 6 /* LastTriviaToken */; + return 2 <= token && token <= 6; } ts.isTrivia = isTrivia; + function hasDynamicName(declaration) { + return declaration.name && + declaration.name.kind === 124 && + !isWellKnownSymbolSyntactically(declaration.name.expression); + } + ts.hasDynamicName = hasDynamicName; + function isWellKnownSymbolSyntactically(node) { + return node.kind === 151 && isESSymbolIdentifier(node.expression); + } + ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; + function getPropertyNameForPropertyNameNode(name) { + if (name.kind === 64 || name.kind === 8 || name.kind === 7) { + return name.text; + } + if (name.kind === 124) { + var nameExpression = name.expression; + if (isWellKnownSymbolSyntactically(nameExpression)) { + var rightHandSideName = nameExpression.name.text; + return getPropertyNameForKnownSymbolName(rightHandSideName); + } + } + return undefined; + } + ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode; + function getPropertyNameForKnownSymbolName(symbolName) { + return "__@" + symbolName; + } + ts.getPropertyNameForKnownSymbolName = getPropertyNameForKnownSymbolName; + function isESSymbolIdentifier(node) { + return node.kind === 64 && node.text === "Symbol"; + } + ts.isESSymbolIdentifier = isESSymbolIdentifier; function isModifier(token) { switch (token) { - case 107 /* PublicKeyword */: - case 105 /* PrivateKeyword */: - case 106 /* ProtectedKeyword */: - case 108 /* StaticKeyword */: - case 77 /* ExportKeyword */: - case 113 /* DeclareKeyword */: - case 69 /* ConstKeyword */: + case 107: + case 105: + case 106: + case 108: + case 77: + case 113: + case 69: return true; } return false; @@ -3339,7 +3413,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var nodeConstructors = new Array(209 /* Count */); + var nodeConstructors = new Array(212); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -3376,221 +3450,312 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 121 /* QualifiedName */: - return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 123 /* TypeParameter */: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 124 /* Parameter */: - case 126 /* PropertyDeclaration */: - case 125 /* PropertySignature */: - case 204 /* PropertyAssignment */: - case 205 /* ShorthandPropertyAssignment */: - case 188 /* VariableDeclaration */: - case 146 /* BindingElement */: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 136 /* FunctionType */: - case 137 /* ConstructorType */: - case 132 /* CallSignature */: - case 133 /* ConstructSignature */: - case 134 /* IndexSignature */: - return visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: - case 129 /* Constructor */: - case 130 /* GetAccessor */: - case 131 /* SetAccessor */: - case 156 /* FunctionExpression */: - case 190 /* FunctionDeclaration */: - case 157 /* ArrowFunction */: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.body); - case 135 /* TypeReference */: - return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 138 /* TypeQuery */: + case 123: + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + case 125: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.expression); + case 126: + case 128: + case 127: + case 207: + case 208: + case 191: + case 148: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + case 138: + case 139: + case 134: + case 135: + case 136: + return visitNodes(cbNodes, node.modifiers) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type); + case 130: + case 129: + case 131: + case 132: + case 133: + case 158: + case 193: + case 159: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + case 137: + return visitNode(cbNode, node.typeName) || + visitNodes(cbNodes, node.typeArguments); + case 140: return visitNode(cbNode, node.exprName); - case 139 /* TypeLiteral */: + case 141: return visitNodes(cbNodes, node.members); - case 140 /* ArrayType */: + case 142: return visitNode(cbNode, node.elementType); - case 141 /* TupleType */: + case 143: return visitNodes(cbNodes, node.elementTypes); - case 142 /* UnionType */: + case 144: return visitNodes(cbNodes, node.types); - case 143 /* ParenthesizedType */: + case 145: return visitNode(cbNode, node.type); - case 144 /* ObjectBindingPattern */: - case 145 /* ArrayBindingPattern */: + case 146: + case 147: return visitNodes(cbNodes, node.elements); - case 147 /* ArrayLiteralExpression */: + case 149: return visitNodes(cbNodes, node.elements); - case 148 /* ObjectLiteralExpression */: + case 150: return visitNodes(cbNodes, node.properties); - case 149 /* PropertyAccessExpression */: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.name); - case 150 /* ElementAccessExpression */: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 151 /* CallExpression */: - case 152 /* NewExpression */: - return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 153 /* TaggedTemplateExpression */: - return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 154 /* TypeAssertionExpression */: - return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 155 /* ParenthesizedExpression */: + case 151: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.name); + case 152: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.argumentExpression); + case 153: + case 154: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.typeArguments) || + visitNodes(cbNodes, node.arguments); + case 155: + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.template); + case 156: + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); + case 157: return visitNode(cbNode, node.expression); - case 158 /* DeleteExpression */: + case 160: return visitNode(cbNode, node.expression); - case 159 /* TypeOfExpression */: + case 161: return visitNode(cbNode, node.expression); - case 160 /* VoidExpression */: + case 162: return visitNode(cbNode, node.expression); - case 161 /* PrefixUnaryExpression */: + case 163: return visitNode(cbNode, node.operand); - case 166 /* YieldExpression */: - return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); - case 162 /* PostfixUnaryExpression */: + case 168: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + case 164: return visitNode(cbNode, node.operand); - case 163 /* BinaryExpression */: - return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 164 /* ConditionalExpression */: - return visitNode(cbNode, node.condition) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.whenFalse); - case 167 /* SpreadElementExpression */: + case 165: + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); + case 166: + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.whenFalse); + case 169: return visitNode(cbNode, node.expression); - case 170 /* Block */: - case 196 /* ModuleBlock */: + case 172: + case 199: return visitNodes(cbNodes, node.statements); - case 207 /* SourceFile */: - return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 171 /* VariableStatement */: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 189 /* VariableDeclarationList */: + case 210: + return visitNodes(cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); + case 173: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); + case 192: return visitNodes(cbNodes, node.declarations); - case 173 /* ExpressionStatement */: + case 175: return visitNode(cbNode, node.expression); - case 174 /* IfStatement */: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 175 /* DoStatement */: - return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 176 /* WhileStatement */: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 177 /* ForStatement */: - return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.iterator) || visitNode(cbNode, node.statement); - case 178 /* ForInStatement */: - return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 179 /* ContinueStatement */: - case 180 /* BreakStatement */: + case 176: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); + case 177: + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); + case 178: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 179: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.iterator) || + visitNode(cbNode, node.statement); + case 180: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 181: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 182: + case 183: return visitNode(cbNode, node.label); - case 181 /* ReturnStatement */: + case 184: return visitNode(cbNode, node.expression); - case 182 /* WithStatement */: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 183 /* SwitchStatement */: - return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.clauses); - case 200 /* CaseClause */: - return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 201 /* DefaultClause */: + case 185: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 186: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.clauses); + case 203: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.statements); + case 204: return visitNodes(cbNodes, node.statements); - case 184 /* LabeledStatement */: - return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 185 /* ThrowStatement */: + case 187: + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + case 188: return visitNode(cbNode, node.expression); - case 186 /* TryStatement */: - return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 203 /* CatchClause */: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.type) || visitNode(cbNode, node.block); - case 191 /* ClassDeclaration */: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 192 /* InterfaceDeclaration */: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 193 /* TypeAliasDeclaration */: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 194 /* EnumDeclaration */: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 206 /* EnumMember */: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 195 /* ModuleDeclaration */: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 197 /* ImportDeclaration */: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 198 /* ExportAssignment */: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportName); - case 165 /* TemplateExpression */: + case 189: + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); + case 206: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.block); + case 194: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); + case 195: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); + case 196: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.type); + case 197: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 209: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + case 198: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + case 200: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); + case 201: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.exportName); + case 167: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 169 /* TemplateSpan */: + case 171: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 122 /* ComputedPropertyName */: + case 124: return visitNode(cbNode, node.expression); - case 202 /* HeritageClause */: + case 205: return visitNodes(cbNodes, node.types); - case 199 /* ExternalModuleReference */: + case 202: return visitNode(cbNode, node.expression); } } ts.forEachChild = forEachChild; function parsingContextErrors(context) { switch (context) { - case 0 /* SourceElements */: return ts.Diagnostics.Declaration_or_statement_expected; - case 1 /* ModuleElements */: return ts.Diagnostics.Declaration_or_statement_expected; - case 2 /* BlockStatements */: return ts.Diagnostics.Statement_expected; - case 3 /* SwitchClauses */: return ts.Diagnostics.case_or_default_expected; - case 4 /* SwitchClauseStatements */: return ts.Diagnostics.Statement_expected; - case 5 /* TypeMembers */: return ts.Diagnostics.Property_or_signature_expected; - case 6 /* ClassMembers */: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; - case 7 /* EnumMembers */: return ts.Diagnostics.Enum_member_expected; - case 8 /* TypeReferences */: return ts.Diagnostics.Type_reference_expected; - case 9 /* VariableDeclarations */: return ts.Diagnostics.Variable_declaration_expected; - case 10 /* ObjectBindingElements */: return ts.Diagnostics.Property_destructuring_pattern_expected; - case 11 /* ArrayBindingElements */: return ts.Diagnostics.Array_element_destructuring_pattern_expected; - case 12 /* ArgumentExpressions */: return ts.Diagnostics.Argument_expression_expected; - case 13 /* ObjectLiteralMembers */: return ts.Diagnostics.Property_assignment_expected; - case 14 /* ArrayLiteralMembers */: return ts.Diagnostics.Expression_or_comma_expected; - case 15 /* Parameters */: return ts.Diagnostics.Parameter_declaration_expected; - case 16 /* TypeParameters */: return ts.Diagnostics.Type_parameter_declaration_expected; - case 17 /* TypeArguments */: return ts.Diagnostics.Type_argument_expected; - case 18 /* TupleElementTypes */: return ts.Diagnostics.Type_expected; - case 19 /* HeritageClauses */: return ts.Diagnostics.Unexpected_token_expected; + case 0: return ts.Diagnostics.Declaration_or_statement_expected; + case 1: return ts.Diagnostics.Declaration_or_statement_expected; + case 2: return ts.Diagnostics.Statement_expected; + case 3: return ts.Diagnostics.case_or_default_expected; + case 4: return ts.Diagnostics.Statement_expected; + case 5: return ts.Diagnostics.Property_or_signature_expected; + case 6: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; + case 7: return ts.Diagnostics.Enum_member_expected; + case 8: return ts.Diagnostics.Type_reference_expected; + case 9: return ts.Diagnostics.Variable_declaration_expected; + case 10: return ts.Diagnostics.Property_destructuring_pattern_expected; + case 11: return ts.Diagnostics.Array_element_destructuring_pattern_expected; + case 12: return ts.Diagnostics.Argument_expression_expected; + case 13: return ts.Diagnostics.Property_assignment_expected; + case 14: return ts.Diagnostics.Expression_or_comma_expected; + case 15: return ts.Diagnostics.Parameter_declaration_expected; + case 16: return ts.Diagnostics.Type_parameter_declaration_expected; + case 17: return ts.Diagnostics.Type_argument_expected; + case 18: return ts.Diagnostics.Type_expected; + case 19: return ts.Diagnostics.Unexpected_token_expected; } } ; function modifierToFlag(token) { switch (token) { - case 108 /* StaticKeyword */: return 128 /* Static */; - case 107 /* PublicKeyword */: return 16 /* Public */; - case 106 /* ProtectedKeyword */: return 64 /* Protected */; - case 105 /* PrivateKeyword */: return 32 /* Private */; - case 77 /* ExportKeyword */: return 1 /* Export */; - case 113 /* DeclareKeyword */: return 2 /* Ambient */; - case 69 /* ConstKeyword */: return 4096 /* Const */; + case 108: return 128; + case 107: return 16; + case 106: return 64; + case 105: return 32; + case 77: return 1; + case 113: return 2; + case 69: return 4096; } return 0; } ts.modifierToFlag = modifierToFlag; function fixupParentReferences(sourceFile) { var parent = sourceFile; - function walk(n) { + forEachChild(sourceFile, visitNode); + return; + function visitNode(n) { if (n.parent !== parent) { n.parent = parent; var saveParent = parent; parent = n; - forEachChild(n, walk); + forEachChild(n, visitNode); parent = saveParent; } } - forEachChild(sourceFile, walk); } - function moveElementEntirelyPastChangeRange(element, delta) { - if (element.length) { + function shouldCheckNode(node) { + switch (node.kind) { + case 8: + case 7: + case 64: + return true; + } + return false; + } + function moveElementEntirelyPastChangeRange(element, isArray, delta, oldText, newText, aggressiveChecks) { + if (isArray) { visitArray(element); } else { visitNode(element); } + return; function visitNode(node) { + if (aggressiveChecks && shouldCheckNode(node)) { + var text = oldText.substring(node.pos, node.end); + } node._children = undefined; node.pos += delta; node.end += delta; + if (aggressiveChecks && shouldCheckNode(node)) { + ts.Debug.assert(text === newText.substring(node.pos, node.end)); + } forEachChild(node, visitNode, visitArray); + checkNodePositions(node, aggressiveChecks); } function visitArray(array) { + array._children = undefined; array.pos += delta; array.end += delta; for (var i = 0, n = array.length; i < n; i++) { @@ -3601,6 +3766,7 @@ var ts; function adjustIntersectingElement(element, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta) { ts.Debug.assert(element.end >= changeStart, "Adjusting an element that was entirely before the change range"); ts.Debug.assert(element.pos <= changeRangeOldEnd, "Adjusting an element that was entirely after the change range"); + ts.Debug.assert(element.pos <= element.end); element.pos = Math.min(element.pos, changeRangeNewEnd); if (element.end >= changeRangeOldEnd) { element.end += delta; @@ -3614,35 +3780,53 @@ var ts; ts.Debug.assert(element.end <= element.parent.end); } } - function updateTokenPositionsAndMarkElements(node, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta) { - visitNode(node); + function checkNodePositions(node, aggressiveChecks) { + if (aggressiveChecks) { + var pos = node.pos; + forEachChild(node, function (child) { + ts.Debug.assert(child.pos >= pos); + pos = child.end; + }); + ts.Debug.assert(pos <= node.end); + } + } + function updateTokenPositionsAndMarkElements(sourceFile, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta, oldText, newText, aggressiveChecks) { + visitNode(sourceFile); + return; function visitNode(child) { + ts.Debug.assert(child.pos <= child.end); if (child.pos > changeRangeOldEnd) { - moveElementEntirelyPastChangeRange(child, delta); + moveElementEntirelyPastChangeRange(child, false, delta, oldText, newText, aggressiveChecks); return; } var fullEnd = child.end; if (fullEnd >= changeStart) { child.intersectsChange = true; + child._children = undefined; adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); forEachChild(child, visitNode, visitArray); + checkNodePositions(child, aggressiveChecks); return; } + ts.Debug.assert(fullEnd < changeStart); } function visitArray(array) { + ts.Debug.assert(array.pos <= array.end); if (array.pos > changeRangeOldEnd) { - moveElementEntirelyPastChangeRange(array, delta); + moveElementEntirelyPastChangeRange(array, true, delta, oldText, newText, aggressiveChecks); + return; } - else { - var fullEnd = array.end; - if (fullEnd >= changeStart) { - array.intersectsChange = true; - adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var i = 0, n = array.length; i < n; i++) { - visitNode(array[i]); - } + var fullEnd = array.end; + if (fullEnd >= changeStart) { + array.intersectsChange = true; + array._children = undefined; + adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); + for (var i = 0, n = array.length; i < n; i++) { + visitNode(array[i]); } + return; } + ts.Debug.assert(fullEnd < changeStart); } } function extendToAffectedRange(sourceFile, changeRange) { @@ -3650,6 +3834,7 @@ var ts; var start = changeRange.span.start; for (var i = 0; start > 0 && i <= maxLookahead; i++) { var nearestNode = findNearestNodeStartingBeforeOrAtPosition(sourceFile, start); + ts.Debug.assert(nearestNode.pos <= start); var position = nearestNode.pos; start = Math.max(0, position - 1); } @@ -3711,23 +3896,48 @@ var ts; } } } - function updateSourceFile(sourceFile, newText, textChangeRange) { + function checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks) { + var oldText = sourceFile.text; + if (textChangeRange) { + ts.Debug.assert((oldText.length - textChangeRange.span.length + textChangeRange.newLength) === newText.length); + if (aggressiveChecks || ts.Debug.shouldAssert(3)) { + var oldTextPrefix = oldText.substr(0, textChangeRange.span.start); + var newTextPrefix = newText.substr(0, textChangeRange.span.start); + ts.Debug.assert(oldTextPrefix === newTextPrefix); + var oldTextSuffix = oldText.substring(ts.textSpanEnd(textChangeRange.span), oldText.length); + var newTextSuffix = newText.substring(ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange)), newText.length); + ts.Debug.assert(oldTextSuffix === newTextSuffix); + } + } + } + function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) { + aggressiveChecks = aggressiveChecks || ts.Debug.shouldAssert(2); + checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks); if (ts.textChangeRangeIsUnchanged(textChangeRange)) { return sourceFile; } if (sourceFile.statements.length === 0) { return parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, undefined, true); } + var incrementalSourceFile = sourceFile; + ts.Debug.assert(!incrementalSourceFile.hasBeenIncrementallyParsed); + incrementalSourceFile.hasBeenIncrementallyParsed = true; + var oldText = sourceFile.text; var syntaxCursor = createSyntaxCursor(sourceFile); var changeRange = extendToAffectedRange(sourceFile, textChangeRange); + checkChangeRange(sourceFile, newText, changeRange, aggressiveChecks); + ts.Debug.assert(changeRange.span.start <= textChangeRange.span.start); + ts.Debug.assert(ts.textSpanEnd(changeRange.span) === ts.textSpanEnd(textChangeRange.span)); + ts.Debug.assert(ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)) === ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange))); var delta = ts.textChangeRangeNewSpan(changeRange).length - changeRange.span.length; - updateTokenPositionsAndMarkElements(sourceFile, changeRange.span.start, ts.textSpanEnd(changeRange.span), ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)), delta); + updateTokenPositionsAndMarkElements(incrementalSourceFile, changeRange.span.start, ts.textSpanEnd(changeRange.span), ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks); var result = parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, true); return result; } ts.updateSourceFile = updateSourceFile; function isEvalOrArgumentsIdentifier(node) { - return node.kind === 64 /* Identifier */ && (node.text === "eval" || node.text === "arguments"); + return node.kind === 64 && + (node.text === "eval" || node.text === "arguments"); } ts.isEvalOrArgumentsIdentifier = isEvalOrArgumentsIdentifier; function isUseStrictPrologueDirective(sourceFile, node) { @@ -3740,11 +3950,11 @@ var ts; var currentArrayIndex = 0; ts.Debug.assert(currentArrayIndex < currentArray.length); var current = currentArray[currentArrayIndex]; - var lastQueriedPosition = -1 /* Value */; + var lastQueriedPosition = -1; return { currentNode: function (position) { if (position !== lastQueriedPosition) { - if (current && current.end === position && currentArrayIndex < currentArray.length) { + if (current && current.end === position && currentArrayIndex < (currentArray.length - 1)) { currentArrayIndex++; current = currentArray[currentArrayIndex]; } @@ -3759,9 +3969,10 @@ var ts; }; function findHighestListElementThatStartsAtPosition(position) { currentArray = undefined; - currentArrayIndex = -1 /* Value */; + currentArrayIndex = -1; current = undefined; forEachChild(sourceFile, visitNode, visitArray); + return; function visitNode(node) { if (position >= node.pos && position < node.end) { forEachChild(node, visitNode, visitArray); @@ -3807,9 +4018,8 @@ var ts; var identifiers = {}; var identifierCount = 0; var nodeCount = 0; - var scanner; var token; - var sourceFile = createNode(207 /* SourceFile */, 0); + var sourceFile = createNode(210, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -3817,14 +4027,14 @@ var ts; sourceFile.bindDiagnostics = []; sourceFile.languageVersion = languageVersion; sourceFile.fileName = ts.normalizePath(fileName); - sourceFile.flags = ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? 1024 /* DeclarationFile */ : 0; + sourceFile.flags = ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? 1024 : 0; var contextFlags = 0; var parseErrorBeforeNextFinishedNode = false; - scanner = ts.createScanner(languageVersion, true, sourceText, scanError); + var scanner = ts.createScanner(languageVersion, true, sourceText, scanError); token = nextToken(); processReferenceComments(sourceFile); - sourceFile.statements = parseList(0 /* SourceElements */, true, parseSourceElement); - ts.Debug.assert(token === 1 /* EndOfFileToken */); + sourceFile.statements = parseList(0, true, parseSourceElement); + ts.Debug.assert(token === 1); sourceFile.endOfFileToken = parseTokenNode(); setExternalModuleIndicator(sourceFile); sourceFile.nodeCount = nodeCount; @@ -3833,6 +4043,7 @@ var ts; if (setParentNodes) { fixupParentReferences(sourceFile); } + syntaxCursor = undefined; return sourceFile; function setContextFlag(val, flag) { if (val) { @@ -3843,19 +4054,19 @@ var ts; } } function setStrictModeContext(val) { - setContextFlag(val, 1 /* StrictMode */); + setContextFlag(val, 1); } function setDisallowInContext(val) { - setContextFlag(val, 2 /* DisallowIn */); + setContextFlag(val, 2); } function setYieldContext(val) { - setContextFlag(val, 4 /* Yield */); + setContextFlag(val, 4); } function setGeneratorParameterContext(val) { - setContextFlag(val, 8 /* GeneratorParameter */); + setContextFlag(val, 8); } function allowInAnd(func) { - if (contextFlags & 2 /* DisallowIn */) { + if (contextFlags & 2) { setDisallowInContext(false); var result = func(); setDisallowInContext(true); @@ -3864,7 +4075,7 @@ var ts; return func(); } function disallowInAnd(func) { - if (contextFlags & 2 /* DisallowIn */) { + if (contextFlags & 2) { return func(); } setDisallowInContext(true); @@ -3873,7 +4084,7 @@ var ts; return result; } function doInYieldContext(func) { - if (contextFlags & 4 /* Yield */) { + if (contextFlags & 4) { return func(); } setYieldContext(true); @@ -3882,7 +4093,7 @@ var ts; return result; } function doOutsideOfYieldContext(func) { - if (contextFlags & 4 /* Yield */) { + if (contextFlags & 4) { setYieldContext(false); var result = func(); setYieldContext(true); @@ -3891,16 +4102,16 @@ var ts; return func(); } function inYieldContext() { - return (contextFlags & 4 /* Yield */) !== 0; + return (contextFlags & 4) !== 0; } function inStrictModeContext() { - return (contextFlags & 1 /* StrictMode */) !== 0; + return (contextFlags & 1) !== 0; } function inGeneratorParameterContext() { - return (contextFlags & 8 /* GeneratorParameter */) !== 0; + return (contextFlags & 8) !== 0; } function inDisallowInContext() { - return (contextFlags & 2 /* DisallowIn */) !== 0; + return (contextFlags & 2) !== 0; } function parseErrorAtCurrentToken(message, arg0) { var start = scanner.getTokenPos(); @@ -3960,13 +4171,13 @@ var ts; return speculationHelper(callback, false); } function isIdentifier() { - if (token === 64 /* Identifier */) { + if (token === 64) { return true; } - if (token === 109 /* YieldKeyword */ && inYieldContext()) { + if (token === 109 && inYieldContext()) { return false; } - return inStrictModeContext() ? token > 109 /* LastFutureReservedWord */ : token > 100 /* LastReservedWord */; + return inStrictModeContext() ? token > 109 : token > 100; } function parseExpected(kind, diagnosticMessage) { if (token === kind) { @@ -3996,21 +4207,26 @@ var ts; } return undefined; } + function parseTokenNode() { + var node = createNode(token); + nextToken(); + return finishNode(node); + } function canParseSemicolon() { - if (token === 22 /* SemicolonToken */) { + if (token === 22) { return true; } - return token === 15 /* CloseBraceToken */ || token === 1 /* EndOfFileToken */ || scanner.hasPrecedingLineBreak(); + return token === 15 || token === 1 || scanner.hasPrecedingLineBreak(); } function parseSemicolon() { if (canParseSemicolon()) { - if (token === 22 /* SemicolonToken */) { + if (token === 22) { nextToken(); } return true; } else { - return parseExpected(22 /* SemicolonToken */); + return parseExpected(22); } } function createNode(kind, pos) { @@ -4030,7 +4246,7 @@ var ts; } if (parseErrorBeforeNextFinishedNode) { parseErrorBeforeNextFinishedNode = false; - node.parserContextFlags |= 16 /* ThisNodeHasError */; + node.parserContextFlags |= 16; } return node; } @@ -4052,12 +4268,12 @@ var ts; function createIdentifier(isIdentifier, diagnosticMessage) { identifierCount++; if (isIdentifier) { - var node = createNode(64 /* Identifier */); + var node = createNode(64); node.text = internIdentifier(scanner.getTokenValue()); nextToken(); return finishNode(node); } - return createMissingNode(64 /* Identifier */, false, diagnosticMessage || ts.Diagnostics.Identifier_expected); + return createMissingNode(64, false, diagnosticMessage || ts.Diagnostics.Identifier_expected); } function parseIdentifier(diagnosticMessage) { return createIdentifier(isIdentifier(), diagnosticMessage); @@ -4066,20 +4282,22 @@ var ts; return createIdentifier(isIdentifierOrKeyword()); } function isLiteralPropertyName() { - return isIdentifierOrKeyword() || token === 8 /* StringLiteral */ || token === 7 /* NumericLiteral */; + return isIdentifierOrKeyword() || + token === 8 || + token === 7; } function parsePropertyName() { - if (token === 8 /* StringLiteral */ || token === 7 /* NumericLiteral */) { + if (token === 8 || token === 7) { return parseLiteralNode(true); } - if (token === 18 /* OpenBracketToken */) { + if (token === 18) { return parseComputedPropertyName(); } return parseIdentifierName(); } function parseComputedPropertyName() { - var node = createNode(122 /* ComputedPropertyName */); - parseExpected(18 /* OpenBracketToken */); + var node = createNode(124); + parseExpected(18); var yieldContext = inYieldContext(); if (inGeneratorParameterContext()) { setYieldContext(false); @@ -4088,7 +4306,7 @@ var ts; if (inGeneratorParameterContext()) { setYieldContext(yieldContext); } - parseExpected(19 /* CloseBracketToken */); + parseExpected(19); return finishNode(node); } function parseContextualModifier(t) { @@ -4102,14 +4320,14 @@ var ts; return ts.isModifier(token) && tryParse(nextTokenCanFollowContextualModifier); } function nextTokenCanFollowContextualModifier() { - if (token === 69 /* ConstKeyword */) { - return nextToken() === 76 /* EnumKeyword */; + if (token === 69) { + return nextToken() === 76; } nextToken(); return canFollowModifier(); } function canFollowModifier() { - return token === 18 /* OpenBracketToken */ || token === 14 /* OpenBraceToken */ || token === 35 /* AsteriskToken */ || isLiteralPropertyName(); + return token === 18 || token === 14 || token === 35 || isLiteralPropertyName(); } function isListElement(parsingContext, inErrorRecovery) { var node = currentNode(parsingContext); @@ -4117,42 +4335,41 @@ var ts; return true; } switch (parsingContext) { - case 0 /* SourceElements */: - case 1 /* ModuleElements */: + case 0: + case 1: return isSourceElement(inErrorRecovery); - case 2 /* BlockStatements */: - case 4 /* SwitchClauseStatements */: + case 2: + case 4: return isStartOfStatement(inErrorRecovery); - case 3 /* SwitchClauses */: - return token === 66 /* CaseKeyword */ || token === 72 /* DefaultKeyword */; - case 5 /* TypeMembers */: + case 3: + return token === 66 || token === 72; + case 5: return isStartOfTypeMember(); - case 6 /* ClassMembers */: + case 6: return lookAhead(isClassMemberStart); - case 7 /* EnumMembers */: - return token === 18 /* OpenBracketToken */ || isLiteralPropertyName(); - case 13 /* ObjectLiteralMembers */: - return token === 18 /* OpenBracketToken */ || token === 35 /* AsteriskToken */ || isLiteralPropertyName(); - case 10 /* ObjectBindingElements */: + case 7: + return token === 18 || isLiteralPropertyName(); + case 13: + return token === 18 || token === 35 || isLiteralPropertyName(); + case 10: return isLiteralPropertyName(); - case 8 /* TypeReferences */: + case 8: return isIdentifier() && !isNotHeritageClauseTypeName(); - case 9 /* VariableDeclarations */: + case 9: return isIdentifierOrPattern(); - case 11 /* ArrayBindingElements */: - return token === 23 /* CommaToken */ || token === 21 /* DotDotDotToken */ || isIdentifierOrPattern(); - case 16 /* TypeParameters */: + case 11: + return token === 23 || token === 21 || isIdentifierOrPattern(); + case 16: return isIdentifier(); - case 12 /* ArgumentExpressions */: - return token === 23 /* CommaToken */ || isStartOfExpression(); - case 14 /* ArrayLiteralMembers */: - return token === 23 /* CommaToken */ || token === 21 /* DotDotDotToken */ || isStartOfExpression(); - case 15 /* Parameters */: + case 12: + case 14: + return token === 23 || token === 21 || isStartOfExpression(); + case 15: return isStartOfParameter(); - case 17 /* TypeArguments */: - case 18 /* TupleElementTypes */: - return token === 23 /* CommaToken */ || isStartOfType(); - case 19 /* HeritageClauses */: + case 17: + case 18: + return token === 23 || isStartOfType(); + case 19: return isHeritageClause(); } ts.Debug.fail("Non-exhaustive case in 'isListElement'."); @@ -4162,61 +4379,62 @@ var ts; return isIdentifier(); } function isNotHeritageClauseTypeName() { - if (token === 101 /* ImplementsKeyword */ || token === 78 /* ExtendsKeyword */) { + if (token === 101 || + token === 78) { return lookAhead(nextTokenIsIdentifier); } return false; } function isListTerminator(kind) { - if (token === 1 /* EndOfFileToken */) { + if (token === 1) { return true; } switch (kind) { - case 1 /* ModuleElements */: - case 2 /* BlockStatements */: - case 3 /* SwitchClauses */: - case 5 /* TypeMembers */: - case 6 /* ClassMembers */: - case 7 /* EnumMembers */: - case 13 /* ObjectLiteralMembers */: - case 10 /* ObjectBindingElements */: - return token === 15 /* CloseBraceToken */; - case 4 /* SwitchClauseStatements */: - return token === 15 /* CloseBraceToken */ || token === 66 /* CaseKeyword */ || token === 72 /* DefaultKeyword */; - case 8 /* TypeReferences */: - return token === 14 /* OpenBraceToken */ || token === 78 /* ExtendsKeyword */ || token === 101 /* ImplementsKeyword */; - case 9 /* VariableDeclarations */: + case 1: + case 2: + case 3: + case 5: + case 6: + case 7: + case 13: + case 10: + return token === 15; + case 4: + return token === 15 || token === 66 || token === 72; + case 8: + return token === 14 || token === 78 || token === 101; + case 9: return isVariableDeclaratorListTerminator(); - case 16 /* TypeParameters */: - return token === 25 /* GreaterThanToken */ || token === 16 /* OpenParenToken */ || token === 14 /* OpenBraceToken */ || token === 78 /* ExtendsKeyword */ || token === 101 /* ImplementsKeyword */; - case 12 /* ArgumentExpressions */: - return token === 17 /* CloseParenToken */ || token === 22 /* SemicolonToken */; - case 14 /* ArrayLiteralMembers */: - case 18 /* TupleElementTypes */: - case 11 /* ArrayBindingElements */: - return token === 19 /* CloseBracketToken */; - case 15 /* Parameters */: - return token === 17 /* CloseParenToken */ || token === 19 /* CloseBracketToken */; - case 17 /* TypeArguments */: - return token === 25 /* GreaterThanToken */ || token === 16 /* OpenParenToken */; - case 19 /* HeritageClauses */: - return token === 14 /* OpenBraceToken */ || token === 15 /* CloseBraceToken */; + case 16: + return token === 25 || token === 16 || token === 14 || token === 78 || token === 101; + case 12: + return token === 17 || token === 22; + case 14: + case 18: + case 11: + return token === 19; + case 15: + return token === 17 || token === 19; + case 17: + return token === 25 || token === 16; + case 19: + return token === 14 || token === 15; } } function isVariableDeclaratorListTerminator() { if (canParseSemicolon()) { return true; } - if (token === 85 /* InKeyword */) { + if (isInOrOfKeyword(token)) { return true; } - if (token === 32 /* EqualsGreaterThanToken */) { + if (token === 32) { return true; } return false; } function isInSomeParsingContext() { - for (var kind = 0; kind < 20 /* Count */; kind++) { + for (var kind = 0; kind < 20; kind++) { if (parsingContext & (1 << kind)) { if (isListElement(kind, true) || isListTerminator(kind)) { return true; @@ -4257,8 +4475,8 @@ var ts; parsingContext = saveParsingContext; return result; } - function parseListElement(kind, parseElement) { - var node = currentNode(kind); + function parseListElement(parsingContext, parseElement) { + var node = currentNode(parsingContext); if (node) { return consumeNode(node); } @@ -4281,7 +4499,7 @@ var ts; if (ts.containsParseError(node)) { return undefined; } - var nodeContextFlags = node.parserContextFlags & 31 /* ParserGeneratedFlags */; + var nodeContextFlags = node.parserContextFlags & 31; if (nodeContextFlags !== contextFlags) { return undefined; } @@ -4297,75 +4515,57 @@ var ts; } function canReuseNode(node, parsingContext) { switch (parsingContext) { - case 1 /* ModuleElements */: + case 1: return isReusableModuleElement(node); - case 6 /* ClassMembers */: + case 6: return isReusableClassMember(node); - case 3 /* SwitchClauses */: + case 3: return isReusableSwitchClause(node); - case 2 /* BlockStatements */: - case 4 /* SwitchClauseStatements */: + case 2: + case 4: return isReusableStatement(node); - case 7 /* EnumMembers */: + case 7: return isReusableEnumMember(node); - case 5 /* TypeMembers */: + case 5: return isReusableTypeMember(node); - case 9 /* VariableDeclarations */: + case 9: return isReusableVariableDeclaration(node); - case 15 /* Parameters */: + case 15: return isReusableParameter(node); - case 19 /* HeritageClauses */: - case 8 /* TypeReferences */: - case 16 /* TypeParameters */: - case 18 /* TupleElementTypes */: - case 17 /* TypeArguments */: - case 12 /* ArgumentExpressions */: - case 13 /* ObjectLiteralMembers */: + case 19: + case 8: + case 16: + case 18: + case 17: + case 12: + case 13: } return false; } function isReusableModuleElement(node) { if (node) { switch (node.kind) { - case 197 /* ImportDeclaration */: - case 198 /* ExportAssignment */: - case 191 /* ClassDeclaration */: - case 192 /* InterfaceDeclaration */: - case 195 /* ModuleDeclaration */: - case 194 /* EnumDeclaration */: - case 190 /* FunctionDeclaration */: - case 171 /* VariableStatement */: - case 170 /* Block */: - case 174 /* IfStatement */: - case 173 /* ExpressionStatement */: - case 185 /* ThrowStatement */: - case 181 /* ReturnStatement */: - case 183 /* SwitchStatement */: - case 180 /* BreakStatement */: - case 179 /* ContinueStatement */: - case 178 /* ForInStatement */: - case 177 /* ForStatement */: - case 176 /* WhileStatement */: - case 182 /* WithStatement */: - case 172 /* EmptyStatement */: - case 186 /* TryStatement */: - case 184 /* LabeledStatement */: - case 175 /* DoStatement */: - case 187 /* DebuggerStatement */: + case 200: + case 201: + case 194: + case 195: + case 198: + case 197: return true; } + return isReusableStatement(node); } return false; } function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 129 /* Constructor */: - case 134 /* IndexSignature */: - case 128 /* MethodDeclaration */: - case 130 /* GetAccessor */: - case 131 /* SetAccessor */: - case 126 /* PropertyDeclaration */: + case 131: + case 136: + case 130: + case 132: + case 133: + case 128: return true; } } @@ -4374,8 +4574,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 200 /* CaseClause */: - case 201 /* DefaultClause */: + case 203: + case 204: return true; } } @@ -4384,55 +4584,60 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 190 /* FunctionDeclaration */: - case 171 /* VariableStatement */: - case 170 /* Block */: - case 174 /* IfStatement */: - case 173 /* ExpressionStatement */: - case 185 /* ThrowStatement */: - case 181 /* ReturnStatement */: - case 183 /* SwitchStatement */: - case 180 /* BreakStatement */: - case 179 /* ContinueStatement */: - case 178 /* ForInStatement */: - case 177 /* ForStatement */: - case 176 /* WhileStatement */: - case 182 /* WithStatement */: - case 172 /* EmptyStatement */: - case 186 /* TryStatement */: - case 184 /* LabeledStatement */: - case 175 /* DoStatement */: - case 187 /* DebuggerStatement */: + case 193: + case 173: + case 172: + case 176: + case 175: + case 188: + case 184: + case 186: + case 183: + case 182: + case 180: + case 181: + case 179: + case 178: + case 185: + case 174: + case 189: + case 187: + case 177: + case 190: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 206 /* EnumMember */; + return node.kind === 209; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 133 /* ConstructSignature */: - case 127 /* MethodSignature */: - case 134 /* IndexSignature */: - case 125 /* PropertySignature */: - case 132 /* CallSignature */: + case 135: + case 129: + case 136: + case 127: + case 134: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 188 /* VariableDeclaration */) { + if (node.kind !== 191) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - return node.kind === 124 /* Parameter */; + if (node.kind !== 126) { + return false; + } + var parameter = node; + return parameter.initializer === undefined; } function abortParsingListOrMoveToNextToken(kind) { parseErrorAtCurrentToken(parsingContextErrors(kind)); @@ -4442,7 +4647,7 @@ var ts; nextToken(); return false; } - function parseDelimitedList(kind, parseElement) { + function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimeter) { var saveParsingContext = parsingContext; parsingContext |= 1 << kind; var result = []; @@ -4452,14 +4657,17 @@ var ts; if (isListElement(kind, false)) { result.push(parseListElement(kind, parseElement)); commaStart = scanner.getTokenPos(); - if (parseOptional(23 /* CommaToken */)) { + if (parseOptional(23)) { continue; } commaStart = -1; if (isListTerminator(kind)) { break; } - parseExpected(23 /* CommaToken */); + parseExpected(23); + if (considerSemicolonAsDelimeter && token === 22 && !scanner.hasPrecedingLineBreak()) { + nextToken(); + } continue; } if (isListTerminator(kind)) { @@ -4493,8 +4701,8 @@ var ts; } function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); - while (parseOptional(20 /* DotToken */)) { - var node = createNode(121 /* QualifiedName */, entity.pos); + while (parseOptional(20)) { + var node = createNode(123, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -4505,39 +4713,34 @@ var ts; if (scanner.hasPrecedingLineBreak() && scanner.isReservedWord()) { var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); if (matchesPattern) { - return createMissingNode(64 /* Identifier */, true, ts.Diagnostics.Identifier_expected); + return createMissingNode(64, true, ts.Diagnostics.Identifier_expected); } } return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } - function parseTokenNode() { - var node = createNode(token); - nextToken(); - return finishNode(node); - } function parseTemplateExpression() { - var template = createNode(165 /* TemplateExpression */); + var template = createNode(167); template.head = parseLiteralNode(); - ts.Debug.assert(template.head.kind === 11 /* TemplateHead */, "Template head has wrong token kind"); + ts.Debug.assert(template.head.kind === 11, "Template head has wrong token kind"); var templateSpans = []; templateSpans.pos = getNodePos(); do { templateSpans.push(parseTemplateSpan()); - } while (templateSpans[templateSpans.length - 1].literal.kind === 12 /* TemplateMiddle */); + } while (templateSpans[templateSpans.length - 1].literal.kind === 12); templateSpans.end = getNodeEnd(); template.templateSpans = templateSpans; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(169 /* TemplateSpan */); + var span = createNode(171); span.expression = allowInAnd(parseExpression); var literal; - if (token === 15 /* CloseBraceToken */) { + if (token === 15) { reScanTemplateToken(); literal = parseLiteralNode(); } else { - literal = createMissingNode(13 /* TemplateTail */, false, ts.Diagnostics._0_expected, ts.tokenToString(15 /* CloseBraceToken */)); + literal = createMissingNode(13, false, ts.Diagnostics._0_expected, ts.tokenToString(15)); } span.literal = literal; return finishNode(span); @@ -4552,29 +4755,29 @@ var ts; var tokenPos = scanner.getTokenPos(); nextToken(); finishNode(node); - if (node.kind === 7 /* NumericLiteral */ && sourceText.charCodeAt(tokenPos) === 48 /* _0 */ && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { - node.flags |= 8192 /* OctalLiteral */; + if (node.kind === 7 && sourceText.charCodeAt(tokenPos) === 48 && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { + node.flags |= 8192; } return node; } function parseTypeReference() { - var node = createNode(135 /* TypeReference */); + var node = createNode(137); node.typeName = parseEntityName(false, ts.Diagnostics.Type_expected); - if (!scanner.hasPrecedingLineBreak() && token === 24 /* LessThanToken */) { - node.typeArguments = parseBracketedList(17 /* TypeArguments */, parseType, 24 /* LessThanToken */, 25 /* GreaterThanToken */); + if (!scanner.hasPrecedingLineBreak() && token === 24) { + node.typeArguments = parseBracketedList(17, parseType, 24, 25); } return finishNode(node); } function parseTypeQuery() { - var node = createNode(138 /* TypeQuery */); - parseExpected(96 /* TypeOfKeyword */); + var node = createNode(140); + parseExpected(96); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(123 /* TypeParameter */); + var node = createNode(125); node.name = parseIdentifier(); - if (parseOptional(78 /* ExtendsKeyword */)) { + if (parseOptional(78)) { if (isStartOfType() || !isStartOfExpression()) { node.constraint = parseType(); } @@ -4585,18 +4788,18 @@ var ts; return finishNode(node); } function parseTypeParameters() { - if (token === 24 /* LessThanToken */) { - return parseBracketedList(16 /* TypeParameters */, parseTypeParameter, 24 /* LessThanToken */, 25 /* GreaterThanToken */); + if (token === 24) { + return parseBracketedList(16, parseTypeParameter, 24, 25); } } function parseParameterType() { - if (parseOptional(51 /* ColonToken */)) { - return token === 8 /* StringLiteral */ ? parseLiteralNode(true) : parseType(); + if (parseOptional(51)) { + return token === 8 ? parseLiteralNode(true) : parseType(); } return undefined; } function isStartOfParameter() { - return token === 21 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifier(token); + return token === 21 || isIdentifierOrPattern() || ts.isModifier(token); } function setModifiers(node, modifiers) { if (modifiers) { @@ -4605,14 +4808,14 @@ var ts; } } function parseParameter() { - var node = createNode(124 /* Parameter */); + var node = createNode(126); setModifiers(node, parseModifiers()); - node.dotDotDotToken = parseOptionalToken(21 /* DotDotDotToken */); + node.dotDotDotToken = parseOptionalToken(21); node.name = inGeneratorParameterContext() ? doInYieldContext(parseIdentifierOrPattern) : parseIdentifierOrPattern(); if (ts.getFullWidth(node.name) === 0 && node.flags === 0 && ts.isModifier(token)) { nextToken(); } - node.questionToken = parseOptionalToken(50 /* QuestionToken */); + node.questionToken = parseOptionalToken(50); node.type = parseParameterType(); node.initializer = inGeneratorParameterContext() ? doOutsideOfYieldContext(parseParameterInitializer) : parseParameterInitializer(); return finishNode(node); @@ -4621,7 +4824,7 @@ var ts; return parseInitializer(true); } function fillSignature(returnToken, yieldAndGeneratorParameterContext, requireCompleteParameterList, signature) { - var returnTokenRequired = returnToken === 32 /* EqualsGreaterThanToken */; + var returnTokenRequired = returnToken === 32; signature.typeParameters = parseTypeParameters(); signature.parameters = parseParameterList(yieldAndGeneratorParameterContext, requireCompleteParameterList); if (returnTokenRequired) { @@ -4633,15 +4836,15 @@ var ts; } } function parseParameterList(yieldAndGeneratorParameterContext, requireCompleteParameterList) { - if (parseExpected(16 /* OpenParenToken */)) { + if (parseExpected(16)) { var savedYieldContext = inYieldContext(); var savedGeneratorParameterContext = inGeneratorParameterContext(); setYieldContext(yieldAndGeneratorParameterContext); setGeneratorParameterContext(yieldAndGeneratorParameterContext); - var result = parseDelimitedList(15 /* Parameters */, parseParameter); + var result = parseDelimitedList(15, parseParameter); setYieldContext(savedYieldContext); setGeneratorParameterContext(savedGeneratorParameterContext); - if (!parseExpected(17 /* CloseParenToken */) && requireCompleteParameterList) { + if (!parseExpected(17) && requireCompleteParameterList) { return undefined; } return result; @@ -4652,26 +4855,26 @@ var ts; if (parseSemicolon()) { return; } - parseOptional(23 /* CommaToken */); + parseOptional(23); } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 133 /* ConstructSignature */) { - parseExpected(87 /* NewKeyword */); + if (kind === 135) { + parseExpected(87); } - fillSignature(51 /* ColonToken */, false, false, node); + fillSignature(51, false, false, node); parseTypeMemberSemicolon(); return finishNode(node); } function isIndexSignature() { - if (token !== 18 /* OpenBracketToken */) { + if (token !== 18) { return false; } return lookAhead(isUnambiguouslyIndexSignature); } function isUnambiguouslyIndexSignature() { nextToken(); - if (token === 21 /* DotDotDotToken */ || token === 19 /* CloseBracketToken */) { + if (token === 21 || token === 19) { return true; } if (ts.isModifier(token)) { @@ -4686,20 +4889,20 @@ var ts; else { nextToken(); } - if (token === 51 /* ColonToken */ || token === 23 /* CommaToken */) { + if (token === 51 || token === 23) { return true; } - if (token !== 50 /* QuestionToken */) { + if (token !== 50) { return false; } nextToken(); - return token === 51 /* ColonToken */ || token === 23 /* CommaToken */ || token === 19 /* CloseBracketToken */; + return token === 51 || token === 23 || token === 19; } function parseIndexSignatureDeclaration(modifiers) { var fullStart = modifiers ? modifiers.pos : scanner.getStartPos(); - var node = createNode(134 /* IndexSignature */, fullStart); + var node = createNode(136, fullStart); setModifiers(node, modifiers); - node.parameters = parseBracketedList(15 /* Parameters */, parseParameter, 18 /* OpenBracketToken */, 19 /* CloseBracketToken */); + node.parameters = parseBracketedList(15, parseParameter, 18, 19); node.type = parseTypeAnnotation(); parseTypeMemberSemicolon(); return finishNode(node); @@ -4707,17 +4910,17 @@ var ts; function parsePropertyOrMethodSignature() { var fullStart = scanner.getStartPos(); var name = parsePropertyName(); - var questionToken = parseOptionalToken(50 /* QuestionToken */); - if (token === 16 /* OpenParenToken */ || token === 24 /* LessThanToken */) { - var method = createNode(127 /* MethodSignature */, fullStart); + var questionToken = parseOptionalToken(50); + if (token === 16 || token === 24) { + var method = createNode(129, fullStart); method.name = name; method.questionToken = questionToken; - fillSignature(51 /* ColonToken */, false, false, method); + fillSignature(51, false, false, method); parseTypeMemberSemicolon(); return finishNode(method); } else { - var property = createNode(125 /* PropertySignature */, fullStart); + var property = createNode(127, fullStart); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); @@ -4727,9 +4930,9 @@ var ts; } function isStartOfTypeMember() { switch (token) { - case 16 /* OpenParenToken */: - case 24 /* LessThanToken */: - case 18 /* OpenBracketToken */: + case 16: + case 24: + case 18: return true; default: if (ts.isModifier(token)) { @@ -4749,21 +4952,25 @@ var ts; } function isTypeMemberWithLiteralPropertyName() { nextToken(); - return token === 16 /* OpenParenToken */ || token === 24 /* LessThanToken */ || token === 50 /* QuestionToken */ || token === 51 /* ColonToken */ || canParseSemicolon(); + return token === 16 || + token === 24 || + token === 50 || + token === 51 || + canParseSemicolon(); } function parseTypeMember() { switch (token) { - case 16 /* OpenParenToken */: - case 24 /* LessThanToken */: - return parseSignatureMember(132 /* CallSignature */); - case 18 /* OpenBracketToken */: + case 16: + case 24: + return parseSignatureMember(134); + case 18: return isIndexSignature() ? parseIndexSignatureDeclaration(undefined) : parsePropertyOrMethodSignature(); - case 87 /* NewKeyword */: + case 87: if (lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(133 /* ConstructSignature */); + return parseSignatureMember(135); } - case 8 /* StringLiteral */: - case 7 /* NumericLiteral */: + case 8: + case 7: return parsePropertyOrMethodSignature(); default: if (ts.isModifier(token)) { @@ -4783,18 +4990,18 @@ var ts; } function isStartOfConstructSignature() { nextToken(); - return token === 16 /* OpenParenToken */ || token === 24 /* LessThanToken */; + return token === 16 || token === 24; } function parseTypeLiteral() { - var node = createNode(139 /* TypeLiteral */); + var node = createNode(141); node.members = parseObjectTypeMembers(); return finishNode(node); } function parseObjectTypeMembers() { var members; - if (parseExpected(14 /* OpenBraceToken */)) { - members = parseList(5 /* TypeMembers */, false, parseTypeMember); - parseExpected(15 /* CloseBraceToken */); + if (parseExpected(14)) { + members = parseList(5, false, parseTypeMember); + parseExpected(15); } else { members = createMissingList(); @@ -4802,46 +5009,47 @@ var ts; return members; } function parseTupleType() { - var node = createNode(141 /* TupleType */); - node.elementTypes = parseBracketedList(18 /* TupleElementTypes */, parseType, 18 /* OpenBracketToken */, 19 /* CloseBracketToken */); + var node = createNode(143); + node.elementTypes = parseBracketedList(18, parseType, 18, 19); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(143 /* ParenthesizedType */); - parseExpected(16 /* OpenParenToken */); + var node = createNode(145); + parseExpected(16); node.type = parseType(); - parseExpected(17 /* CloseParenToken */); + parseExpected(17); return finishNode(node); } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 137 /* ConstructorType */) { - parseExpected(87 /* NewKeyword */); + if (kind === 139) { + parseExpected(87); } - fillSignature(32 /* EqualsGreaterThanToken */, false, false, node); + fillSignature(32, false, false, node); return finishNode(node); } function parseKeywordAndNoDot() { var node = parseTokenNode(); - return token === 20 /* DotToken */ ? undefined : node; + return token === 20 ? undefined : node; } function parseNonArrayType() { switch (token) { - case 110 /* AnyKeyword */: - case 119 /* StringKeyword */: - case 117 /* NumberKeyword */: - case 111 /* BooleanKeyword */: + case 110: + case 119: + case 117: + case 111: + case 120: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); - case 98 /* VoidKeyword */: + case 98: return parseTokenNode(); - case 96 /* TypeOfKeyword */: + case 96: return parseTypeQuery(); - case 14 /* OpenBraceToken */: + case 14: return parseTypeLiteral(); - case 18 /* OpenBracketToken */: + case 18: return parseTupleType(); - case 16 /* OpenParenToken */: + case 16: return parseParenthesizedType(); default: return parseTypeReference(); @@ -4849,18 +5057,19 @@ var ts; } function isStartOfType() { switch (token) { - case 110 /* AnyKeyword */: - case 119 /* StringKeyword */: - case 117 /* NumberKeyword */: - case 111 /* BooleanKeyword */: - case 98 /* VoidKeyword */: - case 96 /* TypeOfKeyword */: - case 14 /* OpenBraceToken */: - case 18 /* OpenBracketToken */: - case 24 /* LessThanToken */: - case 87 /* NewKeyword */: + case 110: + case 119: + case 117: + case 111: + case 120: + case 98: + case 96: + case 14: + case 18: + case 24: + case 87: return true; - case 16 /* OpenParenToken */: + case 16: return lookAhead(isStartOfParenthesizedOrFunctionType); default: return isIdentifier(); @@ -4868,13 +5077,13 @@ var ts; } function isStartOfParenthesizedOrFunctionType() { nextToken(); - return token === 17 /* CloseParenToken */ || isStartOfParameter() || isStartOfType(); + return token === 17 || isStartOfParameter() || isStartOfType(); } function parseArrayTypeOrHigher() { var type = parseNonArrayType(); - while (!scanner.hasPrecedingLineBreak() && parseOptional(18 /* OpenBracketToken */)) { - parseExpected(19 /* CloseBracketToken */); - var node = createNode(140 /* ArrayType */, type.pos); + while (!scanner.hasPrecedingLineBreak() && parseOptional(18)) { + parseExpected(19); + var node = createNode(142, type.pos); node.elementType = type; type = finishNode(node); } @@ -4882,38 +5091,40 @@ var ts; } function parseUnionTypeOrHigher() { var type = parseArrayTypeOrHigher(); - if (token === 44 /* BarToken */) { + if (token === 44) { var types = [type]; types.pos = type.pos; - while (parseOptional(44 /* BarToken */)) { + while (parseOptional(44)) { types.push(parseArrayTypeOrHigher()); } types.end = getNodeEnd(); - var node = createNode(142 /* UnionType */, type.pos); + var node = createNode(144, type.pos); node.types = types; type = finishNode(node); } return type; } function isStartOfFunctionType() { - if (token === 24 /* LessThanToken */) { + if (token === 24) { return true; } - return token === 16 /* OpenParenToken */ && lookAhead(isUnambiguouslyStartOfFunctionType); + return token === 16 && lookAhead(isUnambiguouslyStartOfFunctionType); } function isUnambiguouslyStartOfFunctionType() { nextToken(); - if (token === 17 /* CloseParenToken */ || token === 21 /* DotDotDotToken */) { + if (token === 17 || token === 21) { return true; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 51 /* ColonToken */ || token === 23 /* CommaToken */ || token === 50 /* QuestionToken */ || token === 52 /* EqualsToken */ || isIdentifier() || ts.isModifier(token)) { + if (token === 51 || token === 23 || + token === 50 || token === 52 || + isIdentifier() || ts.isModifier(token)) { return true; } - if (token === 17 /* CloseParenToken */) { + if (token === 17) { nextToken(); - if (token === 32 /* EqualsGreaterThanToken */) { + if (token === 32) { return true; } } @@ -4932,46 +5143,46 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(136 /* FunctionType */); + return parseFunctionOrConstructorType(138); } - if (token === 87 /* NewKeyword */) { - return parseFunctionOrConstructorType(137 /* ConstructorType */); + if (token === 87) { + return parseFunctionOrConstructorType(139); } return parseUnionTypeOrHigher(); } function parseTypeAnnotation() { - return parseOptional(51 /* ColonToken */) ? parseType() : undefined; + return parseOptional(51) ? parseType() : undefined; } function isStartOfExpression() { switch (token) { - case 92 /* ThisKeyword */: - case 90 /* SuperKeyword */: - case 88 /* NullKeyword */: - case 94 /* TrueKeyword */: - case 79 /* FalseKeyword */: - case 7 /* NumericLiteral */: - case 8 /* StringLiteral */: - case 10 /* NoSubstitutionTemplateLiteral */: - case 11 /* TemplateHead */: - case 16 /* OpenParenToken */: - case 18 /* OpenBracketToken */: - case 14 /* OpenBraceToken */: - case 82 /* FunctionKeyword */: - case 87 /* NewKeyword */: - case 36 /* SlashToken */: - case 56 /* SlashEqualsToken */: - case 33 /* PlusToken */: - case 34 /* MinusToken */: - case 47 /* TildeToken */: - case 46 /* ExclamationToken */: - case 73 /* DeleteKeyword */: - case 96 /* TypeOfKeyword */: - case 98 /* VoidKeyword */: - case 38 /* PlusPlusToken */: - case 39 /* MinusMinusToken */: - case 24 /* LessThanToken */: - case 64 /* Identifier */: - case 109 /* YieldKeyword */: + case 92: + case 90: + case 88: + case 94: + case 79: + case 7: + case 8: + case 10: + case 11: + case 16: + case 18: + case 14: + case 82: + case 87: + case 36: + case 56: + case 33: + case 34: + case 47: + case 46: + case 73: + case 96: + case 98: + case 38: + case 39: + case 24: + case 64: + case 109: return true; default: if (isBinaryOperator()) { @@ -4981,22 +5192,23 @@ var ts; } } function isStartOfExpressionStatement() { - return token !== 14 /* OpenBraceToken */ && token !== 82 /* FunctionKeyword */ && isStartOfExpression(); + return token !== 14 && token !== 82 && isStartOfExpression(); } function parseExpression() { var expr = parseAssignmentExpressionOrHigher(); - while (parseOptional(23 /* CommaToken */)) { - expr = makeBinaryExpression(expr, 23 /* CommaToken */, parseAssignmentExpressionOrHigher()); + var operatorToken; + while ((operatorToken = parseOptionalToken(23))) { + expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher()); } return expr; } function parseInitializer(inParameter) { - if (token !== 52 /* EqualsToken */) { - if (scanner.hasPrecedingLineBreak() || (inParameter && token === 14 /* OpenBraceToken */) || !isStartOfExpression()) { + if (token !== 52) { + if (scanner.hasPrecedingLineBreak() || (inParameter && token === 14) || !isStartOfExpression()) { return undefined; } } - parseExpected(52 /* EqualsToken */); + parseExpected(52); return parseAssignmentExpressionOrHigher(); } function parseAssignmentExpressionOrHigher() { @@ -5008,18 +5220,16 @@ var ts; return arrowExpression; } var expr = parseBinaryExpressionOrHigher(0); - if (expr.kind === 64 /* Identifier */ && token === 32 /* EqualsGreaterThanToken */) { + if (expr.kind === 64 && token === 32) { return parseSimpleArrowFunctionExpression(expr); } if (isLeftHandSideExpression(expr) && isAssignmentOperator(reScanGreaterToken())) { - var operator = token; - nextToken(); - return makeBinaryExpression(expr, operator, parseAssignmentExpressionOrHigher()); + return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher()); } return parseConditionalExpressionRest(expr); } function isYieldExpression() { - if (token === 109 /* YieldKeyword */) { + if (token === 109) { if (inYieldContext()) { return true; } @@ -5035,10 +5245,11 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(166 /* YieldExpression */); + var node = createNode(168); nextToken(); - if (!scanner.hasPrecedingLineBreak() && (token === 35 /* AsteriskToken */ || isStartOfExpression())) { - node.asteriskToken = parseOptionalToken(35 /* AsteriskToken */); + if (!scanner.hasPrecedingLineBreak() && + (token === 35 || isStartOfExpression())) { + node.asteriskToken = parseOptionalToken(35); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -5047,28 +5258,28 @@ var ts; } } function parseSimpleArrowFunctionExpression(identifier) { - ts.Debug.assert(token === 32 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(157 /* ArrowFunction */, identifier.pos); - var parameter = createNode(124 /* Parameter */, identifier.pos); + ts.Debug.assert(token === 32, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); + var node = createNode(159, identifier.pos); + var parameter = createNode(126, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; node.parameters.pos = parameter.pos; node.parameters.end = parameter.end; - parseExpected(32 /* EqualsGreaterThanToken */); + parseExpected(32); node.body = parseArrowFunctionExpressionBody(); return finishNode(node); } function tryParseParenthesizedArrowFunctionExpression() { var triState = isParenthesizedArrowFunctionExpression(); - if (triState === 0 /* False */) { + if (triState === 0) { return undefined; } - var arrowFunction = triState === 1 /* True */ ? parseParenthesizedArrowFunctionExpressionHead(true) : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); + var arrowFunction = triState === 1 ? parseParenthesizedArrowFunctionExpressionHead(true) : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); if (!arrowFunction) { return undefined; } - if (parseExpected(32 /* EqualsGreaterThanToken */) || token === 14 /* OpenBraceToken */) { + if (parseExpected(32) || token === 14) { arrowFunction.body = parseArrowFunctionExpressionBody(); } else { @@ -5077,79 +5288,79 @@ var ts; return finishNode(arrowFunction); } function isParenthesizedArrowFunctionExpression() { - if (token === 16 /* OpenParenToken */ || token === 24 /* LessThanToken */) { + if (token === 16 || token === 24) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } - if (token === 32 /* EqualsGreaterThanToken */) { - return 1 /* True */; + if (token === 32) { + return 1; } - return 0 /* False */; + return 0; } function isParenthesizedArrowFunctionExpressionWorker() { var first = token; var second = nextToken(); - if (first === 16 /* OpenParenToken */) { - if (second === 17 /* CloseParenToken */) { + if (first === 16) { + if (second === 17) { var third = nextToken(); switch (third) { - case 32 /* EqualsGreaterThanToken */: - case 51 /* ColonToken */: - case 14 /* OpenBraceToken */: - return 1 /* True */; + case 32: + case 51: + case 14: + return 1; default: - return 0 /* False */; + return 0; } } - if (second === 21 /* DotDotDotToken */) { - return 1 /* True */; + if (second === 21) { + return 1; } if (!isIdentifier()) { - return 0 /* False */; + return 0; } - if (nextToken() === 51 /* ColonToken */) { - return 1 /* True */; + if (nextToken() === 51) { + return 1; } - return 2 /* Unknown */; + return 2; } else { - ts.Debug.assert(first === 24 /* LessThanToken */); + ts.Debug.assert(first === 24); if (!isIdentifier()) { - return 0 /* False */; + return 0; } - return 2 /* Unknown */; + return 2; } } function parsePossibleParenthesizedArrowFunctionExpressionHead() { return parseParenthesizedArrowFunctionExpressionHead(false); } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(157 /* ArrowFunction */); - fillSignature(51 /* ColonToken */, false, !allowAmbiguity, node); + var node = createNode(159); + fillSignature(51, false, !allowAmbiguity, node); if (!node.parameters) { return undefined; } - if (!allowAmbiguity && token !== 32 /* EqualsGreaterThanToken */ && token !== 14 /* OpenBraceToken */) { + if (!allowAmbiguity && token !== 32 && token !== 14) { return undefined; } return node; } function parseArrowFunctionExpressionBody() { - if (token === 14 /* OpenBraceToken */) { + if (token === 14) { return parseFunctionBlock(false, false); } - if (isStartOfStatement(true) && !isStartOfExpressionStatement() && token !== 82 /* FunctionKeyword */) { + if (isStartOfStatement(true) && !isStartOfExpressionStatement() && token !== 82) { return parseFunctionBlock(false, true); } return parseAssignmentExpressionOrHigher(); } function parseConditionalExpressionRest(leftOperand) { - if (!parseOptional(50 /* QuestionToken */)) { + if (!parseOptional(50)) { return leftOperand; } - var node = createNode(164 /* ConditionalExpression */, leftOperand.pos); + var node = createNode(166, leftOperand.pos); node.condition = leftOperand; node.whenTrue = allowInAnd(parseAssignmentExpressionOrHigher); - parseExpected(51 /* ColonToken */); + parseExpected(51); node.whenFalse = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -5157,6 +5368,9 @@ var ts; var leftOperand = parseUnaryExpressionOrHigher(); return parseBinaryExpressionRest(precedence, leftOperand); } + function isInOrOfKeyword(t) { + return t === 85 || t === 122; + } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { reScanGreaterToken(); @@ -5164,107 +5378,105 @@ var ts; if (newPrecedence <= precedence) { break; } - if (token === 85 /* InKeyword */ && inDisallowInContext()) { + if (token === 85 && inDisallowInContext()) { break; } - var operator = token; - nextToken(); - leftOperand = makeBinaryExpression(leftOperand, operator, parseBinaryExpressionOrHigher(newPrecedence)); + leftOperand = makeBinaryExpression(leftOperand, parseTokenNode(), parseBinaryExpressionOrHigher(newPrecedence)); } return leftOperand; } function isBinaryOperator() { - if (inDisallowInContext() && token === 85 /* InKeyword */) { + if (inDisallowInContext() && token === 85) { return false; } return getBinaryOperatorPrecedence() > 0; } function getBinaryOperatorPrecedence() { switch (token) { - case 49 /* BarBarToken */: + case 49: return 1; - case 48 /* AmpersandAmpersandToken */: + case 48: return 2; - case 44 /* BarToken */: + case 44: return 3; - case 45 /* CaretToken */: + case 45: return 4; - case 43 /* AmpersandToken */: + case 43: return 5; - case 28 /* EqualsEqualsToken */: - case 29 /* ExclamationEqualsToken */: - case 30 /* EqualsEqualsEqualsToken */: - case 31 /* ExclamationEqualsEqualsToken */: + case 28: + case 29: + case 30: + case 31: return 6; - case 24 /* LessThanToken */: - case 25 /* GreaterThanToken */: - case 26 /* LessThanEqualsToken */: - case 27 /* GreaterThanEqualsToken */: - case 86 /* InstanceOfKeyword */: - case 85 /* InKeyword */: + case 24: + case 25: + case 26: + case 27: + case 86: + case 85: return 7; - case 40 /* LessThanLessThanToken */: - case 41 /* GreaterThanGreaterThanToken */: - case 42 /* GreaterThanGreaterThanGreaterThanToken */: + case 40: + case 41: + case 42: return 8; - case 33 /* PlusToken */: - case 34 /* MinusToken */: + case 33: + case 34: return 9; - case 35 /* AsteriskToken */: - case 36 /* SlashToken */: - case 37 /* PercentToken */: + case 35: + case 36: + case 37: return 10; } return -1; } - function makeBinaryExpression(left, operator, right) { - var node = createNode(163 /* BinaryExpression */, left.pos); + function makeBinaryExpression(left, operatorToken, right) { + var node = createNode(165, left.pos); node.left = left; - node.operator = operator; + node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(161 /* PrefixUnaryExpression */); + var node = createNode(163); node.operator = token; nextToken(); node.operand = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(158 /* DeleteExpression */); + var node = createNode(160); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(159 /* TypeOfExpression */); + var node = createNode(161); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(160 /* VoidExpression */); + var node = createNode(162); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseUnaryExpressionOrHigher() { switch (token) { - case 33 /* PlusToken */: - case 34 /* MinusToken */: - case 47 /* TildeToken */: - case 46 /* ExclamationToken */: - case 38 /* PlusPlusToken */: - case 39 /* MinusMinusToken */: + case 33: + case 34: + case 47: + case 46: + case 38: + case 39: return parsePrefixUnaryExpression(); - case 73 /* DeleteKeyword */: + case 73: return parseDeleteExpression(); - case 96 /* TypeOfKeyword */: + case 96: return parseTypeOfExpression(); - case 98 /* VoidKeyword */: + case 98: return parseVoidExpression(); - case 24 /* LessThanToken */: + case 24: return parseTypeAssertion(); default: return parsePostfixExpressionOrHigher(); @@ -5273,8 +5485,8 @@ var ts; function parsePostfixExpressionOrHigher() { var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(isLeftHandSideExpression(expression)); - if ((token === 38 /* PlusPlusToken */ || token === 39 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(162 /* PostfixUnaryExpression */, expression.pos); + if ((token === 38 || token === 39) && !scanner.hasPrecedingLineBreak()) { + var node = createNode(164, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -5283,7 +5495,7 @@ var ts; return expression; } function parseLeftHandSideExpressionOrHigher() { - var expression = token === 90 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher(); + var expression = token === 90 ? parseSuperExpression() : parseMemberExpressionOrHigher(); return parseCallExpressionRest(expression); } function parseMemberExpressionOrHigher() { @@ -5292,51 +5504,51 @@ var ts; } function parseSuperExpression() { var expression = parseTokenNode(); - if (token === 16 /* OpenParenToken */ || token === 20 /* DotToken */) { + if (token === 16 || token === 20) { return expression; } - var node = createNode(149 /* PropertyAccessExpression */, expression.pos); + var node = createNode(151, expression.pos); node.expression = expression; - parseExpected(20 /* DotToken */, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); + parseExpected(20, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(true); return finishNode(node); } function parseTypeAssertion() { - var node = createNode(154 /* TypeAssertionExpression */); - parseExpected(24 /* LessThanToken */); + var node = createNode(156); + parseExpected(24); node.type = parseType(); - parseExpected(25 /* GreaterThanToken */); + parseExpected(25); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseMemberExpressionRest(expression) { while (true) { var dotOrBracketStart = scanner.getTokenPos(); - if (parseOptional(20 /* DotToken */)) { - var propertyAccess = createNode(149 /* PropertyAccessExpression */, expression.pos); + if (parseOptional(20)) { + var propertyAccess = createNode(151, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); continue; } - if (parseOptional(18 /* OpenBracketToken */)) { - var indexedAccess = createNode(150 /* ElementAccessExpression */, expression.pos); + if (parseOptional(18)) { + var indexedAccess = createNode(152, expression.pos); indexedAccess.expression = expression; - if (token !== 19 /* CloseBracketToken */) { + if (token !== 19) { indexedAccess.argumentExpression = allowInAnd(parseExpression); - if (indexedAccess.argumentExpression.kind === 8 /* StringLiteral */ || indexedAccess.argumentExpression.kind === 7 /* NumericLiteral */) { + if (indexedAccess.argumentExpression.kind === 8 || indexedAccess.argumentExpression.kind === 7) { var literal = indexedAccess.argumentExpression; literal.text = internIdentifier(literal.text); } } - parseExpected(19 /* CloseBracketToken */); + parseExpected(19); expression = finishNode(indexedAccess); continue; } - if (token === 10 /* NoSubstitutionTemplateLiteral */ || token === 11 /* TemplateHead */) { - var tagExpression = createNode(153 /* TaggedTemplateExpression */, expression.pos); + if (token === 10 || token === 11) { + var tagExpression = createNode(155, expression.pos); tagExpression.tag = expression; - tagExpression.template = token === 10 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() : parseTemplateExpression(); + tagExpression.template = token === 10 ? parseLiteralNode() : parseTemplateExpression(); expression = finishNode(tagExpression); continue; } @@ -5346,20 +5558,20 @@ var ts; function parseCallExpressionRest(expression) { while (true) { expression = parseMemberExpressionRest(expression); - if (token === 24 /* LessThanToken */) { + if (token === 24) { var typeArguments = tryParse(parseTypeArgumentsInExpression); if (!typeArguments) { return expression; } - var callExpr = createNode(151 /* CallExpression */, expression.pos); + var callExpr = createNode(153, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); continue; } - else if (token === 16 /* OpenParenToken */) { - var callExpr = createNode(151 /* CallExpression */, expression.pos); + else if (token === 16) { + var callExpr = createNode(153, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -5369,42 +5581,42 @@ var ts; } } function parseArgumentList() { - parseExpected(16 /* OpenParenToken */); - var result = parseDelimitedList(12 /* ArgumentExpressions */, parseArgumentExpression); - parseExpected(17 /* CloseParenToken */); + parseExpected(16); + var result = parseDelimitedList(12, parseArgumentExpression); + parseExpected(17); return result; } function parseTypeArgumentsInExpression() { - if (!parseOptional(24 /* LessThanToken */)) { + if (!parseOptional(24)) { return undefined; } - var typeArguments = parseDelimitedList(17 /* TypeArguments */, parseType); - if (!parseExpected(25 /* GreaterThanToken */)) { + var typeArguments = parseDelimitedList(17, parseType); + if (!parseExpected(25)) { return undefined; } return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined; } function canFollowTypeArgumentsInExpression() { switch (token) { - case 16 /* OpenParenToken */: - case 20 /* DotToken */: - case 17 /* CloseParenToken */: - case 19 /* CloseBracketToken */: - case 51 /* ColonToken */: - case 22 /* SemicolonToken */: - case 23 /* CommaToken */: - case 50 /* QuestionToken */: - case 28 /* EqualsEqualsToken */: - case 30 /* EqualsEqualsEqualsToken */: - case 29 /* ExclamationEqualsToken */: - case 31 /* ExclamationEqualsEqualsToken */: - case 48 /* AmpersandAmpersandToken */: - case 49 /* BarBarToken */: - case 45 /* CaretToken */: - case 43 /* AmpersandToken */: - case 44 /* BarToken */: - case 15 /* CloseBraceToken */: - case 1 /* EndOfFileToken */: + case 16: + case 20: + case 17: + case 19: + case 51: + case 22: + case 23: + case 50: + case 28: + case 30: + case 29: + case 31: + case 48: + case 49: + case 45: + case 43: + case 44: + case 15: + case 1: return true; default: return false; @@ -5412,74 +5624,71 @@ var ts; } function parsePrimaryExpression() { switch (token) { - case 7 /* NumericLiteral */: - case 8 /* StringLiteral */: - case 10 /* NoSubstitutionTemplateLiteral */: + case 7: + case 8: + case 10: return parseLiteralNode(); - case 92 /* ThisKeyword */: - case 90 /* SuperKeyword */: - case 88 /* NullKeyword */: - case 94 /* TrueKeyword */: - case 79 /* FalseKeyword */: + case 92: + case 90: + case 88: + case 94: + case 79: return parseTokenNode(); - case 16 /* OpenParenToken */: + case 16: return parseParenthesizedExpression(); - case 18 /* OpenBracketToken */: + case 18: return parseArrayLiteralExpression(); - case 14 /* OpenBraceToken */: + case 14: return parseObjectLiteralExpression(); - case 82 /* FunctionKeyword */: + case 82: return parseFunctionExpression(); - case 87 /* NewKeyword */: + case 87: return parseNewExpression(); - case 36 /* SlashToken */: - case 56 /* SlashEqualsToken */: - if (reScanSlashToken() === 9 /* RegularExpressionLiteral */) { + case 36: + case 56: + if (reScanSlashToken() === 9) { return parseLiteralNode(); } break; - case 11 /* TemplateHead */: + case 11: return parseTemplateExpression(); } return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(155 /* ParenthesizedExpression */); - parseExpected(16 /* OpenParenToken */); + var node = createNode(157); + parseExpected(16); node.expression = allowInAnd(parseExpression); - parseExpected(17 /* CloseParenToken */); + parseExpected(17); return finishNode(node); } - function parseAssignmentExpressionOrOmittedExpression() { - return token === 23 /* CommaToken */ ? createNode(168 /* OmittedExpression */) : parseAssignmentExpressionOrHigher(); - } function parseSpreadElement() { - var node = createNode(167 /* SpreadElementExpression */); - parseExpected(21 /* DotDotDotToken */); + var node = createNode(169); + parseExpected(21); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } - function parseArrayLiteralElement() { - return token === 21 /* DotDotDotToken */ ? parseSpreadElement() : parseAssignmentExpressionOrOmittedExpression(); + function parseArgumentOrArrayLiteralElement() { + return token === 21 ? parseSpreadElement() : token === 23 ? createNode(170) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { - return allowInAnd(parseAssignmentExpressionOrOmittedExpression); + return allowInAnd(parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(147 /* ArrayLiteralExpression */); - parseExpected(18 /* OpenBracketToken */); + var node = createNode(149); + parseExpected(18); if (scanner.hasPrecedingLineBreak()) - node.flags |= 256 /* MultiLine */; - node.elements = parseDelimitedList(14 /* ArrayLiteralMembers */, parseArrayLiteralElement); - parseExpected(19 /* CloseBracketToken */); + node.flags |= 256; + node.elements = parseDelimitedList(14, parseArgumentOrArrayLiteralElement); + parseExpected(19); return finishNode(node); } function tryParseAccessorDeclaration(fullStart, modifiers) { - if (parseContextualModifier(114 /* GetKeyword */)) { - return parseAccessorDeclaration(130 /* GetAccessor */, fullStart, modifiers); + if (parseContextualModifier(114)) { + return parseAccessorDeclaration(132, fullStart, modifiers); } - else if (parseContextualModifier(118 /* SetKeyword */)) { - return parseAccessorDeclaration(131 /* SetAccessor */, fullStart, modifiers); + else if (parseContextualModifier(118)) { + return parseAccessorDeclaration(133, fullStart, modifiers); } return undefined; } @@ -5490,45 +5699,45 @@ var ts; if (accessor) { return accessor; } - var asteriskToken = parseOptionalToken(35 /* AsteriskToken */); + var asteriskToken = parseOptionalToken(35); var tokenIsIdentifier = isIdentifier(); var nameToken = token; var propertyName = parsePropertyName(); - var questionToken = parseOptionalToken(50 /* QuestionToken */); - if (asteriskToken || token === 16 /* OpenParenToken */ || token === 24 /* LessThanToken */) { + var questionToken = parseOptionalToken(50); + if (asteriskToken || token === 16 || token === 24) { return parseMethodDeclaration(fullStart, modifiers, asteriskToken, propertyName, questionToken); } - if ((token === 23 /* CommaToken */ || token === 15 /* CloseBraceToken */) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(205 /* ShorthandPropertyAssignment */, fullStart); + if ((token === 23 || token === 15) && tokenIsIdentifier) { + var shorthandDeclaration = createNode(208, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(204 /* PropertyAssignment */, fullStart); + var propertyAssignment = createNode(207, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; - parseExpected(51 /* ColonToken */); + parseExpected(51); propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher); return finishNode(propertyAssignment); } } function parseObjectLiteralExpression() { - var node = createNode(148 /* ObjectLiteralExpression */); - parseExpected(14 /* OpenBraceToken */); + var node = createNode(150); + parseExpected(14); if (scanner.hasPrecedingLineBreak()) { - node.flags |= 256 /* MultiLine */; + node.flags |= 256; } - node.properties = parseDelimitedList(13 /* ObjectLiteralMembers */, parseObjectLiteralElement); - parseExpected(15 /* CloseBraceToken */); + node.properties = parseDelimitedList(13, parseObjectLiteralElement, true); + parseExpected(15); return finishNode(node); } function parseFunctionExpression() { - var node = createNode(156 /* FunctionExpression */); - parseExpected(82 /* FunctionKeyword */); - node.asteriskToken = parseOptionalToken(35 /* AsteriskToken */); + var node = createNode(158); + parseExpected(82); + node.asteriskToken = parseOptionalToken(35); node.name = node.asteriskToken ? doInYieldContext(parseOptionalIdentifier) : parseOptionalIdentifier(); - fillSignature(51 /* ColonToken */, !!node.asteriskToken, false, node); + fillSignature(51, !!node.asteriskToken, false, node); node.body = parseFunctionBlock(!!node.asteriskToken, false); return finishNode(node); } @@ -5536,20 +5745,20 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(152 /* NewExpression */); - parseExpected(87 /* NewKeyword */); + var node = createNode(154); + parseExpected(87); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); - if (node.typeArguments || token === 16 /* OpenParenToken */) { + if (node.typeArguments || token === 16) { node.arguments = parseArgumentList(); } return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, checkForStrictMode, diagnosticMessage) { - var node = createNode(170 /* Block */); - if (parseExpected(14 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { - node.statements = parseList(2 /* BlockStatements */, checkForStrictMode, parseStatement); - parseExpected(15 /* CloseBraceToken */); + var node = createNode(172); + if (parseExpected(14, diagnosticMessage) || ignoreMissingOpenBrace) { + node.statements = parseList(2, checkForStrictMode, parseStatement); + parseExpected(15); } else { node.statements = createMissingList(); @@ -5564,81 +5773,88 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(172 /* EmptyStatement */); - parseExpected(22 /* SemicolonToken */); + var node = createNode(174); + parseExpected(22); return finishNode(node); } function parseIfStatement() { - var node = createNode(174 /* IfStatement */); - parseExpected(83 /* IfKeyword */); - parseExpected(16 /* OpenParenToken */); + var node = createNode(176); + parseExpected(83); + parseExpected(16); node.expression = allowInAnd(parseExpression); - parseExpected(17 /* CloseParenToken */); + parseExpected(17); node.thenStatement = parseStatement(); - node.elseStatement = parseOptional(75 /* ElseKeyword */) ? parseStatement() : undefined; + node.elseStatement = parseOptional(75) ? parseStatement() : undefined; return finishNode(node); } function parseDoStatement() { - var node = createNode(175 /* DoStatement */); - parseExpected(74 /* DoKeyword */); + var node = createNode(177); + parseExpected(74); node.statement = parseStatement(); - parseExpected(99 /* WhileKeyword */); - parseExpected(16 /* OpenParenToken */); + parseExpected(99); + parseExpected(16); node.expression = allowInAnd(parseExpression); - parseExpected(17 /* CloseParenToken */); - parseOptional(22 /* SemicolonToken */); + parseExpected(17); + parseOptional(22); return finishNode(node); } function parseWhileStatement() { - var node = createNode(176 /* WhileStatement */); - parseExpected(99 /* WhileKeyword */); - parseExpected(16 /* OpenParenToken */); + var node = createNode(178); + parseExpected(99); + parseExpected(16); node.expression = allowInAnd(parseExpression); - parseExpected(17 /* CloseParenToken */); + parseExpected(17); node.statement = parseStatement(); return finishNode(node); } - function parseForOrForInStatement() { + function parseForOrForInOrForOfStatement() { var pos = getNodePos(); - parseExpected(81 /* ForKeyword */); - parseExpected(16 /* OpenParenToken */); + parseExpected(81); + parseExpected(16); var initializer = undefined; - if (token !== 22 /* SemicolonToken */) { - if (token === 97 /* VarKeyword */ || token === 103 /* LetKeyword */ || token === 69 /* ConstKeyword */) { + if (token !== 22) { + if (token === 97 || token === 103 || token === 69) { initializer = parseVariableDeclarationList(true); } else { initializer = disallowInAnd(parseExpression); } } - var forOrForInStatement; - if (parseOptional(85 /* InKeyword */)) { - var forInStatement = createNode(178 /* ForInStatement */, pos); + var forOrForInOrForOfStatement; + if (parseOptional(85)) { + var forInStatement = createNode(180, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); - parseExpected(17 /* CloseParenToken */); - forOrForInStatement = forInStatement; + parseExpected(17); + forOrForInOrForOfStatement = forInStatement; + } + else if (parseOptional(122)) { + var forOfStatement = createNode(181, pos); + forOfStatement.initializer = initializer; + forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); + parseExpected(17); + forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(177 /* ForStatement */, pos); + var forStatement = createNode(179, pos); forStatement.initializer = initializer; - parseExpected(22 /* SemicolonToken */); - if (token !== 22 /* SemicolonToken */ && token !== 17 /* CloseParenToken */) { + parseExpected(22); + if (token !== 22 && token !== 17) { forStatement.condition = allowInAnd(parseExpression); } - parseExpected(22 /* SemicolonToken */); - if (token !== 17 /* CloseParenToken */) { + parseExpected(22); + if (token !== 17) { forStatement.iterator = allowInAnd(parseExpression); } - parseExpected(17 /* CloseParenToken */); - forOrForInStatement = forStatement; + parseExpected(17); + forOrForInOrForOfStatement = forStatement; } - forOrForInStatement.statement = parseStatement(); - return finishNode(forOrForInStatement); + forOrForInOrForOfStatement.statement = parseStatement(); + return finishNode(forOrForInOrForOfStatement); } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 180 /* BreakStatement */ ? 65 /* BreakKeyword */ : 70 /* ContinueKeyword */); + parseExpected(kind === 183 ? 65 : 70); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -5646,8 +5862,8 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(181 /* ReturnStatement */); - parseExpected(89 /* ReturnKeyword */); + var node = createNode(184); + parseExpected(89); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); } @@ -5655,88 +5871,88 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(182 /* WithStatement */); - parseExpected(100 /* WithKeyword */); - parseExpected(16 /* OpenParenToken */); + var node = createNode(185); + parseExpected(100); + parseExpected(16); node.expression = allowInAnd(parseExpression); - parseExpected(17 /* CloseParenToken */); + parseExpected(17); node.statement = parseStatement(); return finishNode(node); } function parseCaseClause() { - var node = createNode(200 /* CaseClause */); - parseExpected(66 /* CaseKeyword */); + var node = createNode(203); + parseExpected(66); node.expression = allowInAnd(parseExpression); - parseExpected(51 /* ColonToken */); - node.statements = parseList(4 /* SwitchClauseStatements */, false, parseStatement); + parseExpected(51); + node.statements = parseList(4, false, parseStatement); return finishNode(node); } function parseDefaultClause() { - var node = createNode(201 /* DefaultClause */); - parseExpected(72 /* DefaultKeyword */); - parseExpected(51 /* ColonToken */); - node.statements = parseList(4 /* SwitchClauseStatements */, false, parseStatement); + var node = createNode(204); + parseExpected(72); + parseExpected(51); + node.statements = parseList(4, false, parseStatement); return finishNode(node); } function parseCaseOrDefaultClause() { - return token === 66 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); + return token === 66 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(183 /* SwitchStatement */); - parseExpected(91 /* SwitchKeyword */); - parseExpected(16 /* OpenParenToken */); + var node = createNode(186); + parseExpected(91); + parseExpected(16); node.expression = allowInAnd(parseExpression); - parseExpected(17 /* CloseParenToken */); - parseExpected(14 /* OpenBraceToken */); - node.clauses = parseList(3 /* SwitchClauses */, false, parseCaseOrDefaultClause); - parseExpected(15 /* CloseBraceToken */); + parseExpected(17); + parseExpected(14); + node.clauses = parseList(3, false, parseCaseOrDefaultClause); + parseExpected(15); return finishNode(node); } function parseThrowStatement() { - var node = createNode(185 /* ThrowStatement */); - parseExpected(93 /* ThrowKeyword */); + var node = createNode(188); + parseExpected(93); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(186 /* TryStatement */); - parseExpected(95 /* TryKeyword */); + var node = createNode(189); + parseExpected(95); node.tryBlock = parseBlock(false, false); - node.catchClause = token === 67 /* CatchKeyword */ ? parseCatchClause() : undefined; - if (!node.catchClause || token === 80 /* FinallyKeyword */) { - parseExpected(80 /* FinallyKeyword */); + node.catchClause = token === 67 ? parseCatchClause() : undefined; + if (!node.catchClause || token === 80) { + parseExpected(80); node.finallyBlock = parseBlock(false, false); } return finishNode(node); } function parseCatchClause() { - var result = createNode(203 /* CatchClause */); - parseExpected(67 /* CatchKeyword */); - parseExpected(16 /* OpenParenToken */); + var result = createNode(206); + parseExpected(67); + parseExpected(16); result.name = parseIdentifier(); result.type = parseTypeAnnotation(); - parseExpected(17 /* CloseParenToken */); + parseExpected(17); result.block = parseBlock(false, false); return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(187 /* DebuggerStatement */); - parseExpected(71 /* DebuggerKeyword */); + var node = createNode(190); + parseExpected(71); parseSemicolon(); return finishNode(node); } function parseExpressionOrLabeledStatement() { var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); - if (expression.kind === 64 /* Identifier */ && parseOptional(51 /* ColonToken */)) { - var labeledStatement = createNode(184 /* LabeledStatement */, fullStart); + if (expression.kind === 64 && parseOptional(51)) { + var labeledStatement = createNode(187, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(173 /* ExpressionStatement */, fullStart); + var expressionStatement = createNode(175, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); @@ -5750,42 +5966,42 @@ var ts; } } switch (token) { - case 22 /* SemicolonToken */: + case 22: return !inErrorRecovery; - case 14 /* OpenBraceToken */: - case 97 /* VarKeyword */: - case 103 /* LetKeyword */: - case 82 /* FunctionKeyword */: - case 83 /* IfKeyword */: - case 74 /* DoKeyword */: - case 99 /* WhileKeyword */: - case 81 /* ForKeyword */: - case 70 /* ContinueKeyword */: - case 65 /* BreakKeyword */: - case 89 /* ReturnKeyword */: - case 100 /* WithKeyword */: - case 91 /* SwitchKeyword */: - case 93 /* ThrowKeyword */: - case 95 /* TryKeyword */: - case 71 /* DebuggerKeyword */: - case 67 /* CatchKeyword */: - case 80 /* FinallyKeyword */: + case 14: + case 97: + case 103: + case 82: + case 83: + case 74: + case 99: + case 81: + case 70: + case 65: + case 89: + case 100: + case 91: + case 93: + case 95: + case 71: + case 67: + case 80: return true; - case 69 /* ConstKeyword */: + case 69: var isConstEnum = lookAhead(nextTokenIsEnumKeyword); return !isConstEnum; - case 102 /* InterfaceKeyword */: - case 68 /* ClassKeyword */: - case 115 /* ModuleKeyword */: - case 76 /* EnumKeyword */: - case 120 /* TypeKeyword */: + case 102: + case 68: + case 115: + case 76: + case 121: if (isDeclarationStart()) { return false; } - case 107 /* PublicKeyword */: - case 105 /* PrivateKeyword */: - case 106 /* ProtectedKeyword */: - case 108 /* StaticKeyword */: + case 107: + case 105: + case 106: + case 108: if (lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine)) { return false; } @@ -5795,7 +6011,7 @@ var ts; } function nextTokenIsEnumKeyword() { nextToken(); - return token === 76 /* EnumKeyword */; + return token === 76; } function nextTokenIsIdentifierOrKeywordOnSameLine() { nextToken(); @@ -5803,42 +6019,42 @@ var ts; } function parseStatement() { switch (token) { - case 14 /* OpenBraceToken */: + case 14: return parseBlock(false, false); - case 97 /* VarKeyword */: - case 69 /* ConstKeyword */: + case 97: + case 69: return parseVariableStatement(scanner.getStartPos(), undefined); - case 82 /* FunctionKeyword */: + case 82: return parseFunctionDeclaration(scanner.getStartPos(), undefined); - case 22 /* SemicolonToken */: + case 22: return parseEmptyStatement(); - case 83 /* IfKeyword */: + case 83: return parseIfStatement(); - case 74 /* DoKeyword */: + case 74: return parseDoStatement(); - case 99 /* WhileKeyword */: + case 99: return parseWhileStatement(); - case 81 /* ForKeyword */: - return parseForOrForInStatement(); - case 70 /* ContinueKeyword */: - return parseBreakOrContinueStatement(179 /* ContinueStatement */); - case 65 /* BreakKeyword */: - return parseBreakOrContinueStatement(180 /* BreakStatement */); - case 89 /* ReturnKeyword */: + case 81: + return parseForOrForInOrForOfStatement(); + case 70: + return parseBreakOrContinueStatement(182); + case 65: + return parseBreakOrContinueStatement(183); + case 89: return parseReturnStatement(); - case 100 /* WithKeyword */: + case 100: return parseWithStatement(); - case 91 /* SwitchKeyword */: + case 91: return parseSwitchStatement(); - case 93 /* ThrowKeyword */: + case 93: return parseThrowStatement(); - case 95 /* TryKeyword */: - case 67 /* CatchKeyword */: - case 80 /* FinallyKeyword */: + case 95: + case 67: + case 80: return parseTryStatement(); - case 71 /* DebuggerKeyword */: + case 71: return parseDebuggerStatement(); - case 103 /* LetKeyword */: + case 103: if (isLetDeclaration()) { return parseVariableStatement(scanner.getStartPos(), undefined); } @@ -5856,49 +6072,49 @@ var ts; var start = scanner.getStartPos(); var modifiers = parseModifiers(); switch (token) { - case 69 /* ConstKeyword */: + case 69: var nextTokenIsEnum = lookAhead(nextTokenIsEnumKeyword); if (nextTokenIsEnum) { return undefined; } return parseVariableStatement(start, modifiers); - case 103 /* LetKeyword */: + case 103: if (!isLetDeclaration()) { return undefined; } return parseVariableStatement(start, modifiers); - case 97 /* VarKeyword */: + case 97: return parseVariableStatement(start, modifiers); - case 82 /* FunctionKeyword */: + case 82: return parseFunctionDeclaration(start, modifiers); } return undefined; } function parseFunctionBlockOrSemicolon(isGenerator, diagnosticMessage) { - if (token !== 14 /* OpenBraceToken */ && canParseSemicolon()) { + if (token !== 14 && canParseSemicolon()) { parseSemicolon(); return; } return parseFunctionBlock(isGenerator, false, diagnosticMessage); } function parseArrayBindingElement() { - if (token === 23 /* CommaToken */) { - return createNode(168 /* OmittedExpression */); + if (token === 23) { + return createNode(170); } - var node = createNode(146 /* BindingElement */); - node.dotDotDotToken = parseOptionalToken(21 /* DotDotDotToken */); + var node = createNode(148); + node.dotDotDotToken = parseOptionalToken(21); node.name = parseIdentifierOrPattern(); node.initializer = parseInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(146 /* BindingElement */); + var node = createNode(148); var id = parsePropertyName(); - if (id.kind === 64 /* Identifier */ && token !== 51 /* ColonToken */) { + if (id.kind === 64 && token !== 51) { node.name = id; } else { - parseExpected(51 /* ColonToken */); + parseExpected(51); node.propertyName = id; node.name = parseIdentifierOrPattern(); } @@ -5906,103 +6122,113 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(144 /* ObjectBindingPattern */); - parseExpected(14 /* OpenBraceToken */); - node.elements = parseDelimitedList(10 /* ObjectBindingElements */, parseObjectBindingElement); - parseExpected(15 /* CloseBraceToken */); + var node = createNode(146); + parseExpected(14); + node.elements = parseDelimitedList(10, parseObjectBindingElement); + parseExpected(15); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(145 /* ArrayBindingPattern */); - parseExpected(18 /* OpenBracketToken */); - node.elements = parseDelimitedList(11 /* ArrayBindingElements */, parseArrayBindingElement); - parseExpected(19 /* CloseBracketToken */); + var node = createNode(147); + parseExpected(18); + node.elements = parseDelimitedList(11, parseArrayBindingElement); + parseExpected(19); return finishNode(node); } function isIdentifierOrPattern() { - return token === 14 /* OpenBraceToken */ || token === 18 /* OpenBracketToken */ || isIdentifier(); + return token === 14 || token === 18 || isIdentifier(); } function parseIdentifierOrPattern() { - if (token === 18 /* OpenBracketToken */) { + if (token === 18) { return parseArrayBindingPattern(); } - if (token === 14 /* OpenBraceToken */) { + if (token === 14) { return parseObjectBindingPattern(); } return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(188 /* VariableDeclaration */); + var node = createNode(191); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); - node.initializer = parseInitializer(false); + if (!isInOrOfKeyword(token)) { + node.initializer = parseInitializer(false); + } return finishNode(node); } - function parseVariableDeclarationList(disallowIn) { - var node = createNode(189 /* VariableDeclarationList */); + function parseVariableDeclarationList(inForStatementInitializer) { + var node = createNode(192); switch (token) { - case 97 /* VarKeyword */: + case 97: break; - case 103 /* LetKeyword */: - node.flags |= 2048 /* Let */; + case 103: + node.flags |= 2048; break; - case 69 /* ConstKeyword */: - node.flags |= 4096 /* Const */; + case 69: + node.flags |= 4096; break; default: ts.Debug.fail(); } nextToken(); - var savedDisallowIn = inDisallowInContext(); - setDisallowInContext(disallowIn); - node.declarations = parseDelimitedList(9 /* VariableDeclarations */, parseVariableDeclaration); - setDisallowInContext(savedDisallowIn); + if (token === 122 && lookAhead(canFollowContextualOfKeyword)) { + node.declarations = createMissingList(); + } + else { + var savedDisallowIn = inDisallowInContext(); + setDisallowInContext(inForStatementInitializer); + node.declarations = parseDelimitedList(9, parseVariableDeclaration); + setDisallowInContext(savedDisallowIn); + } return finishNode(node); } + function canFollowContextualOfKeyword() { + return nextTokenIsIdentifier() && nextToken() === 17; + } function parseVariableStatement(fullStart, modifiers) { - var node = createNode(171 /* VariableStatement */, fullStart); + var node = createNode(173, fullStart); setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); parseSemicolon(); return finishNode(node); } function parseFunctionDeclaration(fullStart, modifiers) { - var node = createNode(190 /* FunctionDeclaration */, fullStart); + var node = createNode(193, fullStart); setModifiers(node, modifiers); - parseExpected(82 /* FunctionKeyword */); - node.asteriskToken = parseOptionalToken(35 /* AsteriskToken */); + parseExpected(82); + node.asteriskToken = parseOptionalToken(35); node.name = parseIdentifier(); - fillSignature(51 /* ColonToken */, !!node.asteriskToken, false, node); + fillSignature(51, !!node.asteriskToken, false, node); node.body = parseFunctionBlockOrSemicolon(!!node.asteriskToken, ts.Diagnostics.or_expected); return finishNode(node); } function parseConstructorDeclaration(pos, modifiers) { - var node = createNode(129 /* Constructor */, pos); + var node = createNode(131, pos); setModifiers(node, modifiers); - parseExpected(112 /* ConstructorKeyword */); - fillSignature(51 /* ColonToken */, false, false, node); + parseExpected(112); + fillSignature(51, false, false, node); node.body = parseFunctionBlockOrSemicolon(false, ts.Diagnostics.or_expected); return finishNode(node); } function parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(128 /* MethodDeclaration */, fullStart); + var method = createNode(130, fullStart); setModifiers(method, modifiers); method.asteriskToken = asteriskToken; method.name = name; method.questionToken = questionToken; - fillSignature(51 /* ColonToken */, !!asteriskToken, false, method); + fillSignature(51, !!asteriskToken, false, method); method.body = parseFunctionBlockOrSemicolon(!!asteriskToken, diagnosticMessage); return finishNode(method); } function parsePropertyOrMethodDeclaration(fullStart, modifiers) { - var asteriskToken = parseOptionalToken(35 /* AsteriskToken */); + var asteriskToken = parseOptionalToken(35); var name = parsePropertyName(); - var questionToken = parseOptionalToken(50 /* QuestionToken */); - if (asteriskToken || token === 16 /* OpenParenToken */ || token === 24 /* LessThanToken */) { + var questionToken = parseOptionalToken(50); + if (asteriskToken || token === 16 || token === 24) { return parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); } else { - var property = createNode(126 /* PropertyDeclaration */, fullStart); + var property = createNode(128, fullStart); setModifiers(property, modifiers); property.name = name; property.questionToken = questionToken; @@ -6019,7 +6245,7 @@ var ts; var node = createNode(kind, fullStart); setModifiers(node, modifiers); node.name = parsePropertyName(); - fillSignature(51 /* ColonToken */, false, false, node); + fillSignature(51, false, false, node); node.body = parseFunctionBlockOrSemicolon(false); return finishNode(node); } @@ -6029,26 +6255,26 @@ var ts; idToken = token; nextToken(); } - if (token === 35 /* AsteriskToken */) { + if (token === 35) { return true; } if (isLiteralPropertyName()) { idToken = token; nextToken(); } - if (token === 18 /* OpenBracketToken */) { + if (token === 18) { return true; } if (idToken !== undefined) { - if (!ts.isKeyword(idToken) || idToken === 118 /* SetKeyword */ || idToken === 114 /* GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 118 || idToken === 114) { return true; } switch (token) { - case 16 /* OpenParenToken */: - case 24 /* LessThanToken */: - case 51 /* ColonToken */: - case 52 /* EqualsToken */: - case 50 /* QuestionToken */: + case 16: + case 24: + case 51: + case 52: + case 50: return true; default: return canParseSemicolon(); @@ -6085,27 +6311,31 @@ var ts; if (accessor) { return accessor; } - if (token === 112 /* ConstructorKeyword */) { + if (token === 112) { return parseConstructorDeclaration(fullStart, modifiers); } if (isIndexSignature()) { return parseIndexSignatureDeclaration(modifiers); } - if (isIdentifierOrKeyword() || token === 8 /* StringLiteral */ || token === 7 /* NumericLiteral */ || token === 35 /* AsteriskToken */ || token === 18 /* OpenBracketToken */) { + if (isIdentifierOrKeyword() || + token === 8 || + token === 7 || + token === 35 || + token === 18) { return parsePropertyOrMethodDeclaration(fullStart, modifiers); } ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassDeclaration(fullStart, modifiers) { - var node = createNode(191 /* ClassDeclaration */, fullStart); + var node = createNode(194, fullStart); setModifiers(node, modifiers); - parseExpected(68 /* ClassKeyword */); + parseExpected(68); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(true); - if (parseExpected(14 /* OpenBraceToken */)) { + if (parseExpected(14)) { node.members = inGeneratorParameterContext() ? doOutsideOfYieldContext(parseClassMembers) : parseClassMembers(); - parseExpected(15 /* CloseBraceToken */); + parseExpected(15); } else { node.members = createMissingList(); @@ -6119,28 +6349,28 @@ var ts; return undefined; } function parseHeritageClausesWorker() { - return parseList(19 /* HeritageClauses */, false, parseHeritageClause); + return parseList(19, false, parseHeritageClause); } function parseHeritageClause() { - if (token === 78 /* ExtendsKeyword */ || token === 101 /* ImplementsKeyword */) { - var node = createNode(202 /* HeritageClause */); + if (token === 78 || token === 101) { + var node = createNode(205); node.token = token; nextToken(); - node.types = parseDelimitedList(8 /* TypeReferences */, parseTypeReference); + node.types = parseDelimitedList(8, parseTypeReference); return finishNode(node); } return undefined; } function isHeritageClause() { - return token === 78 /* ExtendsKeyword */ || token === 101 /* ImplementsKeyword */; + return token === 78 || token === 101; } function parseClassMembers() { - return parseList(6 /* ClassMembers */, false, parseClassElement); + return parseList(6, false, parseClassElement); } function parseInterfaceDeclaration(fullStart, modifiers) { - var node = createNode(192 /* InterfaceDeclaration */, fullStart); + var node = createNode(195, fullStart); setModifiers(node, modifiers); - parseExpected(102 /* InterfaceKeyword */); + parseExpected(102); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(false); @@ -6148,29 +6378,29 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, modifiers) { - var node = createNode(193 /* TypeAliasDeclaration */, fullStart); + var node = createNode(196, fullStart); setModifiers(node, modifiers); - parseExpected(120 /* TypeKeyword */); + parseExpected(121); node.name = parseIdentifier(); - parseExpected(52 /* EqualsToken */); + parseExpected(52); node.type = parseType(); parseSemicolon(); return finishNode(node); } function parseEnumMember() { - var node = createNode(206 /* EnumMember */, scanner.getStartPos()); + var node = createNode(209, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, modifiers) { - var node = createNode(194 /* EnumDeclaration */, fullStart); + var node = createNode(197, fullStart); setModifiers(node, modifiers); - parseExpected(76 /* EnumKeyword */); + parseExpected(76); node.name = parseIdentifier(); - if (parseExpected(14 /* OpenBraceToken */)) { - node.members = parseDelimitedList(7 /* EnumMembers */, parseEnumMember); - parseExpected(15 /* CloseBraceToken */); + if (parseExpected(14)) { + node.members = parseDelimitedList(7, parseEnumMember); + parseExpected(15); } else { node.members = createMissingList(); @@ -6178,10 +6408,10 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(196 /* ModuleBlock */, scanner.getStartPos()); - if (parseExpected(14 /* OpenBraceToken */)) { - node.statements = parseList(1 /* ModuleElements */, false, parseModuleElement); - parseExpected(15 /* CloseBraceToken */); + var node = createNode(199, scanner.getStartPos()); + if (parseExpected(14)) { + node.statements = parseList(1, false, parseModuleElement); + parseExpected(15); } else { node.statements = createMissingList(); @@ -6189,36 +6419,37 @@ var ts; return finishNode(node); } function parseInternalModuleTail(fullStart, modifiers, flags) { - var node = createNode(195 /* ModuleDeclaration */, fullStart); + var node = createNode(198, fullStart); setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); - node.body = parseOptional(20 /* DotToken */) ? parseInternalModuleTail(getNodePos(), undefined, 1 /* Export */) : parseModuleBlock(); + node.body = parseOptional(20) ? parseInternalModuleTail(getNodePos(), undefined, 1) : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, modifiers) { - var node = createNode(195 /* ModuleDeclaration */, fullStart); + var node = createNode(198, fullStart); setModifiers(node, modifiers); node.name = parseLiteralNode(true); node.body = parseModuleBlock(); return finishNode(node); } function parseModuleDeclaration(fullStart, modifiers) { - parseExpected(115 /* ModuleKeyword */); - return token === 8 /* StringLiteral */ ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); + parseExpected(115); + return token === 8 ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); } function isExternalModuleReference() { - return token === 116 /* RequireKeyword */ && lookAhead(nextTokenIsOpenParen); + return token === 116 && + lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { - return nextToken() === 16 /* OpenParenToken */; + return nextToken() === 16; } function parseImportDeclaration(fullStart, modifiers) { - var node = createNode(197 /* ImportDeclaration */, fullStart); + var node = createNode(200, fullStart); setModifiers(node, modifiers); - parseExpected(84 /* ImportKeyword */); + parseExpected(84); node.name = parseIdentifier(); - parseExpected(52 /* EqualsToken */); + parseExpected(52); node.moduleReference = parseModuleReference(); parseSemicolon(); return finishNode(node); @@ -6227,18 +6458,18 @@ var ts; return isExternalModuleReference() ? parseExternalModuleReference() : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(199 /* ExternalModuleReference */); - parseExpected(116 /* RequireKeyword */); - parseExpected(16 /* OpenParenToken */); + var node = createNode(202); + parseExpected(116); + parseExpected(16); node.expression = parseExpression(); - if (node.expression.kind === 8 /* StringLiteral */) { + if (node.expression.kind === 8) { internIdentifier(node.expression.text); } - parseExpected(17 /* CloseParenToken */); + parseExpected(17); return finishNode(node); } function parseExportAssignmentTail(fullStart, modifiers) { - var node = createNode(198 /* ExportAssignment */, fullStart); + var node = createNode(201, fullStart); setModifiers(node, modifiers); node.exportName = parseIdentifier(); parseSemicolon(); @@ -6249,32 +6480,32 @@ var ts; } function isDeclarationStart() { switch (token) { - case 97 /* VarKeyword */: - case 69 /* ConstKeyword */: - case 82 /* FunctionKeyword */: + case 97: + case 69: + case 82: return true; - case 103 /* LetKeyword */: + case 103: return isLetDeclaration(); - case 68 /* ClassKeyword */: - case 102 /* InterfaceKeyword */: - case 76 /* EnumKeyword */: - case 84 /* ImportKeyword */: - case 120 /* TypeKeyword */: + case 68: + case 102: + case 76: + case 84: + case 121: return lookAhead(nextTokenIsIdentifierOrKeyword); - case 115 /* ModuleKeyword */: + case 115: return lookAhead(nextTokenIsIdentifierOrKeywordOrStringLiteral); - case 77 /* ExportKeyword */: + case 77: return lookAhead(nextTokenIsEqualsTokenOrDeclarationStart); - case 113 /* DeclareKeyword */: - case 107 /* PublicKeyword */: - case 105 /* PrivateKeyword */: - case 106 /* ProtectedKeyword */: - case 108 /* StaticKeyword */: + case 113: + case 107: + case 105: + case 106: + case 108: return lookAhead(nextTokenIsDeclarationStart); } } function isIdentifierOrKeyword() { - return token >= 64 /* Identifier */; + return token >= 64; } function nextTokenIsIdentifierOrKeyword() { nextToken(); @@ -6282,11 +6513,11 @@ var ts; } function nextTokenIsIdentifierOrKeywordOrStringLiteral() { nextToken(); - return isIdentifierOrKeyword() || token === 8 /* StringLiteral */; + return isIdentifierOrKeyword() || token === 8; } function nextTokenIsEqualsTokenOrDeclarationStart() { nextToken(); - return token === 52 /* EqualsToken */ || isDeclarationStart(); + return token === 52 || isDeclarationStart(); } function nextTokenIsDeclarationStart() { nextToken(); @@ -6295,30 +6526,30 @@ var ts; function parseDeclaration() { var fullStart = getNodePos(); var modifiers = parseModifiers(); - if (token === 77 /* ExportKeyword */) { + if (token === 77) { nextToken(); - if (parseOptional(52 /* EqualsToken */)) { + if (parseOptional(52)) { return parseExportAssignmentTail(fullStart, modifiers); } } switch (token) { - case 97 /* VarKeyword */: - case 103 /* LetKeyword */: - case 69 /* ConstKeyword */: + case 97: + case 103: + case 69: return parseVariableStatement(fullStart, modifiers); - case 82 /* FunctionKeyword */: + case 82: return parseFunctionDeclaration(fullStart, modifiers); - case 68 /* ClassKeyword */: + case 68: return parseClassDeclaration(fullStart, modifiers); - case 102 /* InterfaceKeyword */: + case 102: return parseInterfaceDeclaration(fullStart, modifiers); - case 120 /* TypeKeyword */: + case 121: return parseTypeAliasDeclaration(fullStart, modifiers); - case 76 /* EnumKeyword */: + case 76: return parseEnumDeclaration(fullStart, modifiers); - case 115 /* ModuleKeyword */: + case 115: return parseModuleDeclaration(fullStart, modifiers); - case 84 /* ImportKeyword */: + case 84: return parseImportDeclaration(fullStart, modifiers); default: ts.Debug.fail("Mismatch between isDeclarationStart and parseDeclaration"); @@ -6343,10 +6574,10 @@ var ts; var amdModuleName; while (true) { var kind = triviaScanner.scan(); - if (kind === 5 /* WhitespaceTrivia */ || kind === 4 /* NewLineTrivia */ || kind === 3 /* MultiLineCommentTrivia */) { + if (kind === 5 || kind === 4 || kind === 3) { continue; } - if (kind !== 2 /* SingleLineCommentTrivia */) { + if (kind !== 2) { break; } var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos() }; @@ -6372,10 +6603,17 @@ var ts; } amdModuleName = amdModuleNameMatchResult[2]; } - var amdDependencyRegEx = /^\/\/\/\s*= 52 /* FirstAssignment */ && token <= 63 /* LastAssignment */; + return token >= 52 && token <= 63; } ts.isAssignmentOperator = isAssignmentOperator; })(ts || (ts = {})); @@ -6425,43 +6665,39 @@ var ts; (function (ts) { ts.bindTime = 0; function getModuleInstanceState(node) { - if (node.kind === 192 /* InterfaceDeclaration */ || node.kind === 193 /* TypeAliasDeclaration */) { - return 0 /* NonInstantiated */; + if (node.kind === 195 || node.kind === 196) { + return 0; } else if (ts.isConstEnumDeclaration(node)) { - return 2 /* ConstEnumOnly */; + return 2; } - else if (node.kind === 197 /* ImportDeclaration */ && !(node.flags & 1 /* Export */)) { - return 0 /* NonInstantiated */; + else if (node.kind === 200 && !(node.flags & 1)) { + return 0; } - else if (node.kind === 196 /* ModuleBlock */) { - var state = 0 /* NonInstantiated */; + else if (node.kind === 199) { + var state = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { - case 0 /* NonInstantiated */: + case 0: return false; - case 2 /* ConstEnumOnly */: - state = 2 /* ConstEnumOnly */; + case 2: + state = 2; return false; - case 1 /* Instantiated */: - state = 1 /* Instantiated */; + case 1: + state = 1; return true; } }); return state; } - else if (node.kind === 195 /* ModuleDeclaration */) { + else if (node.kind === 198) { return getModuleInstanceState(node.body); } else { - return 1 /* Instantiated */; + return 1; } } ts.getModuleInstanceState = getModuleInstanceState; - function hasDynamicName(declaration) { - return declaration.name && declaration.name.kind === 122 /* ComputedPropertyName */; - } - ts.hasDynamicName = hasDynamicName; function bindSourceFile(file) { var start = new Date().getTime(); bindSourceFileWorker(file); @@ -6490,32 +6726,36 @@ var ts; if (!symbol.declarations) symbol.declarations = []; symbol.declarations.push(node); - if (symbolKind & 1952 /* HasExports */ && !symbol.exports) + if (symbolKind & 1952 && !symbol.exports) symbol.exports = {}; - if (symbolKind & 6240 /* HasMembers */ && !symbol.members) + if (symbolKind & 6240 && !symbol.members) symbol.members = {}; node.symbol = symbol; - if (symbolKind & 107455 /* Value */ && !symbol.valueDeclaration) + if (symbolKind & 107455 && !symbol.valueDeclaration) symbol.valueDeclaration = node; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 195 /* ModuleDeclaration */ && node.name.kind === 8 /* StringLiteral */) { + if (node.kind === 198 && node.name.kind === 8) { return '"' + node.name.text + '"'; } - ts.Debug.assert(!hasDynamicName(node)); + if (node.name.kind === 124) { + 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 137 /* ConstructorType */: - case 129 /* Constructor */: + case 139: + case 131: return "__constructor"; - case 136 /* FunctionType */: - case 132 /* CallSignature */: + case 138: + case 134: return "__call"; - case 133 /* ConstructSignature */: + case 135: return "__new"; - case 134 /* IndexSignature */: + case 136: return "__index"; } } @@ -6523,7 +6763,7 @@ var ts; return node.name ? ts.declarationNameToString(node.name) : getDeclarationName(node); } function declareSymbol(symbols, parent, node, includes, excludes) { - ts.Debug.assert(!hasDynamicName(node)); + ts.Debug.assert(!ts.hasDynamicName(node)); var name = getDeclarationName(node); if (name !== undefined) { var symbol = ts.hasProperty(symbols, name) ? symbols[name] : (symbols[name] = createSymbol(0, name)); @@ -6531,7 +6771,7 @@ var ts; if (node.name) { node.name.parent = node; } - var message = symbol.flags & 2 /* BlockScopedVariable */ ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + var message = symbol.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(symbol.declarations, function (declaration) { file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name, message, getDisplayName(declaration))); }); @@ -6544,8 +6784,8 @@ var ts; } addDeclarationToSymbol(symbol, node, includes); symbol.parent = parent; - if (node.kind === 191 /* ClassDeclaration */ && symbol.exports) { - var prototypeSymbol = createSymbol(4 /* Property */ | 134217728 /* Prototype */, "prototype"); + if (node.kind === 194 && symbol.exports) { + var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { if (node.name) { node.name.parent = node; @@ -6559,7 +6799,7 @@ var ts; } function isAmbientContext(node) { while (node) { - if (node.flags & 2 /* Ambient */) + if (node.flags & 2) return true; node = node.parent; } @@ -6567,16 +6807,16 @@ var ts; } function declareModuleMember(node, symbolKind, symbolExcludes) { var exportKind = 0; - if (symbolKind & 107455 /* Value */) { - exportKind |= 1048576 /* ExportValue */; + if (symbolKind & 107455) { + exportKind |= 1048576; } - if (symbolKind & 793056 /* Type */) { - exportKind |= 2097152 /* ExportType */; + if (symbolKind & 793056) { + exportKind |= 2097152; } - if (symbolKind & 1536 /* Namespace */) { - exportKind |= 4194304 /* ExportNamespace */; + if (symbolKind & 1536) { + exportKind |= 4194304; } - if (ts.getCombinedNodeFlags(node) & 1 /* Export */ || (node.kind !== 197 /* ImportDeclaration */ && isAmbientContext(container))) { + if (ts.getCombinedNodeFlags(node) & 1 || (node.kind !== 200 && isAmbientContext(container))) { if (exportKind) { var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); @@ -6591,14 +6831,14 @@ var ts; } } function bindChildren(node, symbolKind, isBlockScopeContainer) { - if (symbolKind & 255504 /* HasLocals */) { + if (symbolKind & 255504) { node.locals = {}; } var saveParent = parent; var saveContainer = container; var savedBlockScopeContainer = blockScopeContainer; parent = node; - if (symbolKind & 262128 /* IsContainer */) { + if (symbolKind & 262128) { container = node; if (lastContainer) { lastContainer.nextContainer = container; @@ -6615,57 +6855,57 @@ var ts; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { switch (container.kind) { - case 195 /* ModuleDeclaration */: + case 198: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 207 /* SourceFile */: + case 210: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; } - case 136 /* FunctionType */: - case 137 /* ConstructorType */: - case 132 /* CallSignature */: - case 133 /* ConstructSignature */: - case 134 /* IndexSignature */: - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: - case 129 /* Constructor */: - case 130 /* GetAccessor */: - case 131 /* SetAccessor */: - case 190 /* FunctionDeclaration */: - case 156 /* FunctionExpression */: - case 157 /* ArrowFunction */: + case 138: + case 139: + case 134: + case 135: + case 136: + case 130: + case 129: + case 131: + case 132: + case 133: + case 193: + case 158: + case 159: declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); break; - case 191 /* ClassDeclaration */: - if (node.flags & 128 /* Static */) { + case 194: + if (node.flags & 128) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } - case 139 /* TypeLiteral */: - case 148 /* ObjectLiteralExpression */: - case 192 /* InterfaceDeclaration */: + case 141: + case 150: + case 195: declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); break; - case 194 /* EnumDeclaration */: + case 197: declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } bindChildren(node, symbolKind, isBlockScopeContainer); } function bindModuleDeclaration(node) { - if (node.name.kind === 8 /* StringLiteral */) { - bindDeclaration(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */, true); + if (node.name.kind === 8) { + bindDeclaration(node, 512, 106639, true); } else { var state = getModuleInstanceState(node); - if (state === 0 /* NonInstantiated */) { - bindDeclaration(node, 1024 /* NamespaceModule */, 0 /* NamespaceModuleExcludes */, true); + if (state === 0) { + bindDeclaration(node, 1024, 0, true); } else { - bindDeclaration(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */, true); - if (state === 2 /* ConstEnumOnly */) { + bindDeclaration(node, 512, 106639, true); + if (state === 2) { node.symbol.constEnumOnlyModule = true; } else if (node.symbol.constEnumOnlyModule) { @@ -6675,13 +6915,13 @@ var ts; } } function bindFunctionOrConstructorType(node) { - var symbol = createSymbol(131072 /* Signature */, getDeclarationName(node)); - addDeclarationToSymbol(symbol, node, 131072 /* Signature */); - bindChildren(node, 131072 /* Signature */, false); - var typeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type"); - addDeclarationToSymbol(typeLiteralSymbol, node, 2048 /* TypeLiteral */); + var symbol = createSymbol(131072, getDeclarationName(node)); + addDeclarationToSymbol(symbol, node, 131072); + bindChildren(node, 131072, false); + var typeLiteralSymbol = createSymbol(2048, "__type"); + addDeclarationToSymbol(typeLiteralSymbol, node, 2048); typeLiteralSymbol.members = {}; - typeLiteralSymbol.members[node.kind === 136 /* FunctionType */ ? "__call" : "__new"] = symbol; + typeLiteralSymbol.members[node.kind === 138 ? "__call" : "__new"] = symbol; } function bindAnonymousDeclaration(node, symbolKind, name, isBlockScopeContainer) { var symbol = createSymbol(symbolKind, name); @@ -6689,8 +6929,8 @@ var ts; bindChildren(node, symbolKind, isBlockScopeContainer); } function bindCatchVariableDeclaration(node) { - var symbol = createSymbol(1 /* FunctionScopedVariable */, node.name.text || "__missing"); - addDeclarationToSymbol(symbol, node, 1 /* FunctionScopedVariable */); + var symbol = createSymbol(1, node.name.text || "__missing"); + addDeclarationToSymbol(symbol, node, 1); var saveParent = parent; var savedBlockScopeContainer = blockScopeContainer; parent = blockScopeContainer = node; @@ -6700,21 +6940,21 @@ var ts; } function bindBlockScopedVariableDeclaration(node) { switch (blockScopeContainer.kind) { - case 195 /* ModuleDeclaration */: - declareModuleMember(node, 2 /* BlockScopedVariable */, 107455 /* BlockScopedVariableExcludes */); + case 198: + declareModuleMember(node, 2, 107455); break; - case 207 /* SourceFile */: + case 210: if (ts.isExternalModule(container)) { - declareModuleMember(node, 2 /* BlockScopedVariable */, 107455 /* BlockScopedVariableExcludes */); + declareModuleMember(node, 2, 107455); break; } default: if (!blockScopeContainer.locals) { blockScopeContainer.locals = {}; } - declareSymbol(blockScopeContainer.locals, undefined, node, 2 /* BlockScopedVariable */, 107455 /* BlockScopedVariableExcludes */); + declareSymbol(blockScopeContainer.locals, undefined, node, 2, 107455); } - bindChildren(node, 2 /* BlockScopedVariable */, false); + bindChildren(node, 2, false); } function getDestructuringParameterName(node) { return "__" + ts.indexOf(node.parent.parameters, node); @@ -6722,106 +6962,109 @@ var ts; function bind(node) { node.parent = parent; switch (node.kind) { - case 123 /* TypeParameter */: - bindDeclaration(node, 262144 /* TypeParameter */, 530912 /* TypeParameterExcludes */, false); + case 125: + bindDeclaration(node, 262144, 530912, false); break; - case 124 /* Parameter */: + case 126: bindParameter(node); break; - case 188 /* VariableDeclaration */: - case 146 /* BindingElement */: + case 191: + case 148: if (ts.isBindingPattern(node.name)) { bindChildren(node, 0, false); } - else if (ts.getCombinedNodeFlags(node) & 6144 /* BlockScoped */) { + else if (ts.getCombinedNodeFlags(node) & 6144) { bindBlockScopedVariableDeclaration(node); } else { - bindDeclaration(node, 1 /* FunctionScopedVariable */, 107454 /* FunctionScopedVariableExcludes */, false); + bindDeclaration(node, 1, 107454, false); } break; - case 126 /* PropertyDeclaration */: - case 125 /* PropertySignature */: - bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0), 107455 /* PropertyExcludes */, false); + case 128: + case 127: + bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455, false); break; - case 204 /* PropertyAssignment */: - case 205 /* ShorthandPropertyAssignment */: - bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 107455 /* PropertyExcludes */, false); + case 207: + case 208: + bindPropertyOrMethodOrAccessor(node, 4, 107455, false); break; - case 206 /* EnumMember */: - bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */, false); + case 209: + bindPropertyOrMethodOrAccessor(node, 8, 107455, false); break; - case 132 /* CallSignature */: - case 133 /* ConstructSignature */: - case 134 /* IndexSignature */: - bindDeclaration(node, 131072 /* Signature */, 0, false); + case 134: + case 135: + case 136: + bindDeclaration(node, 131072, 0, false); break; - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: - bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0), ts.isObjectLiteralMethod(node) ? 107455 /* PropertyExcludes */ : 99263 /* MethodExcludes */, true); + case 130: + case 129: + bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263, true); break; - case 190 /* FunctionDeclaration */: - bindDeclaration(node, 16 /* Function */, 106927 /* FunctionExcludes */, true); + case 193: + bindDeclaration(node, 16, 106927, true); break; - case 129 /* Constructor */: - bindDeclaration(node, 16384 /* Constructor */, 0, true); + case 131: + bindDeclaration(node, 16384, 0, true); break; - case 130 /* GetAccessor */: - bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */, true); + case 132: + bindPropertyOrMethodOrAccessor(node, 32768, 41919, true); break; - case 131 /* SetAccessor */: - bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */, true); + case 133: + bindPropertyOrMethodOrAccessor(node, 65536, 74687, true); break; - case 136 /* FunctionType */: - case 137 /* ConstructorType */: + case 138: + case 139: bindFunctionOrConstructorType(node); break; - case 139 /* TypeLiteral */: - bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type", false); + case 141: + bindAnonymousDeclaration(node, 2048, "__type", false); break; - case 148 /* ObjectLiteralExpression */: - bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__object", false); + case 150: + bindAnonymousDeclaration(node, 4096, "__object", false); break; - case 156 /* FunctionExpression */: - case 157 /* ArrowFunction */: - bindAnonymousDeclaration(node, 16 /* Function */, "__function", true); + case 158: + case 159: + bindAnonymousDeclaration(node, 16, "__function", true); break; - case 203 /* CatchClause */: + case 206: bindCatchVariableDeclaration(node); break; - case 191 /* ClassDeclaration */: - bindDeclaration(node, 32 /* Class */, 899583 /* ClassExcludes */, false); + case 194: + bindDeclaration(node, 32, 899583, false); break; - case 192 /* InterfaceDeclaration */: - bindDeclaration(node, 64 /* Interface */, 792992 /* InterfaceExcludes */, false); + case 195: + bindDeclaration(node, 64, 792992, false); break; - case 193 /* TypeAliasDeclaration */: - bindDeclaration(node, 524288 /* TypeAlias */, 793056 /* TypeAliasExcludes */, false); + case 196: + bindDeclaration(node, 524288, 793056, false); break; - case 194 /* EnumDeclaration */: + case 197: if (ts.isConst(node)) { - bindDeclaration(node, 128 /* ConstEnum */, 899967 /* ConstEnumExcludes */, false); + bindDeclaration(node, 128, 899967, false); } else { - bindDeclaration(node, 256 /* RegularEnum */, 899327 /* RegularEnumExcludes */, false); + bindDeclaration(node, 256, 899327, false); } break; - case 195 /* ModuleDeclaration */: + case 198: bindModuleDeclaration(node); break; - case 197 /* ImportDeclaration */: - bindDeclaration(node, 8388608 /* Import */, 8388608 /* ImportExcludes */, false); + case 200: + bindDeclaration(node, 8388608, 8388608, false); break; - case 207 /* SourceFile */: + case 210: if (ts.isExternalModule(node)) { - bindAnonymousDeclaration(node, 512 /* ValueModule */, '"' + ts.removeFileExtension(node.fileName) + '"', true); + bindAnonymousDeclaration(node, 512, '"' + ts.removeFileExtension(node.fileName) + '"', true); break; } - case 170 /* Block */: - case 203 /* CatchClause */: - case 177 /* ForStatement */: - case 178 /* ForInStatement */: - case 183 /* SwitchStatement */: + case 172: + bindChildren(node, 0, !ts.isAnyFunction(node.parent)); + break; + case 206: + case 179: + case 180: + case 181: + case 186: bindChildren(node, 0, true); break; default: @@ -6833,18 +7076,20 @@ var ts; } function bindParameter(node) { if (ts.isBindingPattern(node.name)) { - bindAnonymousDeclaration(node, 1 /* FunctionScopedVariable */, getDestructuringParameterName(node), false); + bindAnonymousDeclaration(node, 1, getDestructuringParameterName(node), false); } else { - bindDeclaration(node, 1 /* FunctionScopedVariable */, 107455 /* ParameterExcludes */, false); + bindDeclaration(node, 1, 107455, false); } - if (node.flags & 112 /* AccessibilityModifier */ && node.parent.kind === 129 /* Constructor */ && node.parent.parent.kind === 191 /* ClassDeclaration */) { + if (node.flags & 112 && + node.parent.kind === 131 && + node.parent.parent.kind === 194) { var classDeclaration = node.parent.parent; - declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */); + declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } } function bindPropertyOrMethodOrAccessor(node, symbolKind, symbolExcludes, isBlockScopeContainer) { - if (hasDynamicName(node)) { + if (ts.hasDynamicName(node)) { bindAnonymousDeclaration(node, symbolKind, "__computed", isBlockScopeContainer); } else { @@ -6867,7 +7112,7 @@ var ts; var emptyArray = []; var emptySymbols = {}; var compilerOptions = host.getCompilerOptions(); - var languageVersion = compilerOptions.target || 0 /* ES3 */; + var languageVersion = compilerOptions.target || 0; var emitResolver = createResolver(); var checker = { getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, @@ -6904,19 +7149,20 @@ var ts; getAliasedSymbol: resolveImport, getEmitResolver: getEmitResolver }; - var undefinedSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "undefined"); - var argumentsSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "arguments"); - var unknownSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "unknown"); - var resolvingSymbol = createSymbol(67108864 /* Transient */, "__resolving__"); - var anyType = createIntrinsicType(1 /* Any */, "any"); - var stringType = createIntrinsicType(2 /* String */, "string"); - var numberType = createIntrinsicType(4 /* Number */, "number"); - var booleanType = createIntrinsicType(8 /* Boolean */, "boolean"); - var voidType = createIntrinsicType(16 /* Void */, "void"); - var undefinedType = createIntrinsicType(32 /* Undefined */ | 262144 /* ContainsUndefinedOrNull */, "undefined"); - var nullType = createIntrinsicType(64 /* Null */ | 262144 /* ContainsUndefinedOrNull */, "null"); - var unknownType = createIntrinsicType(1 /* Any */, "unknown"); - var resolvingType = createIntrinsicType(1 /* Any */, "__resolving__"); + var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); + var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); + var unknownSymbol = createSymbol(4 | 67108864, "unknown"); + var resolvingSymbol = createSymbol(67108864, "__resolving__"); + var anyType = createIntrinsicType(1, "any"); + var stringType = createIntrinsicType(2, "string"); + var numberType = createIntrinsicType(4, "number"); + var booleanType = createIntrinsicType(8, "boolean"); + var esSymbolType = createIntrinsicType(1048576, "symbol"); + var voidType = createIntrinsicType(16, "void"); + var undefinedType = createIntrinsicType(32 | 262144, "undefined"); + var nullType = createIntrinsicType(64 | 262144, "null"); + var unknownType = createIntrinsicType(1, "unknown"); + var resolvingType = createIntrinsicType(1, "__resolving__"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); @@ -6925,6 +7171,7 @@ var ts; var unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, 0, false, false); var globals = {}; var globalArraySymbol; + var globalESSymbolConstructorSymbol; var globalObjectType; var globalFunctionType; var globalArrayType; @@ -6933,6 +7180,7 @@ var ts; var globalBooleanType; var globalRegExpType; var globalTemplateStringsArrayType; + var globalESSymbolType; var anyArrayType; var tupleTypes = {}; var unionTypes = {}; @@ -6946,15 +7194,19 @@ var ts; var primitiveTypeInfo = { "string": { type: stringType, - flags: 258 /* StringLike */ + flags: 258 }, "number": { type: numberType, - flags: 132 /* NumberLike */ + flags: 132 }, "boolean": { type: booleanType, - flags: 8 /* Boolean */ + flags: 8 + }, + "symbol": { + type: esSymbolType, + flags: 1048576 } }; function getEmitResolver(sourceFile) { @@ -6970,38 +7222,38 @@ var ts; } function getExcludedSymbolFlags(flags) { var result = 0; - if (flags & 2 /* BlockScopedVariable */) - result |= 107455 /* BlockScopedVariableExcludes */; - if (flags & 1 /* FunctionScopedVariable */) - result |= 107454 /* FunctionScopedVariableExcludes */; - if (flags & 4 /* Property */) - result |= 107455 /* PropertyExcludes */; - if (flags & 8 /* EnumMember */) - result |= 107455 /* EnumMemberExcludes */; - if (flags & 16 /* Function */) - result |= 106927 /* FunctionExcludes */; - if (flags & 32 /* Class */) - result |= 899583 /* ClassExcludes */; - if (flags & 64 /* Interface */) - result |= 792992 /* InterfaceExcludes */; - if (flags & 256 /* RegularEnum */) - result |= 899327 /* RegularEnumExcludes */; - if (flags & 128 /* ConstEnum */) - result |= 899967 /* ConstEnumExcludes */; - if (flags & 512 /* ValueModule */) - result |= 106639 /* ValueModuleExcludes */; - if (flags & 8192 /* Method */) - result |= 99263 /* MethodExcludes */; - if (flags & 32768 /* GetAccessor */) - result |= 41919 /* GetAccessorExcludes */; - if (flags & 65536 /* SetAccessor */) - result |= 74687 /* SetAccessorExcludes */; - if (flags & 262144 /* TypeParameter */) - result |= 530912 /* TypeParameterExcludes */; - if (flags & 524288 /* TypeAlias */) - result |= 793056 /* TypeAliasExcludes */; - if (flags & 8388608 /* Import */) - result |= 8388608 /* ImportExcludes */; + if (flags & 2) + result |= 107455; + if (flags & 1) + result |= 107454; + if (flags & 4) + result |= 107455; + if (flags & 8) + result |= 107455; + if (flags & 16) + result |= 106927; + if (flags & 32) + result |= 899583; + if (flags & 64) + result |= 792992; + if (flags & 256) + result |= 899327; + if (flags & 128) + result |= 899967; + if (flags & 512) + result |= 106639; + if (flags & 8192) + result |= 99263; + if (flags & 32768) + result |= 41919; + if (flags & 65536) + result |= 74687; + if (flags & 262144) + result |= 530912; + if (flags & 524288) + result |= 793056; + if (flags & 8388608) + result |= 8388608; return result; } function recordMergedSymbol(target, source) { @@ -7010,7 +7262,7 @@ var ts; mergedSymbols[source.mergeId] = target; } function cloneSymbol(symbol) { - var result = createSymbol(symbol.flags | 33554432 /* Merged */, symbol.name); + var result = createSymbol(symbol.flags | 33554432, symbol.name); result.declarations = symbol.declarations.slice(0); result.parent = symbol.parent; if (symbol.valueDeclaration) @@ -7026,7 +7278,7 @@ var ts; } function extendSymbol(target, source) { if (!(target.flags & getExcludedSymbolFlags(source.flags))) { - if (source.flags & 512 /* ValueModule */ && target.flags & 512 /* ValueModule */ && target.constEnumOnlyModule && !source.constEnumOnlyModule) { + if (source.flags & 512 && target.flags & 512 && target.constEnumOnlyModule && !source.constEnumOnlyModule) { target.constEnumOnlyModule = false; } target.flags |= source.flags; @@ -7048,7 +7300,7 @@ var ts; recordMergedSymbol(target, source); } else { - var message = target.flags & 2 /* BlockScopedVariable */ || source.flags & 2 /* BlockScopedVariable */ ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + var message = target.flags & 2 || source.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; ts.forEach(source.declarations, function (node) { error(node.name ? node.name : node, message, symbolToString(source)); }); @@ -7074,7 +7326,7 @@ var ts; } else { var symbol = target[id]; - if (!(symbol.flags & 33554432 /* Merged */)) { + if (!(symbol.flags & 33554432)) { target[id] = symbol = cloneSymbol(symbol); } extendSymbol(symbol, source[id]); @@ -7083,7 +7335,7 @@ var ts; } } function getSymbolLinks(symbol) { - if (symbol.flags & 67108864 /* Transient */) + if (symbol.flags & 67108864) return symbol; if (!symbol.id) symbol.id = nextSymbolId++; @@ -7095,19 +7347,19 @@ var ts; return nodeLinks[node.id] || (nodeLinks[node.id] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 207 /* SourceFile */); + return ts.getAncestor(node, 210); } function isGlobalSourceFile(node) { - return node.kind === 207 /* SourceFile */ && !ts.isExternalModule(node); + return node.kind === 210 && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { var symbol = symbols[name]; - ts.Debug.assert((symbol.flags & 16777216 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); + ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); if (symbol.flags & meaning) { return symbol; } - if (symbol.flags & 8388608 /* Import */) { + if (symbol.flags & 8388608) { var target = resolveImport(symbol); if (target === unknownSymbol || target.flags & meaning) { return symbol; @@ -7139,62 +7391,62 @@ var ts; } } switch (location.kind) { - case 207 /* SourceFile */: + case 210: if (!ts.isExternalModule(location)) break; - case 195 /* ModuleDeclaration */: - if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931 /* ModuleMember */)) { + case 198: + if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931)) { break loop; } break; - case 194 /* EnumDeclaration */: - if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { + case 197: + if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; - case 126 /* PropertyDeclaration */: - case 125 /* PropertySignature */: - if (location.parent.kind === 191 /* ClassDeclaration */ && !(location.flags & 128 /* Static */)) { + case 128: + case 127: + if (location.parent.kind === 194 && !(location.flags & 128)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { - if (getSymbol(ctor.locals, name, meaning & 107455 /* Value */)) { + if (getSymbol(ctor.locals, name, meaning & 107455)) { propertyWithInvalidInitializer = location; } } } break; - case 191 /* ClassDeclaration */: - case 192 /* InterfaceDeclaration */: - if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056 /* Type */)) { - if (lastLocation && lastLocation.flags & 128 /* Static */) { + case 194: + case 195: + 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); return undefined; } break loop; } break; - case 122 /* ComputedPropertyName */: + case 124: var grandparent = location.parent.parent; - if (grandparent.kind === 191 /* ClassDeclaration */ || grandparent.kind === 192 /* InterfaceDeclaration */) { - if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056 /* Type */)) { + if (grandparent.kind === 194 || grandparent.kind === 195) { + 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 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: - case 129 /* Constructor */: - case 130 /* GetAccessor */: - case 131 /* SetAccessor */: - case 190 /* FunctionDeclaration */: - case 157 /* ArrowFunction */: + case 130: + case 129: + case 131: + case 132: + case 133: + case 193: + case 159: if (name === "arguments") { result = argumentsSymbol; break loop; } break; - case 156 /* FunctionExpression */: + case 158: if (name === "arguments") { result = argumentsSymbol; break loop; @@ -7205,7 +7457,7 @@ var ts; break loop; } break; - case 203 /* CatchClause */: + case 206: var id = location.name; if (name === id.text) { result = location.symbol; @@ -7231,8 +7483,8 @@ 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 (result.flags & 2 /* BlockScopedVariable */) { - var declaration = ts.forEach(result.declarations, function (d) { return ts.getCombinedNodeFlags(d) & 6144 /* BlockScoped */ ? d : undefined; }); + if (result.flags & 2) { + var declaration = ts.forEach(result.declarations, function (d) { return ts.getCombinedNodeFlags(d) & 6144 ? d : undefined; }); ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); if (!isDefinedBefore(declaration, errorLocation)) { error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); @@ -7242,17 +7494,17 @@ var ts; return result; } function resolveImport(symbol) { - ts.Debug.assert((symbol.flags & 8388608 /* Import */) !== 0, "Should only get Imports here."); + ts.Debug.assert((symbol.flags & 8388608) !== 0, "Should only get Imports here."); var links = getSymbolLinks(symbol); if (!links.target) { links.target = resolvingSymbol; - var node = ts.getDeclarationOfKind(symbol, 197 /* ImportDeclaration */); - if (node.moduleReference.kind === 199 /* ExternalModuleReference */) { - if (node.moduleReference.expression.kind !== 8 /* StringLiteral */) { + var node = ts.getDeclarationOfKind(symbol, 200); + if (node.moduleReference.kind === 202) { + if (node.moduleReference.expression.kind !== 8) { grammarErrorOnNode(node.moduleReference.expression, ts.Diagnostics.String_literal_expected); } } - var target = node.moduleReference.kind === 199 /* ExternalModuleReference */ ? resolveExternalModuleName(node, ts.getExternalModuleImportDeclarationExpression(node)) : getSymbolOfPartOfRightHandSideOfImport(node.moduleReference, node); + var target = node.moduleReference.kind === 202 ? resolveExternalModuleName(node, ts.getExternalModuleImportDeclarationExpression(node)) : getSymbolOfPartOfRightHandSideOfImport(node.moduleReference, node); if (links.target === resolvingSymbol) { links.target = target || unknownSymbol; } @@ -7267,18 +7519,18 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImport(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 197 /* ImportDeclaration */); + importDeclaration = ts.getAncestor(entityName, 200); ts.Debug.assert(importDeclaration !== undefined); } - if (entityName.kind === 64 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 64 && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 64 /* Identifier */ || entityName.parent.kind === 121 /* QualifiedName */) { - return resolveEntityName(importDeclaration, entityName, 1536 /* Namespace */); + if (entityName.kind === 64 || entityName.parent.kind === 123) { + return resolveEntityName(importDeclaration, entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 197 /* ImportDeclaration */); - return resolveEntityName(importDeclaration, entityName, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */); + ts.Debug.assert(entityName.parent.kind === 200); + return resolveEntityName(importDeclaration, entityName, 107455 | 793056 | 1536); } } function getFullyQualifiedName(symbol) { @@ -7288,14 +7540,14 @@ var ts; if (ts.getFullWidth(name) === 0) { return undefined; } - if (name.kind === 64 /* Identifier */) { + if (name.kind === 64) { var symbol = resolveName(location, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); if (!symbol) { return; } } - else if (name.kind === 121 /* QualifiedName */) { - var namespace = resolveEntityName(location, name.left, 1536 /* Namespace */); + else if (name.kind === 123) { + var namespace = resolveEntityName(location, name.left, 1536); if (!namespace || namespace === unknownSymbol || ts.getFullWidth(name.right) === 0) return; var symbol = getSymbol(namespace.exports, name.right.text, meaning); @@ -7304,14 +7556,14 @@ var ts; return; } } - ts.Debug.assert((symbol.flags & 16777216 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); + ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); return symbol.flags & meaning ? symbol : resolveImport(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 !== 8 /* StringLiteral */) { + if (moduleReferenceExpression.kind !== 8) { return; } var moduleReferenceLiteral = moduleReferenceExpression; @@ -7321,7 +7573,7 @@ var ts; return; var isRelative = isExternalModuleNameRelative(moduleName); if (!isRelative) { - var symbol = getSymbol(globals, '"' + moduleName + '"', 512 /* ValueModule */); + var symbol = getSymbol(globals, '"' + moduleName + '"', 512); if (symbol) { return getResolvedExportSymbol(symbol); } @@ -7348,10 +7600,10 @@ var ts; function getResolvedExportSymbol(moduleSymbol) { var symbol = getExportAssignmentSymbol(moduleSymbol); if (symbol) { - if (symbol.flags & (107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */)) { + if (symbol.flags & (107455 | 793056 | 1536)) { return symbol; } - if (symbol.flags & 8388608 /* Import */) { + if (symbol.flags & 8388608) { return resolveImport(symbol); } } @@ -7375,7 +7627,7 @@ var ts; error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); } if (node.exportName.text) { - var meaning = 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */; + var meaning = 107455 | 793056 | 1536; var exportSymbol = resolveName(node, node.exportName.text, meaning, ts.Diagnostics.Cannot_find_name_0, node.exportName); } } @@ -7386,13 +7638,13 @@ var ts; var seenExportedMember = false; var result = []; ts.forEach(symbol.declarations, function (declaration) { - var block = (declaration.kind === 207 /* SourceFile */ ? declaration : declaration.body); + var block = (declaration.kind === 210 ? declaration : declaration.body); ts.forEach(block.statements, function (node) { - if (node.kind === 198 /* ExportAssignment */) { + if (node.kind === 201) { result.push(node); } else { - seenExportedMember = seenExportedMember || (node.flags & 1 /* Export */) !== 0; + seenExportedMember = seenExportedMember || (node.flags & 1) !== 0; } }); }); @@ -7412,17 +7664,17 @@ var ts; return getMergedSymbol(symbol.parent); } function getExportSymbolOfValueSymbolIfExported(symbol) { - return symbol && (symbol.flags & 1048576 /* ExportValue */) !== 0 ? getMergedSymbol(symbol.exportSymbol) : symbol; + return symbol && (symbol.flags & 1048576) !== 0 ? getMergedSymbol(symbol.exportSymbol) : symbol; } function symbolIsValue(symbol) { - if (symbol.flags & 16777216 /* Instantiated */) { + if (symbol.flags & 16777216) { return symbolIsValue(getSymbolLinks(symbol).target); } - if (symbol.flags & 107455 /* Value */) { + if (symbol.flags & 107455) { return true; } - if (symbol.flags & 8388608 /* Import */) { - return (resolveImport(symbol).flags & 107455 /* Value */) !== 0; + if (symbol.flags & 8388608) { + return (resolveImport(symbol).flags & 107455) !== 0; } return false; } @@ -7430,7 +7682,7 @@ var ts; var members = node.members; for (var i = 0; i < members.length; i++) { var member = members[i]; - if (member.kind === 129 /* Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 131 && ts.nodeIsPresent(member.body)) { return member; } } @@ -7451,7 +7703,10 @@ var ts; return type; } function isReservedMemberName(name) { - return name.charCodeAt(0) === 95 /* _ */ && name.charCodeAt(1) === 95 /* _ */ && name.charCodeAt(2) !== 95 /* _ */; + return name.charCodeAt(0) === 95 && + name.charCodeAt(1) === 95 && + name.charCodeAt(2) !== 95 && + name.charCodeAt(2) !== 64; } function getNamedMembers(members) { var result; @@ -7481,7 +7736,7 @@ var ts; return type; } function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexType, numberIndexType) { - return setObjectTypeMembers(createObjectType(32768 /* Anonymous */, symbol), members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + return setObjectTypeMembers(createObjectType(32768, symbol), members, callSignatures, constructSignatures, stringIndexType, numberIndexType); } function forEachSymbolTableInScope(enclosingDeclaration, callback) { var result; @@ -7492,17 +7747,17 @@ var ts; } } switch (location.kind) { - case 207 /* SourceFile */: + case 210: if (!ts.isExternalModule(location)) { break; } - case 195 /* ModuleDeclaration */: + case 198: if (result = callback(getSymbolOfNode(location).exports)) { return result; } break; - case 191 /* ClassDeclaration */: - case 192 /* InterfaceDeclaration */: + case 194: + case 195: if (result = callback(getSymbolOfNode(location).members)) { return result; } @@ -7512,7 +7767,7 @@ var ts; return callback(globals); } function getQualifiedLeftMeaning(rightMeaning) { - return rightMeaning === 107455 /* Value */ ? 107455 /* Value */ : 1536 /* Namespace */; + return rightMeaning === 107455 ? 107455 : 1536; } function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing) { function getAccessibleSymbolChainFromSymbolTable(symbols) { @@ -7525,15 +7780,17 @@ var ts; } function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) { if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) { - return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && canQualifySymbol(symbolFromSymbolTable, meaning); + return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && + canQualifySymbol(symbolFromSymbolTable, meaning); } } if (isAccessible(ts.lookUp(symbols, symbol.name))) { return [symbol]; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 8388608 /* Import */) { - if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportDeclaration)) { + if (symbolFromSymbolTable.flags & 8388608) { + if (!useOnlyExternalAliasing || + ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportDeclaration)) { var resolvedImportedSymbol = resolveImport(symbolFromSymbolTable); if (isAccessible(symbolFromSymbolTable, resolveImport(symbolFromSymbolTable))) { return [symbolFromSymbolTable]; @@ -7560,7 +7817,7 @@ var ts; if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Import */) ? resolveImport(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608) ? resolveImport(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -7570,7 +7827,7 @@ var ts; return qualify; } function isSymbolAccessible(symbol, enclosingDeclaration, meaning) { - if (symbol && enclosingDeclaration && !(symbol.flags & 262144 /* TypeParameter */)) { + if (symbol && enclosingDeclaration && !(symbol.flags & 262144)) { var initialSymbol = symbol; var meaningToLook = meaning; while (symbol) { @@ -7579,9 +7836,9 @@ var ts; var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0]); if (!hasAccessibleDeclarations) { return { - accessibility: 1 /* NotAccessible */, + accessibility: 1, errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning), - errorModuleName: symbol !== initialSymbol ? symbolToString(symbol, enclosingDeclaration, 1536 /* Namespace */) : undefined + errorModuleName: symbol !== initialSymbol ? symbolToString(symbol, enclosingDeclaration, 1536) : undefined }; } return hasAccessibleDeclarations; @@ -7594,18 +7851,18 @@ var ts; var enclosingExternalModule = getExternalModuleContainer(enclosingDeclaration); if (symbolExternalModule !== enclosingExternalModule) { return { - accessibility: 2 /* CannotBeNamed */, + accessibility: 2, errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning), errorModuleName: symbolToString(symbolExternalModule) }; } } return { - accessibility: 1 /* NotAccessible */, + accessibility: 1, errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning) }; } - return { accessibility: 0 /* Accessible */ }; + return { accessibility: 0 }; function getExternalModuleContainer(declaration) { for (; declaration; declaration = declaration.parent) { if (hasExternalModuleSymbol(declaration)) { @@ -7615,17 +7872,20 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 195 /* ModuleDeclaration */ && declaration.name.kind === 8 /* StringLiteral */) || (declaration.kind === 207 /* SourceFile */ && ts.isExternalModule(declaration)); + return (declaration.kind === 198 && declaration.name.kind === 8) || + (declaration.kind === 210 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) { return undefined; } - return { accessibility: 0 /* Accessible */, aliasesToMakeVisible: aliasesToMakeVisible }; + return { accessibility: 0, aliasesToMakeVisible: aliasesToMakeVisible }; function getIsDeclarationVisible(declaration) { if (!isDeclarationVisible(declaration)) { - if (declaration.kind === 197 /* ImportDeclaration */ && !(declaration.flags & 1 /* Export */) && isDeclarationVisible(declaration.parent)) { + if (declaration.kind === 200 && + !(declaration.flags & 1) && + isDeclarationVisible(declaration.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { if (!ts.contains(aliasesToMakeVisible, declaration)) { @@ -7644,19 +7904,20 @@ var ts; } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; - if (entityName.parent.kind === 138 /* TypeQuery */) { - meaning = 107455 /* Value */ | 1048576 /* ExportValue */; + if (entityName.parent.kind === 140) { + meaning = 107455 | 1048576; } - else if (entityName.kind === 121 /* QualifiedName */ || entityName.parent.kind === 197 /* ImportDeclaration */) { - meaning = 1536 /* Namespace */; + else if (entityName.kind === 123 || + entityName.parent.kind === 200) { + meaning = 1536; } else { - meaning = 793056 /* Type */; + meaning = 793056; } var firstIdentifier = getFirstIdentifier(entityName); var symbol = resolveName(enclosingDeclaration, firstIdentifier.text, meaning, undefined, undefined); return (symbol && hasVisibleDeclarations(symbol)) || { - accessibility: 1 /* NotAccessible */, + accessibility: 1, errorSymbolName: ts.getTextOfNode(firstIdentifier), errorNode: firstIdentifier }; @@ -7682,19 +7943,19 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); var result = writer.string(); ts.releaseStringWriter(writer); - var maxLength = compilerOptions.noErrorTruncation || flags & 4 /* NoTruncation */ ? undefined : 100; + var maxLength = compilerOptions.noErrorTruncation || flags & 4 ? undefined : 100; if (maxLength && result.length >= maxLength) { result = result.substr(0, maxLength - "...".length) + "..."; } return result; } function getTypeAliasForTypeLiteral(type) { - if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { + if (type.symbol && type.symbol.flags & 2048) { var node = type.symbol.declarations[0].parent; - while (node.kind === 143 /* ParenthesizedType */) { + while (node.kind === 145) { node = node.parent; } - if (node.kind === 193 /* TypeAliasDeclaration */) { + if (node.kind === 196) { return getSymbolOfNode(node); } } @@ -7716,15 +7977,15 @@ var ts; var parentSymbol; function appendParentTypeArgumentsAndSymbolName(symbol) { if (parentSymbol) { - if (flags & 1 /* WriteTypeParametersOrArguments */) { - if (symbol.flags & 16777216 /* Instantiated */) { + if (flags & 1) { + if (symbol.flags & 16777216) { buildDisplayForTypeArgumentsAndDelimiters(getTypeParametersOfClassOrInterface(parentSymbol), symbol.mapper, writer, enclosingDeclaration); } else { buildTypeParameterDisplayFromSymbol(parentSymbol, writer, enclosingDeclaration); } } - writePunctuation(writer, 20 /* DotToken */); + writePunctuation(writer, 20); } parentSymbol = symbol; appendSymbolNameOnly(symbol, writer); @@ -7732,8 +7993,9 @@ var ts; writer.trackSymbol(symbol, enclosingDeclaration, meaning); function walkSymbol(symbol, meaning) { if (symbol) { - var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2 /* UseOnlyExternalAliasing */)); - if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); + if (!accessibleSymbolChain || + needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { @@ -7745,15 +8007,15 @@ var ts; if (!parentSymbol && ts.forEach(symbol.declarations, hasExternalModuleSymbol)) { return; } - if (symbol.flags & 2048 /* TypeLiteral */ || symbol.flags & 4096 /* ObjectLiteral */) { + if (symbol.flags & 2048 || symbol.flags & 4096) { return; } appendParentTypeArgumentsAndSymbolName(symbol); } } } - var isTypeParameter = symbol.flags & 262144 /* TypeParameter */; - var typeFormatFlag = 128 /* UseFullyQualifiedType */ & typeFlags; + var isTypeParameter = symbol.flags & 262144; + var typeFormatFlag = 128 & typeFlags; if (!isTypeParameter && (enclosingDeclaration || typeFormatFlag)) { walkSymbol(symbol, meaning); return; @@ -7761,36 +8023,37 @@ var ts; return appendParentTypeArgumentsAndSymbolName(symbol); } function buildTypeDisplay(type, writer, enclosingDeclaration, globalFlags, typeStack) { - var globalFlagsToPass = globalFlags & 16 /* WriteOwnNameForAnyLike */; + var globalFlagsToPass = globalFlags & 16; return writeType(type, globalFlags); function writeType(type, flags) { - if (type.flags & 127 /* Intrinsic */) { - writer.writeKeyword(!(globalFlags & 16 /* WriteOwnNameForAnyLike */) && (type.flags & 1 /* Any */) ? "any" : type.intrinsicName); + if (type.flags & 1048703) { + writer.writeKeyword(!(globalFlags & 16) && + (type.flags & 1) ? "any" : type.intrinsicName); } - else if (type.flags & 4096 /* Reference */) { + else if (type.flags & 4096) { writeTypeReference(type, flags); } - else if (type.flags & (1024 /* Class */ | 2048 /* Interface */ | 128 /* Enum */ | 512 /* TypeParameter */)) { - buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 793056 /* Type */, 0 /* None */, flags); + else if (type.flags & (1024 | 2048 | 128 | 512)) { + buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 793056, 0, flags); } - else if (type.flags & 8192 /* Tuple */) { + else if (type.flags & 8192) { writeTupleType(type); } - else if (type.flags & 16384 /* Union */) { + else if (type.flags & 16384) { writeUnionType(type, flags); } - else if (type.flags & 32768 /* Anonymous */) { + else if (type.flags & 32768) { writeAnonymousType(type, flags); } - else if (type.flags & 256 /* StringLiteral */) { + else if (type.flags & 256) { writer.writeStringLiteral(type.text); } else { - writePunctuation(writer, 14 /* OpenBraceToken */); + writePunctuation(writer, 14); writeSpace(writer); - writePunctuation(writer, 21 /* DotDotDotToken */); + writePunctuation(writer, 21); writeSpace(writer); - writePunctuation(writer, 15 /* CloseBraceToken */); + writePunctuation(writer, 15); } } function writeTypeList(types, union) { @@ -7799,41 +8062,41 @@ var ts; if (union) { writeSpace(writer); } - writePunctuation(writer, union ? 44 /* BarToken */ : 23 /* CommaToken */); + writePunctuation(writer, union ? 44 : 23); writeSpace(writer); } - writeType(types[i], union ? 64 /* InElementType */ : 0 /* None */); + writeType(types[i], union ? 64 : 0); } } function writeTypeReference(type, flags) { - if (type.target === globalArrayType && !(flags & 1 /* WriteArrayAsGenericType */)) { - writeType(type.typeArguments[0], 64 /* InElementType */); - writePunctuation(writer, 18 /* OpenBracketToken */); - writePunctuation(writer, 19 /* CloseBracketToken */); + if (type.target === globalArrayType && !(flags & 1)) { + writeType(type.typeArguments[0], 64); + writePunctuation(writer, 18); + writePunctuation(writer, 19); } else { - buildSymbolDisplay(type.target.symbol, writer, enclosingDeclaration, 793056 /* Type */); - writePunctuation(writer, 24 /* LessThanToken */); + buildSymbolDisplay(type.target.symbol, writer, enclosingDeclaration, 793056); + writePunctuation(writer, 24); writeTypeList(type.typeArguments, false); - writePunctuation(writer, 25 /* GreaterThanToken */); + writePunctuation(writer, 25); } } function writeTupleType(type) { - writePunctuation(writer, 18 /* OpenBracketToken */); + writePunctuation(writer, 18); writeTypeList(type.elementTypes, false); - writePunctuation(writer, 19 /* CloseBracketToken */); + writePunctuation(writer, 19); } function writeUnionType(type, flags) { - if (flags & 64 /* InElementType */) { - writePunctuation(writer, 16 /* OpenParenToken */); + if (flags & 64) { + writePunctuation(writer, 16); } writeTypeList(type.types, true); - if (flags & 64 /* InElementType */) { - writePunctuation(writer, 17 /* CloseParenToken */); + if (flags & 64) { + writePunctuation(writer, 17); } } function writeAnonymousType(type, flags) { - if (type.symbol && type.symbol.flags & (32 /* Class */ | 384 /* Enum */ | 512 /* ValueModule */)) { + if (type.symbol && type.symbol.flags & (32 | 384 | 512)) { writeTypeofSymbol(type, flags); } else if (shouldWriteTypeOfFunctionSymbol()) { @@ -7842,10 +8105,10 @@ var ts; else if (typeStack && ts.contains(typeStack, type)) { var typeAlias = getTypeAliasForTypeLiteral(type); if (typeAlias) { - buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, 793056 /* Type */, 0 /* None */, flags); + buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, 793056, 0, flags); } else { - writeKeyword(writer, 110 /* AnyKeyword */); + writeKeyword(writer, 110); } } else { @@ -7858,18 +8121,24 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { if (type.symbol) { - var isStaticMethodSymbol = !!(type.symbol.flags & 8192 /* Method */ && ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128 /* Static */; })); - var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16 /* Function */) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { return declaration.parent.kind === 207 /* SourceFile */ || declaration.parent.kind === 196 /* ModuleBlock */; })); + var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && + ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128; })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && + (type.symbol.parent || + ts.forEach(type.symbol.declarations, function (declaration) { + return declaration.parent.kind === 210 || declaration.parent.kind === 199; + })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { - return !!(flags & 2 /* UseTypeOfFunction */) || (typeStack && ts.contains(typeStack, type)); + return !!(flags & 2) || + (typeStack && ts.contains(typeStack, type)); } } } } function writeTypeofSymbol(type, typeFormatFlags) { - writeKeyword(writer, 96 /* TypeOfKeyword */); + writeKeyword(writer, 96); writeSpace(writer); - buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455 /* Value */, 0 /* None */, typeFormatFlags); + buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455, 0, typeFormatFlags); } function getIndexerParameterName(type, indexKind, fallbackName) { var declaration = getIndexDeclarationOfSymbol(type.symbol, indexKind); @@ -7883,108 +8152,108 @@ var ts; var resolved = resolveObjectOrUnionTypeMembers(type); if (!resolved.properties.length && !resolved.stringIndexType && !resolved.numberIndexType) { if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { - writePunctuation(writer, 14 /* OpenBraceToken */); - writePunctuation(writer, 15 /* CloseBraceToken */); + writePunctuation(writer, 14); + writePunctuation(writer, 15); return; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { - if (flags & 64 /* InElementType */) { - writePunctuation(writer, 16 /* OpenParenToken */); + if (flags & 64) { + writePunctuation(writer, 16); } - buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, typeStack); - if (flags & 64 /* InElementType */) { - writePunctuation(writer, 17 /* CloseParenToken */); + buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, typeStack); + if (flags & 64) { + writePunctuation(writer, 17); } return; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { - if (flags & 64 /* InElementType */) { - writePunctuation(writer, 16 /* OpenParenToken */); + if (flags & 64) { + writePunctuation(writer, 16); } - writeKeyword(writer, 87 /* NewKeyword */); + writeKeyword(writer, 87); writeSpace(writer); - buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, typeStack); - if (flags & 64 /* InElementType */) { - writePunctuation(writer, 17 /* CloseParenToken */); + buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, typeStack); + if (flags & 64) { + writePunctuation(writer, 17); } return; } } - writePunctuation(writer, 14 /* OpenBraceToken */); + writePunctuation(writer, 14); writer.writeLine(); writer.increaseIndent(); for (var i = 0; i < resolved.callSignatures.length; i++) { buildSignatureDisplay(resolved.callSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); - writePunctuation(writer, 22 /* SemicolonToken */); + writePunctuation(writer, 22); writer.writeLine(); } for (var i = 0; i < resolved.constructSignatures.length; i++) { - writeKeyword(writer, 87 /* NewKeyword */); + writeKeyword(writer, 87); writeSpace(writer); buildSignatureDisplay(resolved.constructSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); - writePunctuation(writer, 22 /* SemicolonToken */); + writePunctuation(writer, 22); writer.writeLine(); } if (resolved.stringIndexType) { - writePunctuation(writer, 18 /* OpenBracketToken */); - writer.writeParameter(getIndexerParameterName(resolved, 0 /* String */, "x")); - writePunctuation(writer, 51 /* ColonToken */); + writePunctuation(writer, 18); + writer.writeParameter(getIndexerParameterName(resolved, 0, "x")); + writePunctuation(writer, 51); writeSpace(writer); - writeKeyword(writer, 119 /* StringKeyword */); - writePunctuation(writer, 19 /* CloseBracketToken */); - writePunctuation(writer, 51 /* ColonToken */); + writeKeyword(writer, 119); + writePunctuation(writer, 19); + writePunctuation(writer, 51); writeSpace(writer); - writeType(resolved.stringIndexType, 0 /* None */); - writePunctuation(writer, 22 /* SemicolonToken */); + writeType(resolved.stringIndexType, 0); + writePunctuation(writer, 22); writer.writeLine(); } if (resolved.numberIndexType) { - writePunctuation(writer, 18 /* OpenBracketToken */); - writer.writeParameter(getIndexerParameterName(resolved, 1 /* Number */, "x")); - writePunctuation(writer, 51 /* ColonToken */); + writePunctuation(writer, 18); + writer.writeParameter(getIndexerParameterName(resolved, 1, "x")); + writePunctuation(writer, 51); writeSpace(writer); - writeKeyword(writer, 117 /* NumberKeyword */); - writePunctuation(writer, 19 /* CloseBracketToken */); - writePunctuation(writer, 51 /* ColonToken */); + writeKeyword(writer, 117); + writePunctuation(writer, 19); + writePunctuation(writer, 51); writeSpace(writer); - writeType(resolved.numberIndexType, 0 /* None */); - writePunctuation(writer, 22 /* SemicolonToken */); + writeType(resolved.numberIndexType, 0); + writePunctuation(writer, 22); writer.writeLine(); } for (var i = 0; i < resolved.properties.length; i++) { var p = resolved.properties[i]; var t = getTypeOfSymbol(p); - if (p.flags & (16 /* Function */ | 8192 /* Method */) && !getPropertiesOfObjectType(t).length) { - var signatures = getSignaturesOfType(t, 0 /* Call */); + if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { + var signatures = getSignaturesOfType(t, 0); for (var j = 0; j < signatures.length; j++) { buildSymbolDisplay(p, writer); - if (p.flags & 536870912 /* Optional */) { - writePunctuation(writer, 50 /* QuestionToken */); + if (p.flags & 536870912) { + writePunctuation(writer, 50); } buildSignatureDisplay(signatures[j], writer, enclosingDeclaration, globalFlagsToPass, typeStack); - writePunctuation(writer, 22 /* SemicolonToken */); + writePunctuation(writer, 22); writer.writeLine(); } } else { buildSymbolDisplay(p, writer); - if (p.flags & 536870912 /* Optional */) { - writePunctuation(writer, 50 /* QuestionToken */); + if (p.flags & 536870912) { + writePunctuation(writer, 50); } - writePunctuation(writer, 51 /* ColonToken */); + writePunctuation(writer, 51); writeSpace(writer); - writeType(t, 0 /* None */); - writePunctuation(writer, 22 /* SemicolonToken */); + writeType(t, 0); + writePunctuation(writer, 22); writer.writeLine(); } } writer.decreaseIndent(); - writePunctuation(writer, 15 /* CloseBraceToken */); + writePunctuation(writer, 15); } } function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaraiton, flags) { var targetSymbol = getTargetSymbol(symbol); - if (targetSymbol.flags & 32 /* Class */ || targetSymbol.flags & 64 /* Interface */) { + if (targetSymbol.flags & 32 || targetSymbol.flags & 64) { buildDisplayForTypeParametersAndDelimiters(getTypeParametersOfClassOrInterface(symbol), writer, enclosingDeclaraiton, flags); } } @@ -7993,73 +8262,73 @@ var ts; var constraint = getConstraintOfTypeParameter(tp); if (constraint) { writeSpace(writer); - writeKeyword(writer, 78 /* ExtendsKeyword */); + writeKeyword(writer, 78); writeSpace(writer); buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, typeStack); } } function buildParameterDisplay(p, writer, enclosingDeclaration, flags, typeStack) { if (ts.hasDotDotDotToken(p.valueDeclaration)) { - writePunctuation(writer, 21 /* DotDotDotToken */); + writePunctuation(writer, 21); } appendSymbolNameOnly(p, writer); if (ts.hasQuestionToken(p.valueDeclaration) || p.valueDeclaration.initializer) { - writePunctuation(writer, 50 /* QuestionToken */); + writePunctuation(writer, 50); } - writePunctuation(writer, 51 /* ColonToken */); + writePunctuation(writer, 51); writeSpace(writer); buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, typeStack); } function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, typeStack) { if (typeParameters && typeParameters.length) { - writePunctuation(writer, 24 /* LessThanToken */); + writePunctuation(writer, 24); for (var i = 0; i < typeParameters.length; i++) { if (i > 0) { - writePunctuation(writer, 23 /* CommaToken */); + writePunctuation(writer, 23); writeSpace(writer); } buildTypeParameterDisplay(typeParameters[i], writer, enclosingDeclaration, flags, typeStack); } - writePunctuation(writer, 25 /* GreaterThanToken */); + writePunctuation(writer, 25); } } function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, typeStack) { if (typeParameters && typeParameters.length) { - writePunctuation(writer, 24 /* LessThanToken */); + writePunctuation(writer, 24); for (var i = 0; i < typeParameters.length; i++) { if (i > 0) { - writePunctuation(writer, 23 /* CommaToken */); + writePunctuation(writer, 23); writeSpace(writer); } - buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, 0 /* None */); + buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, 0); } - writePunctuation(writer, 25 /* GreaterThanToken */); + writePunctuation(writer, 25); } } function buildDisplayForParametersAndDelimiters(parameters, writer, enclosingDeclaration, flags, typeStack) { - writePunctuation(writer, 16 /* OpenParenToken */); + writePunctuation(writer, 16); for (var i = 0; i < parameters.length; i++) { if (i > 0) { - writePunctuation(writer, 23 /* CommaToken */); + writePunctuation(writer, 23); writeSpace(writer); } buildParameterDisplay(parameters[i], writer, enclosingDeclaration, flags, typeStack); } - writePunctuation(writer, 17 /* CloseParenToken */); + writePunctuation(writer, 17); } function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, typeStack) { - if (flags & 8 /* WriteArrowStyleSignature */) { + if (flags & 8) { writeSpace(writer); - writePunctuation(writer, 32 /* EqualsGreaterThanToken */); + writePunctuation(writer, 32); } else { - writePunctuation(writer, 51 /* ColonToken */); + writePunctuation(writer, 51); } writeSpace(writer); buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags, typeStack); } function buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, typeStack) { - if (signature.target && (flags & 32 /* WriteTypeArgumentsOfSignature */)) { + if (signature.target && (flags & 32)) { buildDisplayForTypeArgumentsAndDelimiters(signature.target.typeParameters, signature.mapper, writer, enclosingDeclaration); } else { @@ -8086,12 +8355,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 195 /* ModuleDeclaration */) { - if (node.name.kind === 8 /* StringLiteral */) { + if (node.kind === 198) { + if (node.name.kind === 8) { return node; } } - else if (node.kind === 207 /* SourceFile */) { + else if (node.kind === 210) { return ts.isExternalModule(node) ? node : undefined; } } @@ -8107,7 +8376,7 @@ var ts; if (isSymbolUsedInExportAssignment(symbolOfNode)) { return true; } - if (symbolOfNode.flags & 8388608 /* Import */) { + if (symbolOfNode.flags & 8388608) { return isSymbolUsedInExportAssignment(resolveImport(symbolOfNode)); } } @@ -8115,7 +8384,7 @@ var ts; if (exportAssignmentSymbol === symbol) { return true; } - if (exportAssignmentSymbol && !!(exportAssignmentSymbol.flags & 8388608 /* Import */)) { + if (exportAssignmentSymbol && !!(exportAssignmentSymbol.flags & 8388608)) { resolvedExportSymbol = resolvedExportSymbol || resolveImport(exportAssignmentSymbol); if (resolvedExportSymbol === symbol) { return true; @@ -8133,46 +8402,47 @@ var ts; } function determineIfDeclarationIsVisible() { switch (node.kind) { - case 188 /* VariableDeclaration */: - case 146 /* BindingElement */: - case 195 /* ModuleDeclaration */: - case 191 /* ClassDeclaration */: - case 192 /* InterfaceDeclaration */: - case 193 /* TypeAliasDeclaration */: - case 190 /* FunctionDeclaration */: - case 194 /* EnumDeclaration */: - case 197 /* ImportDeclaration */: + case 191: + case 148: + case 198: + case 194: + case 195: + case 196: + case 193: + case 197: + case 200: var parent = getDeclarationContainer(node); - if (!(ts.getCombinedNodeFlags(node) & 1 /* Export */) && !(node.kind !== 197 /* ImportDeclaration */ && parent.kind !== 207 /* SourceFile */ && ts.isInAmbientContext(parent))) { + if (!(ts.getCombinedNodeFlags(node) & 1) && + !(node.kind !== 200 && parent.kind !== 210 && ts.isInAmbientContext(parent))) { return isGlobalSourceFile(parent) || isUsedInExportAssignment(node); } return isDeclarationVisible(parent); - case 126 /* PropertyDeclaration */: - case 125 /* PropertySignature */: - case 130 /* GetAccessor */: - case 131 /* SetAccessor */: - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: - if (node.flags & (32 /* Private */ | 64 /* Protected */)) { + case 128: + case 127: + case 132: + case 133: + case 130: + case 129: + if (node.flags & (32 | 64)) { return false; } - case 129 /* Constructor */: - case 133 /* ConstructSignature */: - case 132 /* CallSignature */: - case 134 /* IndexSignature */: - case 124 /* Parameter */: - case 196 /* ModuleBlock */: - case 136 /* FunctionType */: - case 137 /* ConstructorType */: - case 139 /* TypeLiteral */: - case 135 /* TypeReference */: - case 140 /* ArrayType */: - case 141 /* TupleType */: - case 142 /* UnionType */: - case 143 /* ParenthesizedType */: + case 131: + case 135: + case 134: + case 136: + case 126: + case 199: + case 138: + case 139: + case 141: + case 137: + case 142: + case 143: + case 144: + case 145: return isDeclarationVisible(node.parent); - case 123 /* TypeParameter */: - case 207 /* SourceFile */: + case 125: + case 210: return true; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); @@ -8187,14 +8457,14 @@ var ts; } } function getRootDeclaration(node) { - while (node.kind === 146 /* BindingElement */) { + while (node.kind === 148) { node = node.parent.parent; } return node; } function getDeclarationContainer(node) { node = getRootDeclaration(node); - return node.kind === 188 /* VariableDeclaration */ ? node.parent.parent.parent : node.parent; + return node.kind === 191 ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); @@ -8216,35 +8486,37 @@ var ts; } return parentType; } - if (pattern.kind === 144 /* ObjectBindingPattern */) { + if (pattern.kind === 146) { var name = declaration.propertyName || declaration.name; - var type = getTypeOfPropertyOfType(parentType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, 1 /* Number */) || getIndexTypeOfType(parentType, 0 /* String */); + var type = getTypeOfPropertyOfType(parentType, name.text) || + isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, 1) || + getIndexTypeOfType(parentType, 0); if (!type) { error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); return unknownType; } } else { - if (!isTypeAssignableTo(parentType, anyArrayType)) { + if (!isArrayLikeType(parentType)) { error(pattern, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(parentType)); return unknownType; } if (!declaration.dotDotDotToken) { var propName = "" + ts.indexOf(pattern.elements, declaration); - var type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) : getIndexTypeOfType(parentType, 1 /* Number */); + var type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) : getIndexTypeOfType(parentType, 1); if (!type) { error(declaration, ts.Diagnostics.Type_0_has_no_property_1, typeToString(parentType), propName); return unknownType; } } else { - var type = createArrayType(getIndexTypeOfType(parentType, 1 /* Number */)); + var type = createArrayType(getIndexTypeOfType(parentType, 1)); } } return type; } function getTypeForVariableLikeDeclaration(declaration) { - if (declaration.parent.parent.kind === 178 /* ForInStatement */) { + if (declaration.parent.parent.kind === 180) { return anyType; } if (ts.isBindingPattern(declaration.parent)) { @@ -8253,10 +8525,10 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 124 /* Parameter */) { + if (declaration.kind === 126) { var func = declaration.parent; - if (func.kind === 131 /* SetAccessor */ && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 130 /* GetAccessor */); + if (func.kind === 133 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 132); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } @@ -8269,7 +8541,7 @@ var ts; if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 205 /* ShorthandPropertyAssignment */) { + if (declaration.kind === 208) { return checkIdentifier(declaration.name); } return undefined; @@ -8286,7 +8558,7 @@ var ts; function getTypeFromObjectBindingPattern(pattern) { var members = {}; ts.forEach(pattern.elements, function (e) { - var flags = 4 /* Property */ | 67108864 /* Transient */ | (e.initializer ? 536870912 /* Optional */ : 0); + var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0); var name = e.propertyName || e.name; var symbol = createSymbol(flags, name.text); symbol.type = getTypeFromBindingElement(e); @@ -8298,7 +8570,7 @@ var ts; var hasSpreadElement = false; var elementTypes = []; ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 168 /* OmittedExpression */ || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); + elementTypes.push(e.kind === 170 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); if (e.dotDotDotToken) { hasSpreadElement = true; } @@ -8306,7 +8578,7 @@ var ts; return !elementTypes.length ? anyArrayType : hasSpreadElement ? createArrayType(getUnionType(elementTypes)) : createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern) { - return pattern.kind === 144 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); + return pattern.kind === 146 ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); } function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) { var type = getTypeForVariableLikeDeclaration(declaration); @@ -8314,7 +8586,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 204 /* PropertyAssignment */ ? getWidenedType(type) : type; + return declaration.kind !== 207 ? getWidenedType(type) : type; } if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name); @@ -8322,7 +8594,7 @@ var ts; type = declaration.dotDotDotToken ? anyArrayType : anyType; if (reportErrors && compilerOptions.noImplicitAny) { var root = getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 124 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { + if (!isPrivateWithinAmbient(root) && !(root.kind === 126 && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } } @@ -8331,11 +8603,11 @@ var ts; function getTypeOfVariableOrParameterOrProperty(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - if (symbol.flags & 134217728 /* Prototype */) { + if (symbol.flags & 134217728) { return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.kind === 203 /* CatchClause */) { + if (declaration.kind === 206) { return links.type = anyType; } links.type = resolvingType; @@ -8358,7 +8630,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 130 /* GetAccessor */) { + if (accessor.kind === 132) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -8377,8 +8649,8 @@ var ts; links = links || getSymbolLinks(symbol); if (!links.type) { links.type = resolvingType; - var getter = ts.getDeclarationOfKind(symbol, 130 /* GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 131 /* SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 132); + var setter = ts.getDeclarationOfKind(symbol, 133); var type; var getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { @@ -8408,7 +8680,7 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var getter = ts.getDeclarationOfKind(symbol, 130 /* GetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 132); error(getter, 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)); } } @@ -8416,7 +8688,7 @@ var ts; function getTypeOfFuncClassEnumModule(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - links.type = createObjectType(32768 /* Anonymous */, symbol); + links.type = createObjectType(32768, symbol); } return links.type; } @@ -8442,28 +8714,28 @@ var ts; return links.type; } function getTypeOfSymbol(symbol) { - if (symbol.flags & 16777216 /* Instantiated */) { + if (symbol.flags & 16777216) { return getTypeOfInstantiatedSymbol(symbol); } - if (symbol.flags & (3 /* Variable */ | 4 /* Property */)) { + if (symbol.flags & (3 | 4)) { return getTypeOfVariableOrParameterOrProperty(symbol); } - if (symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 384 /* Enum */ | 512 /* ValueModule */)) { + if (symbol.flags & (16 | 8192 | 32 | 384 | 512)) { return getTypeOfFuncClassEnumModule(symbol); } - if (symbol.flags & 8 /* EnumMember */) { + if (symbol.flags & 8) { return getTypeOfEnumMember(symbol); } - if (symbol.flags & 98304 /* Accessor */) { + if (symbol.flags & 98304) { return getTypeOfAccessors(symbol); } - if (symbol.flags & 8388608 /* Import */) { + if (symbol.flags & 8388608) { return getTypeOfImport(symbol); } return unknownType; } function getTargetType(type) { - return type.flags & 4096 /* Reference */ ? type.target : type; + return type.flags & 4096 ? type.target : type; } function hasBaseType(type, checkBase) { return check(type); @@ -8475,7 +8747,7 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { var result; ts.forEach(symbol.declarations, function (node) { - if (node.kind === 192 /* InterfaceDeclaration */ || node.kind === 191 /* ClassDeclaration */) { + if (node.kind === 195 || node.kind === 194) { var declaration = node; if (declaration.typeParameters && declaration.typeParameters.length) { ts.forEach(declaration.typeParameters, function (node) { @@ -8495,10 +8767,10 @@ var ts; function getDeclaredTypeOfClass(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { - var type = links.declaredType = createObjectType(1024 /* Class */, symbol); + var type = links.declaredType = createObjectType(1024, symbol); var typeParameters = getTypeParametersOfClassOrInterface(symbol); if (typeParameters) { - type.flags |= 4096 /* Reference */; + type.flags |= 4096; type.typeParameters = typeParameters; type.instantiations = {}; type.instantiations[getTypeListId(type.typeParameters)] = type; @@ -8506,17 +8778,17 @@ var ts; type.typeArguments = type.typeParameters; } type.baseTypes = []; - var declaration = ts.getDeclarationOfKind(symbol, 191 /* ClassDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 194); var baseTypeNode = ts.getClassBaseTypeNode(declaration); if (baseTypeNode) { var baseType = getTypeFromTypeReferenceNode(baseTypeNode); if (baseType !== unknownType) { - if (getTargetType(baseType).flags & 1024 /* Class */) { + if (getTargetType(baseType).flags & 1024) { if (type !== baseType && !hasBaseType(baseType, type)) { type.baseTypes.push(baseType); } else { - error(declaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1 /* WriteArrayAsGenericType */)); + error(declaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1)); } } else { @@ -8527,18 +8799,18 @@ var ts; type.declaredProperties = getNamedMembers(symbol.members); type.declaredCallSignatures = emptyArray; type.declaredConstructSignatures = emptyArray; - type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0 /* String */); - type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1 /* Number */); + type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0); + type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1); } return links.declaredType; } function getDeclaredTypeOfInterface(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { - var type = links.declaredType = createObjectType(2048 /* Interface */, symbol); + var type = links.declaredType = createObjectType(2048, symbol); var typeParameters = getTypeParametersOfClassOrInterface(symbol); if (typeParameters) { - type.flags |= 4096 /* Reference */; + type.flags |= 4096; type.typeParameters = typeParameters; type.instantiations = {}; type.instantiations[getTypeListId(type.typeParameters)] = type; @@ -8547,16 +8819,16 @@ var ts; } type.baseTypes = []; ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 192 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 195 && ts.getInterfaceBaseTypeNodes(declaration)) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), function (node) { var baseType = getTypeFromTypeReferenceNode(node); if (baseType !== unknownType) { - if (getTargetType(baseType).flags & (1024 /* Class */ | 2048 /* Interface */)) { + if (getTargetType(baseType).flags & (1024 | 2048)) { if (type !== baseType && !hasBaseType(baseType, type)) { type.baseTypes.push(baseType); } else { - error(declaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1 /* WriteArrayAsGenericType */)); + error(declaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1)); } } else { @@ -8569,8 +8841,8 @@ var ts; type.declaredProperties = getNamedMembers(symbol.members); type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); - type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0 /* String */); - type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1 /* Number */); + type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0); + type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1); } return links.declaredType; } @@ -8578,7 +8850,7 @@ var ts; var links = getSymbolLinks(symbol); if (!links.declaredType) { links.declaredType = resolvingType; - var declaration = ts.getDeclarationOfKind(symbol, 193 /* TypeAliasDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 196); var type = getTypeFromTypeNode(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; @@ -8586,7 +8858,7 @@ var ts; } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 193 /* TypeAliasDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 196); error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; @@ -8594,7 +8866,7 @@ var ts; function getDeclaredTypeOfEnum(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { - var type = createType(128 /* Enum */); + var type = createType(128); type.symbol = symbol; links.declaredType = type; } @@ -8603,9 +8875,9 @@ var ts; function getDeclaredTypeOfTypeParameter(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { - var type = createType(512 /* TypeParameter */); + var type = createType(512); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 123 /* TypeParameter */).constraint) { + if (!ts.getDeclarationOfKind(symbol, 125).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -8620,23 +8892,23 @@ var ts; return links.declaredType; } function getDeclaredTypeOfSymbol(symbol) { - ts.Debug.assert((symbol.flags & 16777216 /* Instantiated */) === 0); - if (symbol.flags & 32 /* Class */) { + ts.Debug.assert((symbol.flags & 16777216) === 0); + if (symbol.flags & 32) { return getDeclaredTypeOfClass(symbol); } - if (symbol.flags & 64 /* Interface */) { + if (symbol.flags & 64) { return getDeclaredTypeOfInterface(symbol); } - if (symbol.flags & 524288 /* TypeAlias */) { + if (symbol.flags & 524288) { return getDeclaredTypeOfTypeAlias(symbol); } - if (symbol.flags & 384 /* Enum */) { + if (symbol.flags & 384) { return getDeclaredTypeOfEnum(symbol); } - if (symbol.flags & 262144 /* TypeParameter */) { + if (symbol.flags & 262144) { return getDeclaredTypeOfTypeParameter(symbol); } - if (symbol.flags & 8388608 /* Import */) { + if (symbol.flags & 8388608) { return getDeclaredTypeOfImport(symbol); } return unknownType; @@ -8682,10 +8954,10 @@ var ts; members = createSymbolTable(type.declaredProperties); ts.forEach(type.baseTypes, function (baseType) { 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 */); + callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(baseType, 0)); + constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(baseType, 1)); + stringIndexType = stringIndexType || getIndexTypeOfType(baseType, 0); + numberIndexType = numberIndexType || getIndexTypeOfType(baseType, 1); }); } setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); @@ -8701,10 +8973,10 @@ var ts; ts.forEach(target.baseTypes, 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 */); + 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); } @@ -8725,9 +8997,9 @@ var ts; function getDefaultConstructSignatures(classType) { if (classType.baseTypes.length) { var baseType = classType.baseTypes[0]; - var baseSignatures = getSignaturesOfType(getTypeOfSymbol(baseType.symbol), 1 /* Construct */); + var baseSignatures = getSignaturesOfType(getTypeOfSymbol(baseType.symbol), 1); return ts.map(baseSignatures, function (baseSignature) { - var signature = baseType.flags & 4096 /* Reference */ ? getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); + var signature = baseType.flags & 4096 ? getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); signature.typeParameters = classType.typeParameters; signature.resolvedReturnType = classType; return signature; @@ -8738,7 +9010,7 @@ var ts; function createTupleTypeMemberSymbols(memberTypes) { var members = {}; for (var i = 0; i < memberTypes.length; i++) { - var symbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "" + i); + var symbol = createSymbol(4 | 67108864, "" + i); symbol.type = memberTypes[i]; members[i] = symbol; } @@ -8794,32 +9066,32 @@ var ts; return getUnionType(indexTypes); } function resolveUnionTypeMembers(type) { - var callSignatures = getUnionSignatures(type.types, 0 /* Call */); - var constructSignatures = getUnionSignatures(type.types, 1 /* Construct */); - var stringIndexType = getUnionIndexType(type.types, 0 /* String */); - var numberIndexType = getUnionIndexType(type.types, 1 /* Number */); + var callSignatures = getUnionSignatures(type.types, 0); + var constructSignatures = getUnionSignatures(type.types, 1); + var stringIndexType = getUnionIndexType(type.types, 0); + var numberIndexType = getUnionIndexType(type.types, 1); setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexType, numberIndexType); } function resolveAnonymousTypeMembers(type) { var symbol = type.symbol; - if (symbol.flags & 2048 /* TypeLiteral */) { + if (symbol.flags & 2048) { var members = symbol.members; var callSignatures = getSignaturesOfSymbol(members["__call"]); var constructSignatures = getSignaturesOfSymbol(members["__new"]); - var stringIndexType = getIndexTypeOfSymbol(symbol, 0 /* String */); - var numberIndexType = getIndexTypeOfSymbol(symbol, 1 /* Number */); + var stringIndexType = getIndexTypeOfSymbol(symbol, 0); + var numberIndexType = getIndexTypeOfSymbol(symbol, 1); } else { var members = emptySymbols; var callSignatures = emptyArray; var constructSignatures = emptyArray; - if (symbol.flags & 1952 /* HasExports */) { + if (symbol.flags & 1952) { members = symbol.exports; } - if (symbol.flags & (16 /* Function */ | 8192 /* Method */)) { + if (symbol.flags & (16 | 8192)) { callSignatures = getSignaturesOfSymbol(symbol); } - if (symbol.flags & 32 /* Class */) { + if (symbol.flags & 32) { var classType = getDeclaredTypeOfClass(symbol); constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); if (!constructSignatures.length) { @@ -8831,22 +9103,22 @@ var ts; } } var stringIndexType = undefined; - var numberIndexType = (symbol.flags & 384 /* Enum */) ? stringType : undefined; + var numberIndexType = (symbol.flags & 384) ? stringType : undefined; } setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); } function resolveObjectOrUnionTypeMembers(type) { if (!type.members) { - if (type.flags & (1024 /* Class */ | 2048 /* Interface */)) { + if (type.flags & (1024 | 2048)) { resolveClassOrInterfaceMembers(type); } - else if (type.flags & 32768 /* Anonymous */) { + else if (type.flags & 32768) { resolveAnonymousTypeMembers(type); } - else if (type.flags & 8192 /* Tuple */) { + else if (type.flags & 8192) { resolveTupleTypeMembers(type); } - else if (type.flags & 16384 /* Union */) { + else if (type.flags & 16384) { resolveUnionTypeMembers(type); } else { @@ -8856,13 +9128,13 @@ var ts; return type; } function getPropertiesOfObjectType(type) { - if (type.flags & 48128 /* ObjectType */) { + if (type.flags & 48128) { return resolveObjectOrUnionTypeMembers(type).properties; } return emptyArray; } function getPropertyOfObjectType(type, name) { - if (type.flags & 48128 /* ObjectType */) { + if (type.flags & 48128) { var resolved = resolveObjectOrUnionTypeMembers(type); if (ts.hasProperty(resolved.members, name)) { var symbol = resolved.members[name]; @@ -8883,29 +9155,32 @@ var ts; return result; } function getPropertiesOfType(type) { - if (type.flags & 16384 /* Union */) { + if (type.flags & 16384) { return getPropertiesOfUnionType(type); } return getPropertiesOfObjectType(getApparentType(type)); } function getApparentType(type) { - if (type.flags & 512 /* TypeParameter */) { + if (type.flags & 512) { do { type = getConstraintOfTypeParameter(type); - } while (type && type.flags & 512 /* TypeParameter */); + } while (type && type.flags & 512); if (!type) { type = emptyObjectType; } } - if (type.flags & 258 /* StringLike */) { + if (type.flags & 258) { type = globalStringType; } - else if (type.flags & 132 /* NumberLike */) { + else if (type.flags & 132) { type = globalNumberType; } - else if (type.flags & 8 /* Boolean */) { + else if (type.flags & 8) { type = globalBooleanType; } + else if (type.flags & 1048576) { + type = globalESSymbolType; + } return type; } function createUnionProperty(unionType, name) { @@ -8935,7 +9210,7 @@ var ts; } propTypes.push(getTypeOfSymbol(prop)); } - var result = createSymbol(4 /* Property */ | 67108864 /* Transient */ | 268435456 /* UnionProperty */, name); + var result = createSymbol(4 | 67108864 | 268435456, name); result.unionType = unionType; result.declarations = declarations; result.type = getUnionType(propTypes); @@ -8953,12 +9228,12 @@ var ts; return property; } function getPropertyOfType(type, name) { - if (type.flags & 16384 /* Union */) { + if (type.flags & 16384) { return getPropertyOfUnionType(type, name); } - if (!(type.flags & 48128 /* ObjectType */)) { + if (!(type.flags & 48128)) { type = getApparentType(type); - if (!(type.flags & 48128 /* ObjectType */)) { + if (!(type.flags & 48128)) { return undefined; } } @@ -8977,9 +9252,9 @@ var ts; return getPropertyOfObjectType(globalObjectType, name); } function getSignaturesOfObjectOrUnionType(type, kind) { - if (type.flags & (48128 /* ObjectType */ | 16384 /* Union */)) { + if (type.flags & (48128 | 16384)) { var resolved = resolveObjectOrUnionTypeMembers(type); - return kind === 0 /* Call */ ? resolved.callSignatures : resolved.constructSignatures; + return kind === 0 ? resolved.callSignatures : resolved.constructSignatures; } return emptyArray; } @@ -8987,9 +9262,9 @@ var ts; return getSignaturesOfObjectOrUnionType(getApparentType(type), kind); } function getIndexTypeOfObjectOrUnionType(type, kind) { - if (type.flags & (48128 /* ObjectType */ | 16384 /* Union */)) { + if (type.flags & (48128 | 16384)) { var resolved = resolveObjectOrUnionTypeMembers(type); - return kind === 0 /* String */ ? resolved.stringIndexType : resolved.numberIndexType; + return kind === 0 ? resolved.stringIndexType : resolved.numberIndexType; } } function getIndexTypeOfType(type, kind) { @@ -9008,7 +9283,7 @@ var ts; function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 129 /* Constructor */ ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; + var classType = declaration.kind === 131 ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; var hasStringLiterals = false; @@ -9016,7 +9291,7 @@ var ts; for (var i = 0, n = declaration.parameters.length; i < n; i++) { var param = declaration.parameters[i]; parameters.push(param.symbol); - if (param.type && param.type.kind === 8 /* StringLiteral */) { + if (param.type && param.type.kind === 8) { hasStringLiterals = true; } if (minArgumentCount < 0) { @@ -9036,8 +9311,8 @@ var ts; returnType = getTypeFromTypeNode(declaration.type); } else { - if (declaration.kind === 130 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 131 /* SetAccessor */); + if (declaration.kind === 132 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 133); returnType = getAnnotatedAccessorType(setter); } if (!returnType && ts.nodeIsMissing(declaration.body)) { @@ -9055,19 +9330,19 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 136 /* FunctionType */: - case 137 /* ConstructorType */: - case 190 /* FunctionDeclaration */: - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: - case 129 /* Constructor */: - case 132 /* CallSignature */: - case 133 /* ConstructSignature */: - case 134 /* IndexSignature */: - case 130 /* GetAccessor */: - case 131 /* SetAccessor */: - case 156 /* FunctionExpression */: - case 157 /* ArrowFunction */: + case 138: + case 139: + case 193: + case 130: + case 129: + case 131: + case 134: + case 135: + case 136: + case 132: + case 133: + case 158: + case 159: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -9112,7 +9387,7 @@ var ts; function getRestTypeOfSignature(signature) { if (signature.hasRestParameter) { var type = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]); - if (type.flags & 4096 /* Reference */ && type.target === globalArrayType) { + if (type.flags & 4096 && type.target === globalArrayType) { return type.typeArguments[0]; } } @@ -9136,8 +9411,8 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 129 /* Constructor */ || signature.declaration.kind === 133 /* ConstructSignature */; - var type = createObjectType(32768 /* Anonymous */ | 65536 /* FromSignature */); + var isConstructor = signature.declaration.kind === 131 || signature.declaration.kind === 135; + var type = createObjectType(32768 | 65536); type.members = emptySymbols; type.properties = emptyArray; type.callSignatures = !isConstructor ? [signature] : emptyArray; @@ -9150,7 +9425,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 /* Number */ ? 117 /* NumberKeyword */ : 119 /* StringKeyword */; + var syntaxKind = kind === 1 ? 117 : 119; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; @@ -9177,7 +9452,7 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 123 /* TypeParameter */).constraint); + type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 125).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -9203,13 +9478,13 @@ var ts; for (var i = 0; i < types.length; i++) { result |= types[i].flags; } - return result & 786432 /* RequiresWidening */; + return result & 786432; } function createTypeReference(target, typeArguments) { var id = getTypeListId(typeArguments); var type = target.instantiations[id]; if (!type) { - var flags = 4096 /* Reference */ | getWideningFlagsOfTypes(typeArguments); + var flags = 4096 | getWideningFlagsOfTypes(typeArguments); type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; @@ -9225,17 +9500,17 @@ var ts; while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { currentNode = currentNode.parent; } - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 123 /* TypeParameter */; + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 125; return links.isIllegalTypeReferenceInConstraint; } function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { var typeParameterSymbol; function check(n) { - if (n.kind === 135 /* TypeReference */ && n.typeName.kind === 64 /* Identifier */) { + if (n.kind === 137 && n.typeName.kind === 64) { var links = getNodeLinks(n); if (links.isIllegalTypeReferenceInConstraint === undefined) { - var symbol = resolveName(typeParameter, n.typeName.text, 793056 /* Type */, undefined, undefined); - if (symbol && (symbol.flags & 262144 /* TypeParameter */)) { + var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); + if (symbol && (symbol.flags & 262144)) { links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { return d.parent == typeParameter.parent; }); } } @@ -9253,21 +9528,21 @@ var ts; function getTypeFromTypeReferenceNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - var symbol = resolveEntityName(node, node.typeName, 793056 /* Type */); + var symbol = resolveEntityName(node, node.typeName, 793056); if (symbol) { var type; - if ((symbol.flags & 262144 /* TypeParameter */) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { + if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { type = unknownType; } else { type = getDeclaredTypeOfSymbol(symbol); - if (type.flags & (1024 /* Class */ | 2048 /* Interface */) && type.flags & 4096 /* Reference */) { + if (type.flags & (1024 | 2048) && type.flags & 4096) { var typeParameters = type.typeParameters; if (node.typeArguments && node.typeArguments.length === typeParameters.length) { type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNode)); } else { - error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1 /* WriteArrayAsGenericType */), typeParameters.length); + error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); type = undefined; } } @@ -9296,9 +9571,9 @@ var ts; for (var i = 0; i < declarations.length; i++) { var declaration = declarations[i]; switch (declaration.kind) { - case 191 /* ClassDeclaration */: - case 192 /* InterfaceDeclaration */: - case 194 /* EnumDeclaration */: + case 194: + case 195: + case 197: return declaration; } } @@ -9307,7 +9582,7 @@ var ts; return emptyObjectType; } var type = getDeclaredTypeOfSymbol(symbol); - if (!(type.flags & 48128 /* ObjectType */)) { + if (!(type.flags & 48128)) { error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbol.name); return emptyObjectType; } @@ -9317,11 +9592,20 @@ var ts; } return type; } - function getGlobalSymbol(name) { - return resolveName(undefined, name, 793056 /* Type */, ts.Diagnostics.Cannot_find_global_type_0, name); + function getGlobalValueSymbol(name) { + return getGlobalSymbol(name, 107455, ts.Diagnostics.Cannot_find_global_value_0); + } + function getGlobalTypeSymbol(name) { + return getGlobalSymbol(name, 793056, ts.Diagnostics.Cannot_find_global_type_0); + } + function getGlobalSymbol(name, meaning, diagnostic) { + return resolveName(undefined, name, meaning, diagnostic, name); } function getGlobalType(name) { - return getTypeOfGlobalSymbol(getGlobalSymbol(name), 0); + return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), 0); + } + function getGlobalESSymbolConstructorSymbol() { + return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); } function createArrayType(elementType) { var arrayType = globalArrayType || getDeclaredTypeOfSymbol(globalArraySymbol); @@ -9338,7 +9622,7 @@ var ts; var id = getTypeListId(elementTypes); var type = tupleTypes[id]; if (!type) { - type = tupleTypes[id] = createObjectType(8192 /* Tuple */); + type = tupleTypes[id] = createObjectType(8192); type.elementTypes = elementTypes; } return type; @@ -9351,7 +9635,7 @@ var ts; return links.resolvedType; } function addTypeToSortedSet(sortedSet, type) { - if (type.flags & 16384 /* Union */) { + if (type.flags & 16384) { addTypesToSortedSet(sortedSet, type.types); } else { @@ -9389,7 +9673,7 @@ var ts; } function containsAnyType(types) { for (var i = 0; i < types.length; i++) { - if (types[i].flags & 1 /* Any */) { + if (types[i].flags & 1) { return true; } } @@ -9426,7 +9710,7 @@ var ts; var id = getTypeListId(sortedTypes); var type = unionTypes[id]; if (!type) { - type = unionTypes[id] = createObjectType(16384 /* Union */ | getWideningFlagsOfTypes(sortedTypes)); + type = unionTypes[id] = createObjectType(16384 | getWideningFlagsOfTypes(sortedTypes)); type.types = sortedTypes; } return type; @@ -9441,7 +9725,7 @@ var ts; function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = createObjectType(32768 /* Anonymous */, node.symbol); + links.resolvedType = createObjectType(32768, node.symbol); } return links.resolvedType; } @@ -9449,7 +9733,7 @@ var ts; if (ts.hasProperty(stringLiteralTypes, node.text)) { return stringLiteralTypes[node.text]; } - var type = stringLiteralTypes[node.text] = createType(256 /* StringLiteral */); + var type = stringLiteralTypes[node.text] = createType(256); type.text = ts.getTextOfNode(node); return type; } @@ -9462,36 +9746,38 @@ var ts; } function getTypeFromTypeNode(node) { switch (node.kind) { - case 110 /* AnyKeyword */: + case 110: return anyType; - case 119 /* StringKeyword */: + case 119: return stringType; - case 117 /* NumberKeyword */: + case 117: return numberType; - case 111 /* BooleanKeyword */: + case 111: return booleanType; - case 98 /* VoidKeyword */: + case 120: + return esSymbolType; + case 98: return voidType; - case 8 /* StringLiteral */: + case 8: return getTypeFromStringLiteral(node); - case 135 /* TypeReference */: + case 137: return getTypeFromTypeReferenceNode(node); - case 138 /* TypeQuery */: + case 140: return getTypeFromTypeQueryNode(node); - case 140 /* ArrayType */: + case 142: return getTypeFromArrayTypeNode(node); - case 141 /* TupleType */: + case 143: return getTypeFromTupleTypeNode(node); - case 142 /* UnionType */: + case 144: return getTypeFromUnionTypeNode(node); - case 143 /* ParenthesizedType */: + case 145: return getTypeFromTypeNode(node.type); - case 136 /* FunctionType */: - case 137 /* ConstructorType */: - case 139 /* TypeLiteral */: + case 138: + case 139: + case 141: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 64 /* Identifier */: - case 121 /* QualifiedName */: + case 64: + case 123: var symbol = getSymbolInfo(node); return symbol && getDeclaredTypeOfSymbol(symbol); default: @@ -9563,7 +9849,7 @@ var ts; return function (t) { return mapper2(mapper1(t)); }; } function instantiateTypeParameter(typeParameter, mapper) { - var result = createType(512 /* TypeParameter */); + var result = createType(512); result.symbol = typeParameter.symbol; if (typeParameter.constraint) { result.constraint = instantiateType(typeParameter.constraint, mapper); @@ -9585,12 +9871,12 @@ var ts; return result; } function instantiateSymbol(symbol, mapper) { - if (symbol.flags & 16777216 /* Instantiated */) { + if (symbol.flags & 16777216) { var links = getSymbolLinks(symbol); symbol = links.target; mapper = combineTypeMappers(links.mapper, mapper); } - var result = createSymbol(16777216 /* Instantiated */ | 67108864 /* Transient */ | symbol.flags, symbol.name); + var result = createSymbol(16777216 | 67108864 | symbol.flags, symbol.name); result.declarations = symbol.declarations; result.parent = symbol.parent; result.target = symbol; @@ -9601,13 +9887,13 @@ var ts; return result; } function instantiateAnonymousType(type, mapper) { - var result = createObjectType(32768 /* Anonymous */, type.symbol); + var result = createObjectType(32768, 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 */); + 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) @@ -9616,44 +9902,46 @@ var ts; } function instantiateType(type, mapper) { if (mapper !== identityMapper) { - if (type.flags & 512 /* TypeParameter */) { + if (type.flags & 512) { return mapper(type); } - if (type.flags & 32768 /* Anonymous */) { - return type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) ? instantiateAnonymousType(type, mapper) : type; + if (type.flags & 32768) { + return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? instantiateAnonymousType(type, mapper) : type; } - if (type.flags & 4096 /* Reference */) { + if (type.flags & 4096) { return createTypeReference(type.target, instantiateList(type.typeArguments, mapper, instantiateType)); } - if (type.flags & 8192 /* Tuple */) { + if (type.flags & 8192) { return createTupleType(instantiateList(type.elementTypes, mapper, instantiateType)); } - if (type.flags & 16384 /* Union */) { + if (type.flags & 16384) { return getUnionType(instantiateList(type.types, mapper, instantiateType), true); } } return type; } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 128 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 156 /* FunctionExpression */: - case 157 /* ArrowFunction */: + case 158: + case 159: return isContextSensitiveFunctionLikeDeclaration(node); - case 148 /* ObjectLiteralExpression */: + case 150: return ts.forEach(node.properties, isContextSensitive); - case 147 /* ArrayLiteralExpression */: + case 149: return ts.forEach(node.elements, isContextSensitive); - case 164 /* ConditionalExpression */: - return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 163 /* BinaryExpression */: - return node.operator === 49 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 204 /* PropertyAssignment */: + case 166: + return isContextSensitive(node.whenTrue) || + isContextSensitive(node.whenFalse); + case 165: + return node.operatorToken.kind === 49 && + (isContextSensitive(node.left) || isContextSensitive(node.right)); + case 207: return isContextSensitive(node.initializer); - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: + case 130: + case 129: return isContextSensitiveFunctionLikeDeclaration(node); - case 155 /* ParenthesizedExpression */: + case 157: return isContextSensitive(node.expression); } return false; @@ -9662,10 +9950,10 @@ var ts; return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { return p.type; }); } function getTypeWithoutConstructors(type) { - if (type.flags & 48128 /* ObjectType */) { + if (type.flags & 48128) { var resolved = resolveObjectOrUnionTypeMembers(type); if (resolved.constructSignatures.length) { - var result = createObjectType(32768 /* Anonymous */, type.symbol); + var result = createObjectType(32768, type.symbol); result.members = resolved.members; result.properties = resolved.properties; result.callSignatures = resolved.callSignatures; @@ -9682,7 +9970,7 @@ var ts; return checkTypeRelatedTo(source, target, identityRelation, undefined); } function compareTypes(source, target) { - return checkTypeRelatedTo(source, target, identityRelation, undefined) ? -1 /* True */ : 0 /* False */; + return checkTypeRelatedTo(source, target, identityRelation, undefined) ? -1 : 0; } function isTypeSubtypeOf(source, target) { return checkTypeSubtypeOf(source, target, undefined); @@ -9724,7 +10012,7 @@ var ts; } diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo)); } - return result !== 0 /* False */; + return result !== 0; function reportError(message, arg0, arg1, arg2) { errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); } @@ -9732,35 +10020,35 @@ var ts; if (elaborateErrors === void 0) { elaborateErrors = false; } var result; if (source === target) - return -1 /* True */; + return -1; if (relation !== identityRelation) { - if (target.flags & 1 /* Any */) - return -1 /* True */; + if (target.flags & 1) + return -1; if (source === undefinedType) - return -1 /* True */; + return -1; if (source === nullType && target !== undefinedType) - return -1 /* True */; - if (source.flags & 128 /* Enum */ && target === numberType) - return -1 /* True */; - if (source.flags & 256 /* StringLiteral */ && target === stringType) - return -1 /* True */; + return -1; + if (source.flags & 128 && target === numberType) + return -1; + if (source.flags & 256 && target === stringType) + return -1; if (relation === assignableRelation) { - if (source.flags & 1 /* Any */) - return -1 /* True */; - if (source === numberType && target.flags & 128 /* Enum */) - return -1 /* True */; + if (source.flags & 1) + return -1; + if (source === numberType && target.flags & 128) + return -1; } } - if (source.flags & 16384 /* Union */ || target.flags & 16384 /* Union */) { + if (source.flags & 16384 || target.flags & 16384) { if (relation === identityRelation) { - if (source.flags & 16384 /* Union */ && target.flags & 16384 /* Union */) { + if (source.flags & 16384 && target.flags & 16384) { if (result = unionTypeRelatedToUnionType(source, target)) { if (result &= unionTypeRelatedToUnionType(target, source)) { return result; } } } - else if (source.flags & 16384 /* Union */) { + else if (source.flags & 16384) { if (result = unionTypeRelatedToType(source, target, reportErrors)) { return result; } @@ -9772,7 +10060,7 @@ var ts; } } else { - if (source.flags & 16384 /* Union */) { + if (source.flags & 16384) { if (result = unionTypeRelatedToType(source, target, reportErrors)) { return result; } @@ -9784,21 +10072,22 @@ var ts; } } } - else if (source.flags & 512 /* TypeParameter */ && target.flags & 512 /* TypeParameter */) { + else if (source.flags & 512 && target.flags & 512) { if (result = typeParameterRelatedTo(source, target, reportErrors)) { return result; } } else { var saveErrorInfo = errorInfo; - if (source.flags & 4096 /* Reference */ && target.flags & 4096 /* Reference */ && source.target === target.target) { + if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { return result; } } var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & 48128 /* ObjectType */ && target.flags & 48128 /* ObjectType */ && (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { + if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && + (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { errorInfo = saveErrorInfo; return result; } @@ -9808,20 +10097,20 @@ var ts; var sourceType = typeToString(source); var targetType = typeToString(target); if (sourceType === targetType) { - sourceType = typeToString(source, undefined, 128 /* UseFullyQualifiedType */); - targetType = typeToString(target, undefined, 128 /* UseFullyQualifiedType */); + sourceType = typeToString(source, undefined, 128); + targetType = typeToString(target, undefined, 128); } reportError(headMessage, sourceType, targetType); } - return 0 /* False */; + return 0; } function unionTypeRelatedToUnionType(source, target) { - var result = -1 /* True */; + var result = -1; var sourceTypes = source.types; for (var i = 0, len = sourceTypes.length; i < len; i++) { var related = typeRelatedToUnionType(sourceTypes[i], target, false); if (!related) { - return 0 /* False */; + return 0; } result &= related; } @@ -9835,26 +10124,26 @@ var ts; return related; } } - return 0 /* False */; + return 0; } function unionTypeRelatedToType(source, target, reportErrors) { - var result = -1 /* True */; + var result = -1; var sourceTypes = source.types; for (var i = 0, len = sourceTypes.length; i < len; i++) { var related = isRelatedTo(sourceTypes[i], target, reportErrors); if (!related) { - return 0 /* False */; + return 0; } result &= related; } return result; } function typesRelatedTo(sources, targets, reportErrors) { - var result = -1 /* True */; + var result = -1; for (var i = 0, len = sources.length; i < len; i++) { var related = isRelatedTo(sources[i], targets[i], reportErrors); if (!related) { - return 0 /* False */; + return 0; } result &= related; } @@ -9863,13 +10152,13 @@ var ts; function typeParameterRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { if (source.symbol.name !== target.symbol.name) { - return 0 /* False */; + return 0; } if (source.constraint === target.constraint) { - return -1 /* True */; + return -1; } if (source.constraint === noConstraintType || target.constraint === noConstraintType) { - return 0 /* False */; + return 0; } return isRelatedTo(source.constraint, target.constraint, reportErrors); } @@ -9877,35 +10166,35 @@ var ts; while (true) { var constraint = getConstraintOfTypeParameter(source); if (constraint === target) - return -1 /* True */; - if (!(constraint && constraint.flags & 512 /* TypeParameter */)) + return -1; + if (!(constraint && constraint.flags & 512)) break; source = constraint; } - return 0 /* False */; + return 0; } } function objectTypeRelatedTo(source, target, reportErrors, elaborateErrors) { if (elaborateErrors === void 0) { elaborateErrors = false; } if (overflow) { - return 0 /* False */; + return 0; } var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; var related = relation[id]; if (related !== undefined) { - if (!elaborateErrors || (related === 3 /* FailedAndReported */)) { - return related === 1 /* Succeeded */ ? -1 /* True */ : 0 /* False */; + if (!elaborateErrors || (related === 3)) { + return related === 1 ? -1 : 0; } } if (depth > 0) { for (var i = 0; i < depth; i++) { if (maybeStack[i][id]) { - return 1 /* Maybe */; + return 1; } } if (depth === 100) { overflow = true; - return 0 /* False */; + return 0; } } else { @@ -9917,7 +10206,7 @@ var ts; sourceStack[depth] = source; targetStack[depth] = target; maybeStack[depth] = {}; - maybeStack[depth][id] = 1 /* Succeeded */; + maybeStack[depth][id] = 1; depth++; var saveExpandingFlags = expandingFlags; if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack)) @@ -9925,14 +10214,14 @@ var ts; if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack)) expandingFlags |= 2; if (expandingFlags === 3) { - var result = 1 /* Maybe */; + var result = 1; } else { var result = propertiesRelatedTo(source, target, reportErrors); if (result) { - result &= signaturesRelatedTo(source, target, 0 /* Call */, reportErrors); + result &= signaturesRelatedTo(source, target, 0, reportErrors); if (result) { - result &= signaturesRelatedTo(source, target, 1 /* Construct */, reportErrors); + result &= signaturesRelatedTo(source, target, 1, reportErrors); if (result) { result &= stringIndexTypesRelatedTo(source, target, reportErrors); if (result) { @@ -9946,21 +10235,21 @@ var ts; depth--; if (result) { var maybeCache = maybeStack[depth]; - var destinationCache = (result === -1 /* True */ || depth === 0) ? relation : maybeStack[depth - 1]; + var destinationCache = (result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; ts.copyMap(maybeCache, destinationCache); } else { - relation[id] = reportErrors ? 3 /* FailedAndReported */ : 2 /* Failed */; + relation[id] = reportErrors ? 3 : 2; } return result; } function isDeeplyNestedGeneric(type, stack) { - if (type.flags & 4096 /* Reference */ && depth >= 10) { + if (type.flags & 4096 && depth >= 10) { var target = type.target; var count = 0; for (var i = 0; i < depth; i++) { var t = stack[i]; - if (t.flags & 4096 /* Reference */ && t.target === target) { + if (t.flags & 4096 && t.target === target) { count++; if (count >= 10) return true; @@ -9973,67 +10262,67 @@ var ts; if (relation === identityRelation) { return propertiesIdenticalTo(source, target); } - var result = -1 /* True */; + var result = -1; var properties = getPropertiesOfObjectType(target); - var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072 /* ObjectLiteral */); + var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); for (var i = 0; i < properties.length; i++) { var targetProp = properties[i]; var sourceProp = getPropertyOfType(source, targetProp.name); if (sourceProp !== targetProp) { if (!sourceProp) { - if (!(targetProp.flags & 536870912 /* Optional */) || requireOptionalProperties) { + if (!(targetProp.flags & 536870912) || requireOptionalProperties) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); } - return 0 /* False */; + return 0; } } - else if (!(targetProp.flags & 134217728 /* Prototype */)) { + else if (!(targetProp.flags & 134217728)) { var sourceFlags = getDeclarationFlagsFromSymbol(sourceProp); var targetFlags = getDeclarationFlagsFromSymbol(targetProp); - if (sourceFlags & 32 /* Private */ || targetFlags & 32 /* Private */) { + if (sourceFlags & 32 || targetFlags & 32) { if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { if (reportErrors) { - if (sourceFlags & 32 /* Private */ && targetFlags & 32 /* Private */) { + if (sourceFlags & 32 && targetFlags & 32) { reportError(ts.Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp)); } else { - reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourceFlags & 32 /* Private */ ? source : target), typeToString(sourceFlags & 32 /* Private */ ? target : source)); + reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourceFlags & 32 ? source : target), typeToString(sourceFlags & 32 ? target : source)); } } - return 0 /* False */; + return 0; } } - else if (targetFlags & 64 /* Protected */) { - var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32 /* Class */; + else if (targetFlags & 64) { + var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32; var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(sourceProp.parent) : undefined; var targetClass = getDeclaredTypeOfSymbol(targetProp.parent); if (!sourceClass || !hasBaseType(sourceClass, targetClass)) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass)); } - return 0 /* False */; + return 0; } } - else if (sourceFlags & 64 /* Protected */) { + else if (sourceFlags & 64) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); } - return 0 /* False */; + return 0; } var related = isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); if (!related) { if (reportErrors) { reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp)); } - return 0 /* False */; + return 0; } result &= related; - if (sourceProp.flags & 536870912 /* Optional */ && !(targetProp.flags & 536870912 /* Optional */)) { + if (sourceProp.flags & 536870912 && !(targetProp.flags & 536870912)) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); } - return 0 /* False */; + return 0; } } } @@ -10044,18 +10333,18 @@ var ts; var sourceProperties = getPropertiesOfObjectType(source); var targetProperties = getPropertiesOfObjectType(target); if (sourceProperties.length !== targetProperties.length) { - return 0 /* False */; + return 0; } - var result = -1 /* True */; + var result = -1; for (var i = 0, len = sourceProperties.length; i < len; ++i) { var sourceProp = sourceProperties[i]; var targetProp = getPropertyOfObjectType(target, sourceProp.name); if (!targetProp) { - return 0 /* False */; + return 0; } var related = compareProperties(sourceProp, targetProp, isRelatedTo); if (!related) { - return 0 /* False */; + return 0; } result &= related; } @@ -10066,19 +10355,19 @@ var ts; return signaturesIdenticalTo(source, target, kind); } if (target === anyFunctionType || source === anyFunctionType) { - return -1 /* True */; + return -1; } var sourceSignatures = getSignaturesOfType(source, kind); var targetSignatures = getSignaturesOfType(target, kind); - var result = -1 /* True */; + var result = -1; var saveErrorInfo = errorInfo; outer: for (var i = 0; i < targetSignatures.length; i++) { var t = targetSignatures[i]; - if (!t.hasStringLiterals || target.flags & 65536 /* FromSignature */) { + if (!t.hasStringLiterals || target.flags & 65536) { var localErrors = reportErrors; for (var j = 0; j < sourceSignatures.length; j++) { var s = sourceSignatures[j]; - if (!s.hasStringLiterals || source.flags & 65536 /* FromSignature */) { + if (!s.hasStringLiterals || source.flags & 65536) { var related = signatureRelatedTo(s, t, localErrors); if (related) { result &= related; @@ -10088,17 +10377,17 @@ var ts; localErrors = false; } } - return 0 /* False */; + return 0; } } return result; } function signatureRelatedTo(source, target, reportErrors) { if (source === target) { - return -1 /* True */; + return -1; } if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) { - return 0 /* False */; + return 0; } var sourceMax = source.parameters.length; var targetMax = target.parameters.length; @@ -10121,7 +10410,7 @@ var ts; } source = getErasedSignature(source); target = getErasedSignature(target); - var result = -1 /* True */; + var result = -1; for (var i = 0; i < checkCount; i++) { var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); @@ -10133,7 +10422,7 @@ var ts; if (reportErrors) { reportError(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, source.parameters[i < sourceMax ? i : sourceMax].name, target.parameters[i < targetMax ? i : targetMax].name); } - return 0 /* False */; + return 0; } errorInfo = saveErrorInfo; } @@ -10149,13 +10438,13 @@ var ts; var sourceSignatures = getSignaturesOfType(source, kind); var targetSignatures = getSignaturesOfType(target, kind); if (sourceSignatures.length !== targetSignatures.length) { - return 0 /* False */; + return 0; } - var result = -1 /* True */; + var result = -1; for (var i = 0, len = sourceSignatures.length; i < len; ++i) { var related = compareSignatures(sourceSignatures[i], targetSignatures[i], true, isRelatedTo); if (!related) { - return 0 /* False */; + return 0; } result &= related; } @@ -10163,41 +10452,41 @@ var ts; } function stringIndexTypesRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { - return indexTypesIdenticalTo(0 /* String */, source, target); + return indexTypesIdenticalTo(0, source, target); } - var targetType = getIndexTypeOfType(target, 0 /* String */); + var targetType = getIndexTypeOfType(target, 0); if (targetType) { - var sourceType = getIndexTypeOfType(source, 0 /* String */); + var sourceType = getIndexTypeOfType(source, 0); if (!sourceType) { if (reportErrors) { reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); } - return 0 /* False */; + return 0; } var related = isRelatedTo(sourceType, targetType, reportErrors); if (!related) { if (reportErrors) { reportError(ts.Diagnostics.Index_signatures_are_incompatible); } - return 0 /* False */; + return 0; } return related; } - return -1 /* True */; + return -1; } function numberIndexTypesRelatedTo(source, target, reportErrors) { if (relation === identityRelation) { - return indexTypesIdenticalTo(1 /* Number */, source, target); + return indexTypesIdenticalTo(1, source, target); } - var targetType = getIndexTypeOfType(target, 1 /* Number */); + var targetType = getIndexTypeOfType(target, 1); if (targetType) { - var sourceStringType = getIndexTypeOfType(source, 0 /* String */); - var sourceNumberType = getIndexTypeOfType(source, 1 /* Number */); + var sourceStringType = getIndexTypeOfType(source, 0); + var sourceNumberType = getIndexTypeOfType(source, 1); if (!(sourceStringType || sourceNumberType)) { if (reportErrors) { reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); } - return 0 /* False */; + return 0; } if (sourceStringType && sourceNumberType) { var related = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); @@ -10209,70 +10498,72 @@ var ts; if (reportErrors) { reportError(ts.Diagnostics.Index_signatures_are_incompatible); } - return 0 /* False */; + return 0; } return related; } - return -1 /* True */; + return -1; } function indexTypesIdenticalTo(indexKind, source, target) { var targetType = getIndexTypeOfType(target, indexKind); var sourceType = getIndexTypeOfType(source, indexKind); if (!sourceType && !targetType) { - return -1 /* True */; + return -1; } if (sourceType && targetType) { return isRelatedTo(sourceType, targetType); } - return 0 /* False */; + return 0; } } function isPropertyIdenticalTo(sourceProp, targetProp) { - return compareProperties(sourceProp, targetProp, compareTypes) !== 0 /* False */; + return compareProperties(sourceProp, targetProp, compareTypes) !== 0; } function compareProperties(sourceProp, targetProp, compareTypes) { if (sourceProp === targetProp) { - return -1 /* True */; + return -1; } - var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (32 /* Private */ | 64 /* Protected */); - var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (32 /* Private */ | 64 /* Protected */); + var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (32 | 64); + var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (32 | 64); if (sourcePropAccessibility !== targetPropAccessibility) { - return 0 /* False */; + return 0; } if (sourcePropAccessibility) { if (getTargetSymbol(sourceProp) !== getTargetSymbol(targetProp)) { - return 0 /* False */; + return 0; } } else { - if ((sourceProp.flags & 536870912 /* Optional */) !== (targetProp.flags & 536870912 /* Optional */)) { - return 0 /* False */; + if ((sourceProp.flags & 536870912) !== (targetProp.flags & 536870912)) { + return 0; } } return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); } function compareSignatures(source, target, compareReturnTypes, compareTypes) { if (source === target) { - return -1 /* True */; + return -1; } - if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { - return 0 /* False */; + if (source.parameters.length !== target.parameters.length || + source.minArgumentCount !== target.minArgumentCount || + source.hasRestParameter !== target.hasRestParameter) { + return 0; } - var result = -1 /* True */; + var result = -1; if (source.typeParameters && target.typeParameters) { if (source.typeParameters.length !== target.typeParameters.length) { - return 0 /* False */; + return 0; } for (var i = 0, len = source.typeParameters.length; i < len; ++i) { var related = compareTypes(source.typeParameters[i], target.typeParameters[i]); if (!related) { - return 0 /* False */; + return 0; } result &= related; } } else if (source.typeParameters || target.typeParameters) { - return 0 /* False */; + return 0; } source = getErasedSignature(source); target = getErasedSignature(target); @@ -10281,7 +10572,7 @@ var ts; var t = target.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); var related = compareTypes(s, t); if (!related) { - return 0 /* False */; + return 0; } result &= related; } @@ -10327,7 +10618,10 @@ var ts; checkTypeSubtypeOf(bestSupertypeDownfallType, bestSupertype, errorLocation, ts.Diagnostics.Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0, errorMessageChainHead); } function isArrayType(type) { - return type.flags & 4096 /* Reference */ && type.target === globalArrayType; + return type.flags & 4096 && type.target === globalArrayType; + } + function isArrayLikeType(type) { + return !(type.flags & (32 | 64)) && isTypeAssignableTo(type, anyArrayType); } function isTupleLikeType(type) { return !!getPropertyOfType(type, "0"); @@ -10339,7 +10633,7 @@ var ts; var propType = getTypeOfSymbol(p); var widenedType = getWidenedType(propType); if (propType !== widenedType) { - var symbol = createSymbol(p.flags | 67108864 /* Transient */, p.name); + var symbol = createSymbol(p.flags | 67108864, p.name); symbol.declarations = p.declarations; symbol.parent = p.parent; symbol.type = widenedType; @@ -10350,8 +10644,8 @@ var ts; } members[p.name] = p; }); - var stringIndexType = getIndexTypeOfType(type, 0 /* String */); - var numberIndexType = getIndexTypeOfType(type, 1 /* Number */); + var stringIndexType = getIndexTypeOfType(type, 0); + var numberIndexType = getIndexTypeOfType(type, 1); if (stringIndexType) stringIndexType = getWidenedType(stringIndexType); if (numberIndexType) @@ -10359,14 +10653,14 @@ var ts; return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexType, numberIndexType); } function getWidenedType(type) { - if (type.flags & 786432 /* RequiresWidening */) { - if (type.flags & (32 /* Undefined */ | 64 /* Null */)) { + if (type.flags & 786432) { + if (type.flags & (32 | 64)) { return anyType; } - if (type.flags & 131072 /* ObjectLiteral */) { + if (type.flags & 131072) { return getWidenedTypeOfObjectLiteral(type); } - if (type.flags & 16384 /* Union */) { + if (type.flags & 16384) { return getUnionType(ts.map(type.types, getWidenedType)); } if (isArrayType(type)) { @@ -10376,7 +10670,7 @@ var ts; return type; } function reportWideningErrorsInType(type) { - if (type.flags & 16384 /* Union */) { + if (type.flags & 16384) { var errorReported = false; ts.forEach(type.types, function (t) { if (reportWideningErrorsInType(t)) { @@ -10388,11 +10682,11 @@ var ts; if (isArrayType(type)) { return reportWideningErrorsInType(type.typeArguments[0]); } - if (type.flags & 131072 /* ObjectLiteral */) { + if (type.flags & 131072) { var errorReported = false; ts.forEach(getPropertiesOfObjectType(type), function (p) { var t = getTypeOfSymbol(p); - if (t.flags & 262144 /* ContainsUndefinedOrNull */) { + if (t.flags & 262144) { if (!reportWideningErrorsInType(t)) { error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t))); } @@ -10406,20 +10700,20 @@ var ts; function reportImplicitAnyError(declaration, type) { var typeAsString = typeToString(getWidenedType(type)); switch (declaration.kind) { - case 126 /* PropertyDeclaration */: - case 125 /* PropertySignature */: + case 128: + case 127: var diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 124 /* Parameter */: + case 126: var diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 190 /* FunctionDeclaration */: - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: - case 130 /* GetAccessor */: - case 131 /* SetAccessor */: - case 156 /* FunctionExpression */: - case 157 /* ArrowFunction */: + case 193: + case 130: + case 129: + case 132: + case 133: + case 158: + case 159: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -10432,7 +10726,7 @@ var ts; error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString); } function reportErrorsFromWidening(declaration, type) { - if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 262144 /* ContainsUndefinedOrNull */) { + if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 262144) { if (!reportWideningErrorsInType(type)) { reportImplicitAnyError(declaration, type); } @@ -10496,7 +10790,7 @@ var ts; var count = 0; for (var i = 0; i < depth; i++) { var t = stack[i]; - if (t.flags & 4096 /* Reference */ && t.target === target) + if (t.flags & 4096 && t.target === target) count++; } return count < 5; @@ -10507,7 +10801,7 @@ var ts; if (source === anyFunctionType) { return; } - if (target.flags & 512 /* TypeParameter */) { + if (target.flags & 512) { var typeParameters = context.typeParameters; for (var i = 0; i < typeParameters.length; i++) { if (target === typeParameters[i]) { @@ -10519,20 +10813,20 @@ var ts; } } } - else if (source.flags & 4096 /* Reference */ && target.flags & 4096 /* Reference */ && source.target === target.target) { + 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++) { inferFromTypes(sourceTypes[i], targetTypes[i]); } } - else if (target.flags & 16384 /* Union */) { + else if (target.flags & 16384) { var targetTypes = target.types; var typeParameterCount = 0; var typeParameter; for (var i = 0; i < targetTypes.length; i++) { var t = targetTypes[i]; - if (t.flags & 512 /* TypeParameter */ && ts.contains(context.typeParameters, t)) { + if (t.flags & 512 && ts.contains(context.typeParameters, t)) { typeParameter = t; typeParameterCount++; } @@ -10546,13 +10840,14 @@ var ts; inferiority--; } } - else if (source.flags & 16384 /* Union */) { + else if (source.flags & 16384) { var sourceTypes = source.types; for (var i = 0; i < sourceTypes.length; i++) { inferFromTypes(sourceTypes[i], target); } } - else if (source.flags & 48128 /* ObjectType */ && (target.flags & (4096 /* Reference */ | 8192 /* Tuple */) || (target.flags & 32768 /* Anonymous */) && target.symbol && target.symbol.flags & (8192 /* Method */ | 2048 /* TypeLiteral */))) { + else if (source.flags & 48128 && (target.flags & (4096 | 8192) || + (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { if (depth === 0) { sourceStack = []; @@ -10562,11 +10857,11 @@ var ts; targetStack[depth] = target; depth++; inferFromProperties(source, target); - inferFromSignatures(source, target, 0 /* Call */); - inferFromSignatures(source, target, 1 /* Construct */); - inferFromIndexTypes(source, target, 0 /* String */, 0 /* String */); - inferFromIndexTypes(source, target, 1 /* Number */, 1 /* Number */); - inferFromIndexTypes(source, target, 0 /* String */, 1 /* Number */); + inferFromSignatures(source, target, 0); + inferFromSignatures(source, target, 1); + inferFromIndexTypes(source, target, 0, 0); + inferFromIndexTypes(source, target, 1, 1); + inferFromIndexTypes(source, target, 0, 1); depth--; } } @@ -10640,17 +10935,17 @@ var ts; function getResolvedSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = (ts.getFullWidth(node) > 0 && resolveName(node, node.text, 107455 /* Value */ | 1048576 /* ExportValue */, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + links.resolvedSymbol = (ts.getFullWidth(node) > 0 && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; } return links.resolvedSymbol; } function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 138 /* TypeQuery */: + case 140: return true; - case 64 /* Identifier */: - case 121 /* QualifiedName */: + case 64: + case 123: node = node.parent; continue; default: @@ -10660,7 +10955,7 @@ var ts; ts.Debug.fail("should not get here"); } function removeTypesFromUnionType(type, typeKind, isOfTypeKind) { - if (type.flags & 16384 /* Union */) { + if (type.flags & 16384) { var types = type.types; if (ts.forEach(types, function (t) { return !!(t.flags & typeKind) === isOfTypeKind; })) { var narrowedType = getUnionType(ts.filter(types, function (t) { return !(t.flags & typeKind) === isOfTypeKind; })); @@ -10687,12 +10982,12 @@ var ts; } return links.assignmentChecks[symbol.id] = isAssignedIn(node); function isAssignedInBinaryExpression(node) { - if (node.operator >= 52 /* FirstAssignment */ && node.operator <= 63 /* LastAssignment */) { + if (node.operatorToken.kind >= 52 && node.operatorToken.kind <= 63) { var n = node.left; - while (n.kind === 155 /* ParenthesizedExpression */) { + while (n.kind === 157) { n = n.expression; } - if (n.kind === 64 /* Identifier */ && getResolvedSymbol(n) === symbol) { + if (n.kind === 64 && getResolvedSymbol(n) === symbol) { return true; } } @@ -10706,45 +11001,46 @@ var ts; } function isAssignedIn(node) { switch (node.kind) { - case 163 /* BinaryExpression */: + case 165: return isAssignedInBinaryExpression(node); - case 188 /* VariableDeclaration */: - case 146 /* BindingElement */: + case 191: + case 148: return isAssignedInVariableDeclaration(node); - case 144 /* ObjectBindingPattern */: - case 145 /* ArrayBindingPattern */: - case 147 /* ArrayLiteralExpression */: - case 148 /* ObjectLiteralExpression */: - case 149 /* PropertyAccessExpression */: - case 150 /* ElementAccessExpression */: - case 151 /* CallExpression */: - case 152 /* NewExpression */: - case 154 /* TypeAssertionExpression */: - case 155 /* ParenthesizedExpression */: - case 161 /* PrefixUnaryExpression */: - case 158 /* DeleteExpression */: - case 159 /* TypeOfExpression */: - case 160 /* VoidExpression */: - case 162 /* PostfixUnaryExpression */: - case 164 /* ConditionalExpression */: - case 167 /* SpreadElementExpression */: - case 170 /* Block */: - case 171 /* VariableStatement */: - case 173 /* ExpressionStatement */: - case 174 /* IfStatement */: - case 175 /* DoStatement */: - case 176 /* WhileStatement */: - case 177 /* ForStatement */: - case 178 /* ForInStatement */: - case 181 /* ReturnStatement */: - case 182 /* WithStatement */: - case 183 /* SwitchStatement */: - case 200 /* CaseClause */: - case 201 /* DefaultClause */: - case 184 /* LabeledStatement */: - case 185 /* ThrowStatement */: - case 186 /* TryStatement */: - case 203 /* CatchClause */: + case 146: + case 147: + case 149: + case 150: + case 151: + case 152: + case 153: + case 154: + case 156: + case 157: + case 163: + case 160: + case 161: + case 162: + case 164: + case 166: + case 169: + case 172: + case 173: + case 175: + case 176: + case 177: + case 178: + case 179: + case 180: + case 181: + case 184: + case 185: + case 186: + case 203: + case 204: + case 187: + case 188: + case 189: + case 206: return ts.forEachChild(node, isAssignedIn); } return false; @@ -10753,13 +11049,12 @@ var ts; function resolveLocation(node) { var containerNodes = []; for (var parent = node.parent; parent; parent = parent.parent) { - if ((ts.isExpression(parent) || ts.isObjectLiteralMethod(node)) && isContextSensitive(parent)) { + if ((ts.isExpression(parent) || ts.isObjectLiteralMethod(node)) && + isContextSensitive(parent)) { containerNodes.unshift(parent); } } - ts.forEach(containerNodes, function (node) { - getTypeOfNode(node); - }); + ts.forEach(containerNodes, function (node) { getTypeOfNode(node); }); } function getSymbolAtLocation(node) { resolveLocation(node); @@ -10775,40 +11070,40 @@ var ts; } function getNarrowedTypeOfSymbol(symbol, node) { var type = getTypeOfSymbol(symbol); - if (node && symbol.flags & 3 /* Variable */ && type.flags & (1 /* Any */ | 48128 /* ObjectType */ | 16384 /* Union */ | 512 /* TypeParameter */)) { + if (node && symbol.flags & 3 && type.flags & (1 | 48128 | 16384 | 512)) { loop: while (node.parent) { var child = node; node = node.parent; var narrowedType = type; switch (node.kind) { - case 174 /* IfStatement */: + case 176: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } break; - case 164 /* ConditionalExpression */: + case 166: if (child !== node.condition) { narrowedType = narrowType(type, node.condition, child === node.whenTrue); } break; - case 163 /* BinaryExpression */: + case 165: if (child === node.right) { - if (node.operator === 48 /* AmpersandAmpersandToken */) { + if (node.operatorToken.kind === 48) { narrowedType = narrowType(type, node.left, true); } - else if (node.operator === 49 /* BarBarToken */) { + else if (node.operatorToken.kind === 49) { narrowedType = narrowType(type, node.left, false); } } break; - case 207 /* SourceFile */: - case 195 /* ModuleDeclaration */: - case 190 /* FunctionDeclaration */: - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: - case 130 /* GetAccessor */: - case 131 /* SetAccessor */: - case 129 /* Constructor */: + case 210: + case 198: + case 193: + case 130: + case 129: + case 132: + case 133: + case 131: break loop; } if (narrowedType !== type) { @@ -10821,21 +11116,21 @@ var ts; } return type; function narrowTypeByEquality(type, expr, assumeTrue) { - if (expr.left.kind !== 159 /* TypeOfExpression */ || expr.right.kind !== 8 /* StringLiteral */) { + if (expr.left.kind !== 161 || expr.right.kind !== 8) { return type; } var left = expr.left; var right = expr.right; - if (left.expression.kind !== 64 /* Identifier */ || getResolvedSymbol(left.expression) !== symbol) { + if (left.expression.kind !== 64 || getResolvedSymbol(left.expression) !== symbol) { return type; } var typeInfo = primitiveTypeInfo[right.text]; - if (expr.operator === 31 /* ExclamationEqualsEqualsToken */) { + if (expr.operatorToken.kind === 31) { assumeTrue = !assumeTrue; } if (assumeTrue) { if (!typeInfo) { - return removeTypesFromUnionType(type, 258 /* StringLike */ | 132 /* NumberLike */ | 8 /* Boolean */, true); + return removeTypesFromUnionType(type, 258 | 132 | 8 | 1048576, true); } if (isTypeSubtypeOf(typeInfo.type, type)) { return typeInfo.type; @@ -10872,7 +11167,7 @@ var ts; } } function narrowTypeByInstanceof(type, expr, assumeTrue) { - if (type.flags & 1 /* Any */ || !assumeTrue || expr.left.kind !== 64 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { + if (type.flags & 1 || !assumeTrue || expr.left.kind !== 64 || getResolvedSymbol(expr.left) !== symbol) { return type; } var rightType = checkExpression(expr.right); @@ -10887,32 +11182,32 @@ var ts; if (isTypeSubtypeOf(targetType, type)) { return targetType; } - if (type.flags & 16384 /* Union */) { + if (type.flags & 16384) { return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); } return type; } function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 155 /* ParenthesizedExpression */: + case 157: return narrowType(type, expr.expression, assumeTrue); - case 163 /* BinaryExpression */: - var operator = expr.operator; - if (operator === 30 /* EqualsEqualsEqualsToken */ || operator === 31 /* ExclamationEqualsEqualsToken */) { + case 165: + var operator = expr.operatorToken.kind; + if (operator === 30 || operator === 31) { return narrowTypeByEquality(type, expr, assumeTrue); } - else if (operator === 48 /* AmpersandAmpersandToken */) { + else if (operator === 48) { return narrowTypeByAnd(type, expr, assumeTrue); } - else if (operator === 49 /* BarBarToken */) { + else if (operator === 49) { return narrowTypeByOr(type, expr, assumeTrue); } - else if (operator === 86 /* InstanceOfKeyword */) { + else if (operator === 86) { return narrowTypeByInstanceof(type, expr, assumeTrue); } break; - case 161 /* PrefixUnaryExpression */: - if (expr.operator === 46 /* ExclamationToken */) { + case 163: + if (expr.operator === 46) { return narrowType(type, expr.operand, !assumeTrue); } break; @@ -10926,20 +11221,22 @@ var ts; var rightSide = nodeLinks.importOnRightSide; nodeLinks.importOnRightSide = undefined; getSymbolLinks(rightSide).referenced = true; - ts.Debug.assert((rightSide.flags & 8388608 /* Import */) !== 0); - nodeLinks = getNodeLinks(ts.getDeclarationOfKind(rightSide, 197 /* ImportDeclaration */)); + ts.Debug.assert((rightSide.flags & 8388608) !== 0); + nodeLinks = getNodeLinks(ts.getDeclarationOfKind(rightSide, 200)); } } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); - if (symbol === argumentsSymbol && ts.getContainingFunction(node).kind === 157 /* ArrowFunction */) { + if (symbol === argumentsSymbol && ts.getContainingFunction(node).kind === 159) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression); } - if (symbol.flags & 8388608 /* Import */) { + if (symbol.flags & 8388608) { var symbolLinks = getSymbolLinks(symbol); if (!symbolLinks.referenced) { var importOrExportAssignment = getLeftSideOfImportOrExportAssignment(node); - if (!importOrExportAssignment || (importOrExportAssignment.flags & 1 /* Export */) || (importOrExportAssignment.kind === 198 /* ExportAssignment */)) { + if (!importOrExportAssignment || + (importOrExportAssignment.flags & 1) || + (importOrExportAssignment.kind === 201)) { symbolLinks.referenced = !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveImport(symbol)); } else { @@ -10949,7 +11246,7 @@ var ts; } } if (symbolLinks.referenced) { - markLinkedImportsAsReferenced(ts.getDeclarationOfKind(symbol, 197 /* ImportDeclaration */)); + markLinkedImportsAsReferenced(ts.getDeclarationOfKind(symbol, 200)); } } checkCollisionWithCapturedSuperVariable(node, node); @@ -10957,65 +11254,65 @@ var ts; return getNarrowedTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol), node); } function captureLexicalThis(node, container) { - var classNode = container.parent && container.parent.kind === 191 /* ClassDeclaration */ ? container.parent : undefined; - getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 126 /* PropertyDeclaration */ || container.kind === 129 /* Constructor */) { - getNodeLinks(classNode).flags |= 4 /* CaptureThis */; + var classNode = container.parent && container.parent.kind === 194 ? container.parent : undefined; + getNodeLinks(node).flags |= 2; + if (container.kind === 128 || container.kind === 131) { + getNodeLinks(classNode).flags |= 4; } else { - getNodeLinks(container).flags |= 4 /* CaptureThis */; + getNodeLinks(container).flags |= 4; } } function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 157 /* ArrowFunction */) { + if (container.kind === 159) { container = ts.getThisContainer(container, false); - needToCaptureLexicalThis = (languageVersion < 2 /* ES6 */); + needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 195 /* ModuleDeclaration */: + case 198: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); break; - case 194 /* EnumDeclaration */: + case 197: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 129 /* Constructor */: + case 131: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 126 /* PropertyDeclaration */: - case 125 /* PropertySignature */: - if (container.flags & 128 /* Static */) { + case 128: + case 127: + if (container.flags & 128) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 122 /* ComputedPropertyName */: + case 124: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } - var classNode = container.parent && container.parent.kind === 191 /* ClassDeclaration */ ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 194 ? container.parent : undefined; if (classNode) { var symbol = getSymbolOfNode(classNode); - return container.flags & 128 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); + return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); } return anyType; } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 124 /* Parameter */) { + if (n.kind === 126) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 151 /* CallExpression */ && node.parent.expression === node; - var enclosingClass = ts.getAncestor(node, 191 /* ClassDeclaration */); + var isCallExpression = node.parent.kind === 153 && node.parent.expression === node; + var enclosingClass = ts.getAncestor(node, 194); var baseClass; if (enclosingClass && ts.getClassBaseTypeNode(enclosingClass)) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); @@ -11029,34 +11326,45 @@ var ts; if (container) { var canUseSuperExpression = false; if (isCallExpression) { - canUseSuperExpression = container.kind === 129 /* Constructor */; + canUseSuperExpression = container.kind === 131; } else { var needToCaptureLexicalThis = false; - while (container && container.kind === 157 /* ArrowFunction */) { + while (container && container.kind === 159) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = true; } - if (container && container.parent && container.parent.kind === 191 /* ClassDeclaration */) { - if (container.flags & 128 /* Static */) { - canUseSuperExpression = container.kind === 128 /* MethodDeclaration */ || container.kind === 127 /* MethodSignature */ || container.kind === 130 /* GetAccessor */ || container.kind === 131 /* SetAccessor */; + if (container && container.parent && container.parent.kind === 194) { + if (container.flags & 128) { + canUseSuperExpression = + container.kind === 130 || + container.kind === 129 || + container.kind === 132 || + container.kind === 133; } else { - canUseSuperExpression = container.kind === 128 /* MethodDeclaration */ || container.kind === 127 /* MethodSignature */ || container.kind === 130 /* GetAccessor */ || container.kind === 131 /* SetAccessor */ || container.kind === 126 /* PropertyDeclaration */ || container.kind === 125 /* PropertySignature */ || container.kind === 129 /* Constructor */; + canUseSuperExpression = + container.kind === 130 || + container.kind === 129 || + container.kind === 132 || + container.kind === 133 || + container.kind === 128 || + container.kind === 127 || + container.kind === 131; } } } if (canUseSuperExpression) { var returnType; - if ((container.flags & 128 /* Static */) || isCallExpression) { - getNodeLinks(node).flags |= 32 /* SuperStatic */; + if ((container.flags & 128) || isCallExpression) { + getNodeLinks(node).flags |= 32; returnType = getTypeOfSymbol(baseClass.symbol); } else { - getNodeLinks(node).flags |= 16 /* SuperInstance */; + getNodeLinks(node).flags |= 16; returnType = baseClass; } - if (container.kind === 129 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 131 && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); returnType = unknownType; } @@ -11066,7 +11374,7 @@ var ts; return returnType; } } - if (container.kind === 122 /* ComputedPropertyName */) { + if (container.kind === 124) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { @@ -11089,7 +11397,8 @@ var ts; if (indexOfParameter < len) { return getTypeAtPosition(contextualSignature, indexOfParameter); } - if (indexOfParameter === (func.parameters.length - 1) && funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { + if (indexOfParameter === (func.parameters.length - 1) && + funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]); } } @@ -11103,7 +11412,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 124 /* Parameter */) { + if (declaration.kind === 126) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -11118,7 +11427,7 @@ var ts; function getContextualTypeForReturnExpression(node) { var func = ts.getContainingFunction(node); if (func) { - if (func.type || func.kind === 129 /* Constructor */ || func.kind === 130 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(func.symbol, 131 /* SetAccessor */))) { + if (func.type || func.kind === 131 || func.kind === 132 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(func.symbol, 133))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(func)); } var signature = getContextualSignatureForFunctionLikeDeclaration(func); @@ -11138,20 +11447,20 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 153 /* TaggedTemplateExpression */) { + if (template.parent.kind === 155) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; } function getContextualTypeForBinaryOperand(node) { var binaryExpression = node.parent; - var operator = binaryExpression.operator; - if (operator >= 52 /* FirstAssignment */ && operator <= 63 /* LastAssignment */) { + var operator = binaryExpression.operatorToken.kind; + if (operator >= 52 && operator <= 63) { if (node === binaryExpression.right) { return checkExpression(binaryExpression.left); } } - else if (operator === 49 /* BarBarToken */) { + else if (operator === 49) { var type = getContextualType(binaryExpression); if (!type && node === binaryExpression.right) { type = checkExpression(binaryExpression.left); @@ -11161,7 +11470,7 @@ var ts; return undefined; } function applyToContextualType(type, mapper) { - if (!(type.flags & 16384 /* Union */)) { + if (!(type.flags & 16384)) { return mapper(type); } var types = type.types; @@ -11193,10 +11502,10 @@ var ts; return applyToContextualType(type, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }); } function contextualTypeIsTupleLikeType(type) { - return !!(type.flags & 16384 /* Union */ ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); + return !!(type.flags & 16384 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); } function contextualTypeHasIndexSignature(type, kind) { - return !!(type.flags & 16384 /* Union */ ? ts.forEach(type.types, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }) : getIndexTypeOfObjectOrUnionType(type, kind)); + return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }) : getIndexTypeOfObjectOrUnionType(type, kind)); } function getContextualTypeForObjectLiteralMethod(node) { ts.Debug.assert(ts.isObjectLiteralMethod(node)); @@ -11216,7 +11525,8 @@ var ts; return propertyType; } } - return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1 /* Number */) || getIndexTypeOfContextualType(type, 0 /* String */); + return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || + getIndexTypeOfContextualType(type, 0); } return undefined; } @@ -11225,7 +11535,7 @@ var ts; var type = getContextualType(arrayLiteral); if (type) { var index = ts.indexOf(arrayLiteral.elements, node); - return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1 /* Number */); + return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1); } return undefined; } @@ -11242,38 +11552,38 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 188 /* VariableDeclaration */: - case 124 /* Parameter */: - case 126 /* PropertyDeclaration */: - case 125 /* PropertySignature */: - case 146 /* BindingElement */: + case 191: + case 126: + case 128: + case 127: + case 148: return getContextualTypeForInitializerExpression(node); - case 157 /* ArrowFunction */: - case 181 /* ReturnStatement */: + case 159: + case 184: return getContextualTypeForReturnExpression(node); - case 151 /* CallExpression */: - case 152 /* NewExpression */: + case 153: + case 154: return getContextualTypeForArgument(parent, node); - case 154 /* TypeAssertionExpression */: + case 156: return getTypeFromTypeNode(parent.type); - case 163 /* BinaryExpression */: + case 165: return getContextualTypeForBinaryOperand(node); - case 204 /* PropertyAssignment */: + case 207: return getContextualTypeForObjectLiteralElement(parent); - case 147 /* ArrayLiteralExpression */: + case 149: return getContextualTypeForElementExpression(node); - case 164 /* ConditionalExpression */: + case 166: return getContextualTypeForConditionalOperand(node); - case 169 /* TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 165 /* TemplateExpression */); + case 171: + ts.Debug.assert(parent.parent.kind === 167); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 155 /* ParenthesizedExpression */: + case 157: return getContextualType(parent); } return undefined; } function getNonGenericSignature(type) { - var signatures = getSignaturesOfObjectOrUnionType(type, 0 /* Call */); + var signatures = getSignaturesOfObjectOrUnionType(type, 0); if (signatures.length === 1) { var signature = signatures[0]; if (!signature.typeParameters) { @@ -11282,24 +11592,25 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 156 /* FunctionExpression */ || node.kind === 157 /* ArrowFunction */; + return node.kind === 158 || node.kind === 159; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) ? getContextualSignature(node) : undefined; } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 128 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); if (!type) { return undefined; } - if (!(type.flags & 16384 /* Union */)) { + if (!(type.flags & 16384)) { return getNonGenericSignature(type); } var signatureList; var types = type.types; for (var i = 0; i < types.length; i++) { - if (signatureList && getSignaturesOfObjectOrUnionType(types[i], 0 /* Call */).length > 1) { + if (signatureList && + getSignaturesOfObjectOrUnionType(types[i], 0).length > 1) { return undefined; } var signature = getNonGenericSignature(types[i]); @@ -11328,20 +11639,20 @@ var ts; } function isAssignmentTarget(node) { var parent = node.parent; - if (parent.kind === 163 /* BinaryExpression */ && parent.operator === 52 /* EqualsToken */ && parent.left === node) { + if (parent.kind === 165 && parent.operatorToken.kind === 52 && parent.left === node) { return true; } - if (parent.kind === 204 /* PropertyAssignment */) { + if (parent.kind === 207) { return isAssignmentTarget(parent.parent); } - if (parent.kind === 147 /* ArrayLiteralExpression */) { + if (parent.kind === 149) { return isAssignmentTarget(parent); } return false; } function checkSpreadElementExpression(node, contextualMapper) { var type = checkExpressionCached(node.expression, contextualMapper); - if (!isTypeAssignableTo(type, anyArrayType)) { + if (!isArrayLikeType(type)) { error(node.expression, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(type)); return unknownType; } @@ -11356,8 +11667,8 @@ var ts; var elementTypes = []; ts.forEach(elements, function (e) { var type = checkExpression(e, contextualMapper); - if (e.kind === 167 /* SpreadElementExpression */) { - elementTypes.push(getIndexTypeOfType(type, 1 /* Number */) || anyType); + if (e.kind === 169) { + elementTypes.push(getIndexTypeOfType(type, 1) || anyType); hasSpreadElement = true; } else { @@ -11373,10 +11684,10 @@ var ts; return createArrayType(getUnionType(elementTypes)); } function isNumericName(name) { - return name.kind === 122 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 124 ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { - return isTypeOfKind(checkComputedPropertyName(name), 1 /* Any */ | 132 /* NumberLike */); + return allConstituentTypesHaveKind(checkComputedPropertyName(name), 1 | 132); } function isNumericLiteralName(name) { return (+name).toString() === name; @@ -11385,8 +11696,11 @@ var ts; var links = getNodeLinks(node.expression); if (!links.resolvedType) { links.resolvedType = checkExpression(node.expression); - if (!isTypeOfKind(links.resolvedType, 1 /* Any */ | 132 /* NumberLike */ | 258 /* StringLike */)) { - error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_or_any); + if (!allConstituentTypesHaveKind(links.resolvedType, 1 | 132 | 258 | 1048576)) { + error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); + } + else { + checkThatExpressionIsProperSymbolReference(node.expression, links.resolvedType, true); } } return links.resolvedType; @@ -11400,19 +11714,21 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 204 /* PropertyAssignment */ || memberDecl.kind === 205 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { - if (memberDecl.kind === 204 /* PropertyAssignment */) { + if (memberDecl.kind === 207 || + memberDecl.kind === 208 || + ts.isObjectLiteralMethod(memberDecl)) { + if (memberDecl.kind === 207) { var type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 128 /* MethodDeclaration */) { + else if (memberDecl.kind === 130) { var type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 205 /* ShorthandPropertyAssignment */); - var type = memberDecl.name.kind === 122 /* ComputedPropertyName */ ? unknownType : checkExpression(memberDecl.name, contextualMapper); + ts.Debug.assert(memberDecl.kind === 208); + var type = memberDecl.name.kind === 124 ? unknownType : checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; - var prop = createSymbol(4 /* Property */ | 67108864 /* Transient */ | member.flags, member.name); + var prop = createSymbol(4 | 67108864 | member.flags, member.name); prop.declarations = member.declarations; prop.parent = member.parent; if (member.valueDeclaration) { @@ -11423,7 +11739,7 @@ var ts; member = prop; } else { - ts.Debug.assert(memberDecl.kind === 130 /* GetAccessor */ || memberDecl.kind === 131 /* SetAccessor */); + ts.Debug.assert(memberDecl.kind === 132 || memberDecl.kind === 133); checkAccessorDeclaration(memberDecl); } if (!ts.hasDynamicName(memberDecl)) { @@ -11431,17 +11747,17 @@ var ts; } propertiesArray.push(member); } - var stringIndexType = getIndexType(0 /* String */); - var numberIndexType = getIndexType(1 /* Number */); + var stringIndexType = getIndexType(0); + var numberIndexType = getIndexType(1); var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); - result.flags |= 131072 /* ObjectLiteral */ | 524288 /* ContainsObjectLiteral */ | (typeFlags & 262144 /* ContainsUndefinedOrNull */); + result.flags |= 131072 | 524288 | (typeFlags & 262144); return result; function getIndexType(kind) { if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { var propTypes = []; for (var i = 0; i < propertiesArray.length; i++) { var propertyDecl = node.properties[i]; - if (kind === 0 /* String */ || isNumericName(propertyDecl.name)) { + if (kind === 0 || isNumericName(propertyDecl.name)) { var type = getTypeOfSymbol(propertiesArray[i]); if (!ts.contains(propTypes, type)) { propTypes.push(type); @@ -11456,36 +11772,36 @@ var ts; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 126 /* PropertyDeclaration */; + return s.valueDeclaration ? s.valueDeclaration.kind : 128; } function getDeclarationFlagsFromSymbol(s) { - return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 16 /* Public */ | 128 /* Static */ : 0; + return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 16 | 128 : 0; } function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationFlagsFromSymbol(prop); - if (!(flags & (32 /* Private */ | 64 /* Protected */))) { + if (!(flags & (32 | 64))) { return; } - var enclosingClassDeclaration = ts.getAncestor(node, 191 /* ClassDeclaration */); + var enclosingClassDeclaration = ts.getAncestor(node, 194); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; var declaringClass = getDeclaredTypeOfSymbol(prop.parent); - if (flags & 32 /* Private */) { + if (flags & 32) { if (declaringClass !== enclosingClass) { error(node, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); } return; } - if (left.kind === 90 /* SuperKeyword */) { + if (left.kind === 90) { return; } if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); return; } - if (flags & 128 /* Static */) { + if (flags & 128) { return; } - if (!(getTargetType(type).flags & (1024 /* Class */ | 2048 /* Interface */) && hasBaseType(type, enclosingClass))) { + 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)); } } @@ -11512,8 +11828,8 @@ var ts; return unknownType; } getNodeLinks(node).resolvedSymbol = prop; - if (prop.parent && prop.parent.flags & 32 /* Class */) { - if (left.kind === 90 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 128 /* MethodDeclaration */) { + if (prop.parent && prop.parent.flags & 32) { + if (left.kind === 90 && getDeclarationKindFromSymbol(prop) !== 130) { error(right, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); } else { @@ -11525,12 +11841,12 @@ var ts; return anyType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 149 /* PropertyAccessExpression */ ? node.expression : node.left; + var left = node.kind === 151 ? node.expression : node.left; var type = checkExpressionOrQualifiedName(left); if (type !== unknownType && type !== anyType) { var prop = getPropertyOfType(getWidenedType(type), propertyName); - if (prop && prop.parent && prop.parent.flags & 32 /* Class */) { - if (left.kind === 90 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 128 /* MethodDeclaration */) { + if (prop && prop.parent && prop.parent.flags & 32) { + if (left.kind === 90 && getDeclarationKindFromSymbol(prop) !== 130) { return false; } else { @@ -11545,7 +11861,7 @@ var ts; function checkIndexedAccess(node) { if (!node.argumentExpression) { var sourceFile = getSourceFile(node); - if (node.parent.kind === 152 /* NewExpression */ && node.parent.expression === node) { + if (node.parent.kind === 154 && 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); @@ -11562,13 +11878,14 @@ var ts; return unknownType; } var isConstEnum = isConstEnumObjectType(objectType); - if (isConstEnum && (!node.argumentExpression || node.argumentExpression.kind !== 8 /* StringLiteral */)) { + if (isConstEnum && + (!node.argumentExpression || node.argumentExpression.kind !== 8)) { error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } if (node.argumentExpression) { - if (node.argumentExpression.kind === 8 /* StringLiteral */ || node.argumentExpression.kind === 7 /* NumericLiteral */) { - var name = node.argumentExpression.text; + var name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (name !== undefined) { var prop = getPropertyOfType(objectType, name); if (prop) { getNodeLinks(node).resolvedSymbol = prop; @@ -11580,14 +11897,14 @@ var ts; } } } - if (isTypeOfKind(indexType, 1 /* Any */ | 258 /* StringLike */ | 132 /* NumberLike */)) { - if (isTypeOfKind(indexType, 1 /* Any */ | 132 /* NumberLike */)) { - var numberIndexType = getIndexTypeOfType(objectType, 1 /* Number */); + if (allConstituentTypesHaveKind(indexType, 1 | 258 | 132 | 1048576)) { + if (allConstituentTypesHaveKind(indexType, 1 | 132)) { + var numberIndexType = getIndexTypeOfType(objectType, 1); if (numberIndexType) { return numberIndexType; } } - var stringIndexType = getIndexTypeOfType(objectType, 0 /* String */); + var stringIndexType = getIndexTypeOfType(objectType, 0); if (stringIndexType) { return stringIndexType; } @@ -11596,11 +11913,51 @@ var ts; } return anyType; } - error(node, ts.Diagnostics.An_index_expression_argument_must_be_of_type_string_number_or_any); + error(node, ts.Diagnostics.An_index_expression_argument_must_be_of_type_string_number_symbol_or_any); return unknownType; } + function getPropertyNameForIndexedAccess(indexArgumentExpression, indexArgumentType) { + if (indexArgumentExpression.kind === 8 || indexArgumentExpression.kind === 7) { + return indexArgumentExpression.text; + } + if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, false)) { + var rightHandSideName = indexArgumentExpression.name.text; + return ts.getPropertyNameForKnownSymbolName(rightHandSideName); + } + return undefined; + } + function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) { + if (expressionType === unknownType) { + return false; + } + if (!ts.isWellKnownSymbolSyntactically(expression)) { + return false; + } + if ((expressionType.flags & 1048576) === 0) { + if (reportError) { + error(expression, ts.Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, ts.getTextOfNode(expression)); + } + return false; + } + var leftHandSide = expression.expression; + var leftHandSideSymbol = getResolvedSymbol(leftHandSide); + if (!leftHandSideSymbol) { + return false; + } + var globalESSymbol = getGlobalESSymbolConstructorSymbol(); + if (!globalESSymbol) { + return false; + } + if (leftHandSideSymbol !== globalESSymbol) { + if (reportError) { + error(leftHandSide, ts.Diagnostics.Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object); + } + return false; + } + return true; + } function resolveUntypedCall(node) { - if (node.kind === 153 /* TaggedTemplateExpression */) { + if (node.kind === 155) { checkExpression(node.template); } else { @@ -11614,15 +11971,60 @@ var ts; resolveUntypedCall(node); return unknownSignature; } + function reorderCandidates(signatures, result) { + var lastParent; + var lastSymbol; + var cutoffIndex = 0; + var index; + var specializedIndex = -1; + var spliceIndex; + ts.Debug.assert(!result.length); + for (var i = 0; i < signatures.length; i++) { + var signature = signatures[i]; + var symbol = signature.declaration && getSymbolOfNode(signature.declaration); + var parent = signature.declaration && signature.declaration.parent; + if (!lastSymbol || symbol === lastSymbol) { + if (lastParent && parent === lastParent) { + index++; + } + else { + lastParent = parent; + index = cutoffIndex; + } + } + else { + index = cutoffIndex = result.length; + lastParent = parent; + } + lastSymbol = symbol; + if (signature.hasStringLiterals) { + specializedIndex++; + spliceIndex = specializedIndex; + cutoffIndex++; + } + else { + spliceIndex = index; + } + result.splice(spliceIndex, 0, signature); + } + } + function getSpreadArgumentIndex(args) { + for (var i = 0; i < args.length; i++) { + if (args[i].kind === 169) { + return i; + } + } + return -1; + } function hasCorrectArity(node, args, signature) { var adjustedArgCount; var typeArguments; var callIsIncomplete; - if (node.kind === 153 /* TaggedTemplateExpression */) { + if (node.kind === 155) { var tagExpression = node; adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 165 /* TemplateExpression */) { + if (tagExpression.template.kind === 167) { var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); @@ -11630,39 +12032,40 @@ var ts; } else { var templateLiteral = tagExpression.template; - ts.Debug.assert(templateLiteral.kind === 10 /* NoSubstitutionTemplateLiteral */); + ts.Debug.assert(templateLiteral.kind === 10); callIsIncomplete = !!templateLiteral.isUnterminated; } } else { var callExpression = node; if (!callExpression.arguments) { - ts.Debug.assert(callExpression.kind === 152 /* NewExpression */); + ts.Debug.assert(callExpression.kind === 154); return signature.minArgumentCount === 0; } adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; callIsIncomplete = callExpression.arguments.end === callExpression.end; typeArguments = callExpression.typeArguments; } - ts.Debug.assert(adjustedArgCount !== undefined, "'adjustedArgCount' undefined"); - ts.Debug.assert(callIsIncomplete !== undefined, "'callIsIncomplete' undefined"); - return checkArity(adjustedArgCount, typeArguments, callIsIncomplete, signature); - function checkArity(adjustedArgCount, typeArguments, callIsIncomplete, signature) { - if (!signature.hasRestParameter && adjustedArgCount > signature.parameters.length) { - return false; - } - var hasRightNumberOfTypeArgs = !typeArguments || (signature.typeParameters && typeArguments.length === signature.typeParameters.length); - if (!hasRightNumberOfTypeArgs) { - return false; - } - var hasEnoughArguments = adjustedArgCount >= signature.minArgumentCount; - return callIsIncomplete || hasEnoughArguments; + var hasRightNumberOfTypeArgs = !typeArguments || + (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + if (!hasRightNumberOfTypeArgs) { + return false; } + var spreadArgIndex = getSpreadArgumentIndex(args); + if (spreadArgIndex >= 0) { + return signature.hasRestParameter && spreadArgIndex >= signature.parameters.length - 1; + } + if (!signature.hasRestParameter && adjustedArgCount > signature.parameters.length) { + return false; + } + var hasEnoughArguments = adjustedArgCount >= signature.minArgumentCount; + return callIsIncomplete || hasEnoughArguments; } function getSingleCallSignature(type) { - if (type.flags & 48128 /* ObjectType */) { + if (type.flags & 48128) { var resolved = resolveObjectOrUnionTypeMembers(type); - if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && + resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { return resolved.callSignatures[0]; } } @@ -11680,25 +12083,25 @@ var ts; var context = createInferenceContext(typeParameters, false); var inferenceMapper = createInferenceMapper(context); for (var i = 0; i < args.length; i++) { - if (args[i].kind === 168 /* OmittedExpression */) { - continue; + var arg = args[i]; + if (arg.kind !== 170) { + var paramType = getTypeAtPosition(signature, arg.kind === 169 ? -1 : i); + if (i === 0 && args[i].parent.kind === 155) { + var argType = globalTemplateStringsArrayType; + } + else { + var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; + var argType = checkExpressionWithContextualType(arg, paramType, mapper); + } + inferTypes(context, argType, paramType); } - var parameterType = getTypeAtPosition(signature, i); - if (i === 0 && args[i].parent.kind === 153 /* TaggedTemplateExpression */) { - inferTypes(context, globalTemplateStringsArrayType, parameterType); - continue; - } - var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; - inferTypes(context, checkExpressionWithContextualType(args[i], parameterType, mapper), parameterType); } if (excludeArgument) { for (var i = 0; i < args.length; i++) { - if (args[i].kind === 168 /* OmittedExpression */) { - continue; - } if (excludeArgument[i] === false) { - var parameterType = getTypeAtPosition(signature, i); - inferTypes(context, checkExpressionWithContextualType(args[i], parameterType, inferenceMapper), parameterType); + var arg = args[i]; + var paramType = getTypeAtPosition(signature, arg.kind === 169 ? -1 : i); + inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); } } } @@ -11730,30 +12133,22 @@ var ts; function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - var argType; - if (arg.kind === 168 /* OmittedExpression */) { - continue; - } - var paramType = getTypeAtPosition(signature, i); - if (i === 0 && node.kind === 153 /* TaggedTemplateExpression */) { - argType = globalTemplateStringsArrayType; - } - else { - argType = arg.kind === 8 /* StringLiteral */ && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); - } - var isValidArgument = checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1); - if (!isValidArgument) { - return false; + if (arg.kind !== 170) { + var paramType = getTypeAtPosition(signature, arg.kind === 169 ? -1 : i); + var argType = i === 0 && node.kind === 155 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + if (!checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1)) { + return false; + } } } return true; } function getEffectiveCallArguments(node) { var args; - if (node.kind === 153 /* TaggedTemplateExpression */) { + if (node.kind === 155) { var template = node.template; args = [template]; - if (template.kind === 165 /* TemplateExpression */) { + if (template.kind === 167) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); @@ -11765,8 +12160,8 @@ var ts; return args; } function getEffectiveTypeArguments(callExpression) { - if (callExpression.expression.kind === 90 /* SuperKeyword */) { - var containingClass = ts.getAncestor(callExpression, 191 /* ClassDeclaration */); + if (callExpression.expression.kind === 90) { + var containingClass = ts.getAncestor(callExpression, 194); var baseClassTypeNode = containingClass && ts.getClassBaseTypeNode(containingClass); return baseClassTypeNode && baseClassTypeNode.typeArguments; } @@ -11775,16 +12170,16 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray) { - var isTaggedTemplate = node.kind === 153 /* TaggedTemplateExpression */; + var isTaggedTemplate = node.kind === 155; var typeArguments; if (!isTaggedTemplate) { typeArguments = getEffectiveTypeArguments(node); - if (node.expression.kind !== 90 /* SuperKeyword */) { + if (node.expression.kind !== 90) { ts.forEach(typeArguments, checkSourceElement); } } var candidates = candidatesOutArray || []; - collectCandidates(); + reorderCandidates(signatures, candidates); if (!candidates.length) { error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); return resolveErrorCall(node); @@ -11895,50 +12290,12 @@ var ts; } return undefined; } - function collectCandidates() { - var result = candidates; - var lastParent; - var lastSymbol; - var cutoffIndex = 0; - var index; - var specializedIndex = -1; - var spliceIndex; - ts.Debug.assert(!result.length); - for (var i = 0; i < signatures.length; i++) { - var signature = signatures[i]; - var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent = signature.declaration && signature.declaration.parent; - if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent === lastParent) { - index++; - } - else { - lastParent = parent; - index = cutoffIndex; - } - } - else { - index = cutoffIndex = result.length; - lastParent = parent; - } - lastSymbol = symbol; - if (signature.hasStringLiterals) { - specializedIndex++; - spliceIndex = specializedIndex; - cutoffIndex++; - } - else { - spliceIndex = index; - } - result.splice(spliceIndex, 0, signature); - } - } } function resolveCallExpression(node, candidatesOutArray) { - if (node.expression.kind === 90 /* SuperKeyword */) { + if (node.expression.kind === 90) { var superType = checkSuperExpression(node.expression); if (superType !== unknownType) { - return resolveCall(node, getSignaturesOfType(superType, 1 /* Construct */), candidatesOutArray); + return resolveCall(node, getSignaturesOfType(superType, 1), candidatesOutArray); } return resolveUntypedCall(node); } @@ -11947,9 +12304,9 @@ var ts; if (apparentType === unknownType) { return resolveErrorCall(node); } - var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */); - var constructSignatures = getSignaturesOfType(apparentType, 1 /* Construct */); - if (funcType === anyType || (!callSignatures.length && !constructSignatures.length && !(funcType.flags & 16384 /* Union */) && isTypeAssignableTo(funcType, globalFunctionType))) { + var callSignatures = getSignaturesOfType(apparentType, 0); + var constructSignatures = getSignaturesOfType(apparentType, 1); + if (funcType === anyType || (!callSignatures.length && !constructSignatures.length && !(funcType.flags & 16384) && isTypeAssignableTo(funcType, globalFunctionType))) { if (node.typeArguments) { error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); } @@ -11967,6 +12324,12 @@ var ts; return resolveCall(node, callSignatures, candidatesOutArray); } function resolveNewExpression(node, candidatesOutArray) { + if (node.arguments && languageVersion < 2) { + var spreadIndex = getSpreadArgumentIndex(node.arguments); + if (spreadIndex >= 0) { + error(node.arguments[spreadIndex], ts.Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher); + } + } var expressionType = checkExpression(node.expression); if (expressionType === anyType) { if (node.typeArguments) { @@ -11978,11 +12341,11 @@ var ts; if (expressionType === unknownType) { return resolveErrorCall(node); } - var constructSignatures = getSignaturesOfType(expressionType, 1 /* Construct */); + var constructSignatures = getSignaturesOfType(expressionType, 1); if (constructSignatures.length) { return resolveCall(node, constructSignatures, candidatesOutArray); } - var callSignatures = getSignaturesOfType(expressionType, 0 /* Call */); + var callSignatures = getSignaturesOfType(expressionType, 0); if (callSignatures.length) { var signature = resolveCall(node, callSignatures, candidatesOutArray); if (getReturnTypeOfSignature(signature) !== voidType) { @@ -11999,8 +12362,8 @@ var ts; if (apparentType === unknownType) { return resolveErrorCall(node); } - var callSignatures = getSignaturesOfType(apparentType, 0 /* Call */); - if (tagType === anyType || (!callSignatures.length && !(tagType.flags & 16384 /* Union */) && isTypeAssignableTo(tagType, globalFunctionType))) { + var callSignatures = getSignaturesOfType(apparentType, 0); + if (tagType === anyType || (!callSignatures.length && !(tagType.flags & 16384) && isTypeAssignableTo(tagType, globalFunctionType))) { return resolveUntypedCall(node); } if (!callSignatures.length) { @@ -12013,13 +12376,13 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - if (node.kind === 151 /* CallExpression */) { + if (node.kind === 153) { links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); } - else if (node.kind === 152 /* NewExpression */) { + else if (node.kind === 154) { links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); } - else if (node.kind === 153 /* TaggedTemplateExpression */) { + else if (node.kind === 155) { links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); } else { @@ -12031,12 +12394,15 @@ var ts; function checkCallExpression(node) { checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments); var signature = getResolvedSignature(node); - if (node.expression.kind === 90 /* SuperKeyword */) { + if (node.expression.kind === 90) { return voidType; } - if (node.kind === 152 /* NewExpression */) { + if (node.kind === 154) { var declaration = signature.declaration; - if (declaration && declaration.kind !== 129 /* Constructor */ && declaration.kind !== 133 /* ConstructSignature */ && declaration.kind !== 137 /* ConstructorType */) { + if (declaration && + declaration.kind !== 131 && + declaration.kind !== 135 && + declaration.kind !== 139) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -12046,7 +12412,7 @@ var ts; return getReturnTypeOfSignature(signature); } function checkTaggedTemplateExpression(node) { - if (languageVersion < 2 /* ES6 */) { + if (languageVersion < 2) { grammarErrorOnFirstToken(node.template, ts.Diagnostics.Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher); } return getReturnTypeOfSignature(getResolvedSignature(node)); @@ -12063,7 +12429,10 @@ var ts; return targetType; } function getTypeAtPosition(signature, pos) { - return signature.hasRestParameter ? pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + if (pos >= 0) { + return signature.hasRestParameter ? pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + } + return signature.hasRestParameter ? getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : anyArrayType; } function assignContextualParameterTypes(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -12083,7 +12452,7 @@ var ts; if (!func.body) { return unknownType; } - if (func.body.kind !== 170 /* Block */) { + if (func.body.kind !== 172) { var type = checkExpressionCached(func.body, contextualMapper); } else { @@ -12121,7 +12490,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 185 /* ThrowStatement */); + return (body.statements.length === 1) && (body.statements[0].kind === 188); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!produceDiagnostics) { @@ -12130,7 +12499,7 @@ var ts; if (returnType === voidType || returnType === anyType) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 170 /* Block */) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 172) { return; } var bodyBlock = func.body; @@ -12143,9 +12512,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 !== 128 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 156 /* FunctionExpression */) { + if (!hasGrammarError && node.kind === 158) { checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); } if (contextualMapper === identityMapper && isContextSensitive(node)) { @@ -12153,12 +12522,12 @@ var ts; } var links = getNodeLinks(node); var type = getTypeOfSymbol(node.symbol); - if (!(links.flags & 64 /* ContextChecked */)) { + if (!(links.flags & 64)) { var contextualSignature = getContextualSignature(node); - if (!(links.flags & 64 /* ContextChecked */)) { - links.flags |= 64 /* ContextChecked */; + if (!(links.flags & 64)) { + links.flags |= 64; if (contextualSignature) { - var signature = getSignaturesOfType(type, 0 /* Call */)[0]; + var signature = getSignaturesOfType(type, 0)[0]; if (isContextSensitive(node)) { assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); } @@ -12173,19 +12542,19 @@ var ts; checkSignatureDeclaration(node); } } - if (produceDiagnostics && node.kind !== 128 /* MethodDeclaration */ && node.kind !== 127 /* MethodSignature */) { + if (produceDiagnostics && node.kind !== 130 && node.kind !== 129) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodBody(node) { - ts.Debug.assert(node.kind !== 128 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); if (node.type) { checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); } if (node.body) { - if (node.body.kind === 170 /* Block */) { + if (node.body.kind === 172) { checkSourceElement(node.body); } else { @@ -12198,7 +12567,7 @@ var ts; } } function checkArithmeticOperandType(operand, type, diagnostic) { - if (!isTypeOfKind(type, 1 /* Any */ | 132 /* NumberLike */)) { + if (!allConstituentTypesHaveKind(type, 1 | 132)) { error(operand, diagnostic); return false; } @@ -12211,15 +12580,15 @@ var ts; } function isReferenceOrErrorExpression(n) { switch (n.kind) { - case 64 /* Identifier */: + case 64: var symbol = findSymbol(n); - return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3 /* Variable */) !== 0; - case 149 /* PropertyAccessExpression */: + return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; + case 151: var symbol = findSymbol(n); - return !symbol || symbol === unknownSymbol || (symbol.flags & ~8 /* EnumMember */) !== 0; - case 150 /* ElementAccessExpression */: + return !symbol || symbol === unknownSymbol || (symbol.flags & ~8) !== 0; + case 152: return true; - case 155 /* ParenthesizedExpression */: + case 157: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -12227,20 +12596,20 @@ var ts; } function isConstVariableReference(n) { switch (n.kind) { - case 64 /* Identifier */: - case 149 /* PropertyAccessExpression */: + case 64: + case 151: var symbol = findSymbol(n); - return symbol && (symbol.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 4096 /* Const */) !== 0; - case 150 /* ElementAccessExpression */: + return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 4096) !== 0; + case 152: var index = n.argumentExpression; var symbol = findSymbol(n.expression); - if (symbol && index && index.kind === 8 /* StringLiteral */) { + if (symbol && index && index.kind === 8) { var name = index.text; var prop = getPropertyOfType(getTypeOfSymbol(symbol), name); - return prop && (prop.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 4096 /* Const */) !== 0; + return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 4096) !== 0; } return false; - case 155 /* ParenthesizedExpression */: + case 157: return isConstVariableReference(n.expression); default: return false; @@ -12257,7 +12626,7 @@ var ts; return true; } function checkDeleteExpression(node) { - if (node.parserContextFlags & 1 /* StrictMode */ && node.expression.kind === 64 /* Identifier */) { + if (node.parserContextFlags & 1 && node.expression.kind === 64) { grammarErrorOnNode(node.expression, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode); } var operandType = checkExpression(node.expression); @@ -12272,19 +12641,22 @@ var ts; return undefinedType; } function checkPrefixUnaryExpression(node) { - if ((node.operator === 38 /* PlusPlusToken */ || node.operator === 39 /* MinusMinusToken */)) { + if ((node.operator === 38 || node.operator === 39)) { checkGrammarEvalOrArgumentsInStrictMode(node, node.operand); } var operandType = checkExpression(node.operand); switch (node.operator) { - case 33 /* PlusToken */: - case 34 /* MinusToken */: - case 47 /* TildeToken */: + case 33: + case 34: + case 47: + if (someConstituentTypeHasKind(operandType, 1048576)) { + error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); + } return numberType; - case 46 /* ExclamationToken */: + case 46: return booleanType; - case 38 /* PlusPlusToken */: - case 39 /* MinusMinusToken */: + case 38: + case 39: 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); @@ -12302,11 +12674,26 @@ var ts; } return numberType; } - function isTypeOfKind(type, kind) { + function someConstituentTypeHasKind(type, kind) { if (type.flags & kind) { return true; } - if (type.flags & 16384 /* Union */) { + if (type.flags & 16384) { + var types = type.types; + for (var i = 0; i < types.length; i++) { + if (types[i].flags & kind) { + return true; + } + } + return false; + } + return false; + } + function allConstituentTypesHaveKind(type, kind) { + if (type.flags & kind) { + return true; + } + if (type.flags & 16384) { var types = type.types; for (var i = 0; i < types.length; i++) { if (!(types[i].flags & kind)) { @@ -12318,25 +12705,25 @@ var ts; return false; } function isConstEnumObjectType(type) { - return type.flags & (48128 /* ObjectType */ | 32768 /* Anonymous */) && type.symbol && isConstEnumSymbol(type.symbol); + return type.flags & (48128 | 32768) && type.symbol && isConstEnumSymbol(type.symbol); } function isConstEnumSymbol(symbol) { - return (symbol.flags & 128 /* ConstEnum */) !== 0; + return (symbol.flags & 128) !== 0; } function checkInstanceOfExpression(node, leftType, rightType) { - if (isTypeOfKind(leftType, 510 /* Primitive */)) { + if (allConstituentTypesHaveKind(leftType, 1049086)) { 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); } - if (!(rightType.flags & 1 /* Any */ || isTypeSubtypeOf(rightType, globalFunctionType))) { + if (!(rightType.flags & 1 || 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); } return booleanType; } function checkInExpression(node, leftType, rightType) { - if (!isTypeOfKind(leftType, 1 /* Any */ | 258 /* StringLike */ | 132 /* NumberLike */)) { - error(node.left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number); + if (!allConstituentTypesHaveKind(leftType, 1 | 258 | 132 | 1048576)) { + error(node.left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } - if (!isTypeOfKind(rightType, 1 /* Any */ | 48128 /* ObjectType */ | 512 /* TypeParameter */)) { + if (!allConstituentTypesHaveKind(rightType, 1 | 48128 | 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); } return booleanType; @@ -12345,9 +12732,11 @@ var ts; var properties = node.properties; for (var i = 0; i < properties.length; i++) { var p = properties[i]; - if (p.kind === 204 /* PropertyAssignment */ || p.kind === 205 /* ShorthandPropertyAssignment */) { + if (p.kind === 207 || p.kind === 208) { var name = p.name; - var type = sourceType.flags & 1 /* Any */ ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, 1 /* Number */) || getIndexTypeOfType(sourceType, 0 /* String */); + var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || + isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, 1) || + getIndexTypeOfType(sourceType, 0); if (type) { checkDestructuringAssignment(p.initializer || name, type); } @@ -12362,17 +12751,17 @@ var ts; return sourceType; } function checkArrayLiteralAssignment(node, sourceType, contextualMapper) { - if (!isTypeAssignableTo(sourceType, anyArrayType)) { + if (!isArrayLikeType(sourceType)) { error(node, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(sourceType)); return sourceType; } var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 168 /* OmittedExpression */) { - if (e.kind !== 167 /* SpreadElementExpression */) { + if (e.kind !== 170) { + if (e.kind !== 169) { var propName = "" + i; - var type = sourceType.flags & 1 /* Any */ ? sourceType : isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : getIndexTypeOfType(sourceType, 1 /* Number */); + var type = sourceType.flags & 1 ? sourceType : isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : getIndexTypeOfType(sourceType, 1); if (type) { checkDestructuringAssignment(e, type, contextualMapper); } @@ -12393,14 +12782,14 @@ var ts; return sourceType; } function checkDestructuringAssignment(target, sourceType, contextualMapper) { - if (target.kind === 163 /* BinaryExpression */ && target.operator === 52 /* EqualsToken */) { + if (target.kind === 165 && target.operatorToken.kind === 52) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 148 /* ObjectLiteralExpression */) { + if (target.kind === 150) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 147 /* ArrayLiteralExpression */) { + if (target.kind === 149) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); @@ -12413,43 +12802,45 @@ var ts; return sourceType; } function checkBinaryExpression(node, contextualMapper) { - if (ts.isLeftHandSideExpression(node.left) && ts.isAssignmentOperator(node.operator)) { + if (ts.isLeftHandSideExpression(node.left) && ts.isAssignmentOperator(node.operatorToken.kind)) { checkGrammarEvalOrArgumentsInStrictMode(node, node.left); } - var operator = node.operator; - if (operator === 52 /* EqualsToken */ && (node.left.kind === 148 /* ObjectLiteralExpression */ || node.left.kind === 147 /* ArrayLiteralExpression */)) { + var operator = node.operatorToken.kind; + if (operator === 52 && (node.left.kind === 150 || node.left.kind === 149)) { return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); } var leftType = checkExpression(node.left, contextualMapper); var rightType = checkExpression(node.right, contextualMapper); switch (operator) { - case 35 /* AsteriskToken */: - case 55 /* AsteriskEqualsToken */: - case 36 /* SlashToken */: - case 56 /* SlashEqualsToken */: - case 37 /* PercentToken */: - case 57 /* PercentEqualsToken */: - case 34 /* MinusToken */: - case 54 /* MinusEqualsToken */: - case 40 /* LessThanLessThanToken */: - case 58 /* LessThanLessThanEqualsToken */: - case 41 /* GreaterThanGreaterThanToken */: - case 59 /* GreaterThanGreaterThanEqualsToken */: - case 42 /* GreaterThanGreaterThanGreaterThanToken */: - case 60 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 44 /* BarToken */: - case 62 /* BarEqualsToken */: - case 45 /* CaretToken */: - case 63 /* CaretEqualsToken */: - case 43 /* AmpersandToken */: - case 61 /* AmpersandEqualsToken */: - if (leftType.flags & (32 /* Undefined */ | 64 /* Null */)) + case 35: + case 55: + case 36: + case 56: + case 37: + case 57: + case 34: + case 54: + case 40: + case 58: + case 41: + case 59: + case 42: + case 60: + case 44: + case 62: + case 45: + case 63: + case 43: + case 61: + if (leftType.flags & (32 | 64)) leftType = rightType; - if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) + if (rightType.flags & (32 | 64)) rightType = leftType; var suggestedOperator; - if ((leftType.flags & 8 /* Boolean */) && (rightType.flags & 8 /* Boolean */) && (suggestedOperator = getSuggestedBooleanOperator(node.operator)) !== undefined) { - error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operator), ts.tokenToString(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)); } 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); @@ -12459,73 +12850,89 @@ var ts; } } return numberType; - case 33 /* PlusToken */: - case 53 /* PlusEqualsToken */: - if (leftType.flags & (32 /* Undefined */ | 64 /* Null */)) + case 33: + case 53: + if (leftType.flags & (32 | 64)) leftType = rightType; - if (rightType.flags & (32 /* Undefined */ | 64 /* Null */)) + if (rightType.flags & (32 | 64)) rightType = leftType; var resultType; - if (isTypeOfKind(leftType, 132 /* NumberLike */) && isTypeOfKind(rightType, 132 /* NumberLike */)) { + if (allConstituentTypesHaveKind(leftType, 132) && allConstituentTypesHaveKind(rightType, 132)) { resultType = numberType; } - else if (isTypeOfKind(leftType, 258 /* StringLike */) || isTypeOfKind(rightType, 258 /* StringLike */)) { - resultType = stringType; - } - else if (leftType.flags & 1 /* Any */ || rightType.flags & 1 /* Any */) { - resultType = anyType; + else { + if (allConstituentTypesHaveKind(leftType, 258) || allConstituentTypesHaveKind(rightType, 258)) { + resultType = stringType; + } + else if (leftType.flags & 1 || rightType.flags & 1) { + resultType = anyType; + } + if (resultType && !checkForDisallowedESSymbolOperand(operator)) { + return resultType; + } } if (!resultType) { reportOperatorError(); return anyType; } - if (operator === 53 /* PlusEqualsToken */) { + if (operator === 53) { checkAssignmentOperator(resultType); } return resultType; - case 28 /* EqualsEqualsToken */: - case 29 /* ExclamationEqualsToken */: - case 30 /* EqualsEqualsEqualsToken */: - case 31 /* ExclamationEqualsEqualsToken */: - case 24 /* LessThanToken */: - case 25 /* GreaterThanToken */: - case 26 /* LessThanEqualsToken */: - case 27 /* GreaterThanEqualsToken */: + case 24: + case 25: + case 26: + case 27: + if (!checkForDisallowedESSymbolOperand(operator)) { + return booleanType; + } + case 28: + case 29: + case 30: + case 31: if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { reportOperatorError(); } return booleanType; - case 86 /* InstanceOfKeyword */: + case 86: return checkInstanceOfExpression(node, leftType, rightType); - case 85 /* InKeyword */: + case 85: return checkInExpression(node, leftType, rightType); - case 48 /* AmpersandAmpersandToken */: + case 48: return rightType; - case 49 /* BarBarToken */: + case 49: return getUnionType([leftType, rightType]); - case 52 /* EqualsToken */: + case 52: checkAssignmentOperator(rightType); return rightType; - case 23 /* CommaToken */: + case 23: return rightType; } + function checkForDisallowedESSymbolOperand(operator) { + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : someConstituentTypeHasKind(rightType, 1048576) ? node.right : undefined; + if (offendingSymbolOperand) { + error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); + return false; + } + return true; + } function getSuggestedBooleanOperator(operator) { switch (operator) { - case 44 /* BarToken */: - case 62 /* BarEqualsToken */: - return 49 /* BarBarToken */; - case 45 /* CaretToken */: - case 63 /* CaretEqualsToken */: - return 31 /* ExclamationEqualsEqualsToken */; - case 43 /* AmpersandToken */: - case 61 /* AmpersandEqualsToken */: - return 48 /* AmpersandAmpersandToken */; + case 44: + case 62: + return 49; + case 45: + case 63: + return 31; + case 43: + case 61: + return 48; default: return undefined; } } function checkAssignmentOperator(valueType) { - if (produceDiagnostics && operator >= 52 /* FirstAssignment */ && operator <= 63 /* LastAssignment */) { + if (produceDiagnostics && operator >= 52 && operator <= 63) { 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 (ok) { checkTypeAssignableTo(valueType, leftType, node.left, undefined); @@ -12533,11 +12940,11 @@ var ts; } } function reportOperatorError() { - error(node, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(node.operator), typeToString(leftType), typeToString(rightType)); + error(node, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(node.operatorToken.kind), typeToString(leftType), typeToString(rightType)); } } function checkYieldExpression(node) { - if (!(node.parserContextFlags & 4 /* Yield */)) { + if (!(node.parserContextFlags & 4)) { grammarErrorOnFirstToken(node, ts.Diagnostics.yield_expression_must_be_contained_within_a_generator_declaration); } else { @@ -12571,14 +12978,14 @@ var ts; return links.resolvedType; } function checkPropertyAssignment(node, contextualMapper) { - if (ts.hasDynamicName(node)) { + if (node.name.kind === 124) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); } function checkObjectLiteralMethod(node, contextualMapper) { checkGrammarMethod(node); - if (ts.hasDynamicName(node)) { + if (node.name.kind === 124) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -12604,7 +13011,7 @@ var ts; } function checkExpressionOrQualifiedName(node, contextualMapper) { var type; - if (node.kind == 121 /* QualifiedName */) { + if (node.kind == 123) { type = checkQualifiedName(node); } else { @@ -12612,7 +13019,9 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 149 /* PropertyAccessExpression */ && node.parent.expression === node) || (node.parent.kind === 150 /* ElementAccessExpression */ && node.parent.expression === node) || ((node.kind === 64 /* Identifier */ || node.kind === 121 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 151 && node.parent.expression === node) || + (node.parent.kind === 152 && node.parent.expression === node) || + ((node.kind === 64 || node.kind === 123) && 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); } @@ -12625,65 +13034,65 @@ var ts; } function checkExpressionWorker(node, contextualMapper) { switch (node.kind) { - case 64 /* Identifier */: + case 64: return checkIdentifier(node); - case 92 /* ThisKeyword */: + case 92: return checkThisExpression(node); - case 90 /* SuperKeyword */: + case 90: return checkSuperExpression(node); - case 88 /* NullKeyword */: + case 88: return nullType; - case 94 /* TrueKeyword */: - case 79 /* FalseKeyword */: + case 94: + case 79: return booleanType; - case 7 /* NumericLiteral */: + case 7: return checkNumericLiteral(node); - case 165 /* TemplateExpression */: + case 167: return checkTemplateExpression(node); - case 8 /* StringLiteral */: - case 10 /* NoSubstitutionTemplateLiteral */: + case 8: + case 10: return stringType; - case 9 /* RegularExpressionLiteral */: + case 9: return globalRegExpType; - case 147 /* ArrayLiteralExpression */: + case 149: return checkArrayLiteral(node, contextualMapper); - case 148 /* ObjectLiteralExpression */: + case 150: return checkObjectLiteral(node, contextualMapper); - case 149 /* PropertyAccessExpression */: + case 151: return checkPropertyAccessExpression(node); - case 150 /* ElementAccessExpression */: + case 152: return checkIndexedAccess(node); - case 151 /* CallExpression */: - case 152 /* NewExpression */: + case 153: + case 154: return checkCallExpression(node); - case 153 /* TaggedTemplateExpression */: + case 155: return checkTaggedTemplateExpression(node); - case 154 /* TypeAssertionExpression */: + case 156: return checkTypeAssertion(node); - case 155 /* ParenthesizedExpression */: + case 157: return checkExpression(node.expression, contextualMapper); - case 156 /* FunctionExpression */: - case 157 /* ArrowFunction */: + case 158: + case 159: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 159 /* TypeOfExpression */: + case 161: return checkTypeOfExpression(node); - case 158 /* DeleteExpression */: + case 160: return checkDeleteExpression(node); - case 160 /* VoidExpression */: + case 162: return checkVoidExpression(node); - case 161 /* PrefixUnaryExpression */: + case 163: return checkPrefixUnaryExpression(node); - case 162 /* PostfixUnaryExpression */: + case 164: return checkPostfixUnaryExpression(node); - case 163 /* BinaryExpression */: + case 165: return checkBinaryExpression(node, contextualMapper); - case 164 /* ConditionalExpression */: + case 166: return checkConditionalExpression(node, contextualMapper); - case 167 /* SpreadElementExpression */: + case 169: return checkSpreadElementExpression(node, contextualMapper); - case 168 /* OmittedExpression */: + case 170: return undefinedType; - case 166 /* YieldExpression */: + case 168: checkYieldExpression(node); return unknownType; } @@ -12703,9 +13112,9 @@ var ts; checkGrammarModifiers(node) || checkGrammarEvalOrArgumentsInStrictMode(node, node.name); checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); - if (node.flags & 112 /* AccessibilityModifier */) { + if (node.flags & 112) { func = ts.getContainingFunction(node); - if (!(func.kind === 129 /* Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 131 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -12719,10 +13128,12 @@ var ts; } } function checkSignatureDeclaration(node) { - if (node.kind === 134 /* IndexSignature */) { + if (node.kind === 136) { checkGrammarIndexSignature(node); } - else if (node.kind === 136 /* FunctionType */ || node.kind === 190 /* FunctionDeclaration */ || node.kind === 137 /* ConstructorType */ || node.kind === 132 /* CallSignature */ || node.kind === 129 /* Constructor */ || node.kind === 133 /* ConstructSignature */) { + else if (node.kind === 138 || node.kind === 193 || node.kind === 139 || + node.kind === 134 || node.kind === 131 || + node.kind === 135) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -12734,10 +13145,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 133 /* ConstructSignature */: + case 135: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 132 /* CallSignature */: + case 134: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -12746,7 +13157,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 192 /* InterfaceDeclaration */) { + if (node.kind === 195) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -12760,7 +13171,7 @@ var ts; var declaration = indexSymbol.declarations[i]; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 119 /* StringKeyword */: + case 119: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -12768,7 +13179,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 117 /* NumberKeyword */: + case 117: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -12782,7 +13193,7 @@ var ts; } } function checkPropertyDeclaration(node) { - checkGrammarModifiers(node) || checkGrammarProperty(node); + checkGrammarModifiers(node) || checkGrammarProperty(node) || checkGrammarComputedPropertyName(node.name); checkVariableLikeDeclaration(node); } function checkMethodDeclaration(node) { @@ -12805,37 +13216,40 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 151 /* CallExpression */ && n.expression.kind === 90 /* SuperKeyword */; + return n.kind === 153 && n.expression.kind === 90; } function containsSuperCall(n) { if (isSuperCallExpression(n)) { return true; } switch (n.kind) { - case 156 /* FunctionExpression */: - case 190 /* FunctionDeclaration */: - case 157 /* ArrowFunction */: - case 148 /* ObjectLiteralExpression */: return false; + case 158: + case 193: + case 159: + case 150: return false; default: return ts.forEachChild(n, containsSuperCall); } } function markThisReferencesAsErrors(n) { - if (n.kind === 92 /* ThisKeyword */) { + if (n.kind === 92) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 156 /* FunctionExpression */ && n.kind !== 190 /* FunctionDeclaration */) { + else if (n.kind !== 158 && n.kind !== 193) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 126 /* PropertyDeclaration */ && !(n.flags & 128 /* Static */) && !!n.initializer; + return n.kind === 128 && + !(n.flags & 128) && + !!n.initializer; } if (ts.getClassBaseTypeNode(node.parent)) { if (containsSuperCall(node.body)) { - var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { return p.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */); }); + var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || + ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); if (superCallShouldBeFirst) { var statements = node.body.statements; - if (!statements.length || statements[0].kind !== 173 /* ExpressionStatement */ || !isSuperCallExpression(statements[0].expression)) { + if (!statements.length || statements[0].kind !== 175 || !isSuperCallExpression(statements[0].expression)) { error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } else { @@ -12851,16 +13265,16 @@ var ts; function checkAccessorDeclaration(node) { if (produceDiagnostics) { checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); - if (node.kind === 130 /* GetAccessor */) { + if (node.kind === 132) { 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 === 130 /* GetAccessor */ ? 131 /* SetAccessor */ : 130 /* GetAccessor */; + var otherKind = node.kind === 132 ? 133 : 132; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { - if (((node.flags & 112 /* AccessibilityModifier */) !== (otherAccessor.flags & 112 /* AccessibilityModifier */))) { + if (((node.flags & 112) !== (otherAccessor.flags & 112))) { error(node.name, ts.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); } var currentAccessorType = getAnnotatedAccessorType(node); @@ -12916,7 +13330,7 @@ var ts; ts.forEach(node.types, checkSourceElement); } function isPrivateWithinAmbient(node) { - return (node.flags & 32 /* Private */) && ts.isInAmbientContext(node); + return (node.flags & 32) && ts.isInAmbientContext(node); } function checkSpecializedSignatureDeclaration(signatureDeclarationNode) { if (!produceDiagnostics) { @@ -12931,9 +13345,9 @@ var ts; return; } var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 192 /* InterfaceDeclaration */) { - ts.Debug.assert(signatureDeclarationNode.kind === 132 /* CallSignature */ || signatureDeclarationNode.kind === 133 /* ConstructSignature */); - var signatureKind = signatureDeclarationNode.kind === 132 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 195) { + ts.Debug.assert(signatureDeclarationNode.kind === 134 || signatureDeclarationNode.kind === 135); + var signatureKind = signatureDeclarationNode.kind === 134 ? 0 : 1; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); var containingType = getDeclaredTypeOfSymbol(containingSymbol); signaturesToCheck = getSignaturesOfType(containingType, signatureKind); @@ -12951,11 +13365,11 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 192 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { - if (!(flags & 2 /* Ambient */)) { - flags |= 1 /* Export */; + if (n.parent.kind !== 195 && ts.isInAmbientContext(n)) { + if (!(flags & 2)) { + flags |= 1; } - flags |= 2 /* Ambient */; + flags |= 2; } return flags & flagsToCheck; } @@ -12973,13 +13387,13 @@ var ts; var canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); ts.forEach(overloads, function (o) { var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags; - if (deviation & 1 /* Export */) { + if (deviation & 1) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_exported_or_not_exported); } - else if (deviation & 2 /* Ambient */) { + else if (deviation & 2) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); } - else if (deviation & (32 /* Private */ | 64 /* Protected */)) { + else if (deviation & (32 | 64)) { error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } }); @@ -12996,7 +13410,7 @@ var ts; }); } } - var flagsToCheck = 1 /* Export */ | 2 /* Ambient */ | 32 /* Private */ | 64 /* Protected */; + var flagsToCheck = 1 | 2 | 32 | 64; var someNodeFlags = 0; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; @@ -13006,7 +13420,7 @@ var ts; var lastSeenNonAmbientDeclaration; var previousDeclaration; var declarations = symbol.declarations; - var isConstructor = (symbol.flags & 16384 /* Constructor */) !== 0; + var isConstructor = (symbol.flags & 16384) !== 0; function reportImplementationExpectedError(node) { if (node.name && ts.getFullWidth(node.name) === 0) { return; @@ -13024,9 +13438,9 @@ var ts; if (subsequentNode.kind === node.kind) { var errorNode = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - ts.Debug.assert(node.kind === 128 /* MethodDeclaration */ || node.kind === 127 /* 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; + ts.Debug.assert(node.kind === 130 || node.kind === 129); + 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, diagnostic); return; } @@ -13044,17 +13458,17 @@ var ts; error(errorNode, ts.Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration); } } - var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536 /* Module */; + var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; for (var i = 0; i < declarations.length; i++) { var node = declarations[i]; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 192 /* InterfaceDeclaration */ || node.parent.kind === 139 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 195 || node.parent.kind === 141 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 190 /* FunctionDeclaration */ || node.kind === 128 /* MethodDeclaration */ || node.kind === 127 /* MethodSignature */ || node.kind === 129 /* Constructor */) { + if (node.kind === 193 || node.kind === 130 || node.kind === 129 || node.kind === 131) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -13123,7 +13537,7 @@ var ts; var symbol = node.localSymbol; if (!symbol) { symbol = getSymbolOfNode(node); - if (!(symbol.flags & 7340032 /* Export */)) { + if (!(symbol.flags & 7340032)) { return; } } @@ -13134,7 +13548,7 @@ var ts; var nonExportedDeclarationSpaces = 0; ts.forEach(symbol.declarations, function (d) { var declarationSpaces = getDeclarationSpaces(d); - if (getEffectiveDeclarationFlags(d, 1 /* Export */)) { + if (getEffectiveDeclarationFlags(d, 1)) { exportedDeclarationSpaces |= declarationSpaces; } else { @@ -13151,28 +13565,29 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 192 /* InterfaceDeclaration */: - return 2097152 /* ExportType */; - case 195 /* ModuleDeclaration */: - return d.name.kind === 8 /* StringLiteral */ || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4194304 /* ExportNamespace */ | 1048576 /* ExportValue */ : 4194304 /* ExportNamespace */; - case 191 /* ClassDeclaration */: - case 194 /* EnumDeclaration */: - return 2097152 /* ExportType */ | 1048576 /* ExportValue */; - case 197 /* ImportDeclaration */: + case 195: + return 2097152; + case 198: + return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; + case 194: + case 197: + return 2097152 | 1048576; + case 200: var result = 0; var target = resolveImport(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { - result |= getDeclarationSpaces(d); - }); + ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); return result; default: - return 1048576 /* ExportValue */; + return 1048576; } } } function checkFunctionDeclaration(node) { if (produceDiagnostics) { - checkFunctionLikeDeclaration(node) || checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); + checkFunctionLikeDeclaration(node) || + checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || + checkGrammarFunctionName(node.name) || + checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -13180,10 +13595,10 @@ var ts; } function checkFunctionLikeDeclaration(node) { checkSignatureDeclaration(node); - if (ts.hasDynamicName(node)) { + if (node.name.kind === 124) { checkComputedPropertyName(node.name); } - else { + if (!ts.hasDynamicName(node)) { var symbol = getSymbolOfNode(node); var localSymbol = node.localSymbol || symbol; var firstDeclaration = ts.getDeclarationOfKind(localSymbol, node.kind); @@ -13205,11 +13620,11 @@ var ts; } } function checkBlock(node) { - if (node.kind === 170 /* Block */) { - checkGrammarForStatementInAmbientContext(node); + if (node.kind === 172) { + checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 196 /* ModuleBlock */) { + if (ts.isFunctionBlock(node) || node.kind === 199) { checkFunctionExpressionBodies(node); } } @@ -13227,14 +13642,19 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 126 /* PropertyDeclaration */ || node.kind === 125 /* PropertySignature */ || node.kind === 128 /* MethodDeclaration */ || node.kind === 127 /* MethodSignature */ || node.kind === 130 /* GetAccessor */ || node.kind === 131 /* SetAccessor */) { + if (node.kind === 128 || + node.kind === 127 || + node.kind === 130 || + node.kind === 129 || + node.kind === 132 || + node.kind === 133) { return false; } if (ts.isInAmbientContext(node)) { return false; } var root = getRootDeclaration(node); - if (root.kind === 124 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 126 && ts.nodeIsMissing(root.parent.body)) { return false; } return true; @@ -13247,8 +13667,8 @@ var ts; function checkIfThisIsCapturedInEnclosingScope(node) { var current = node; while (current) { - if (getNodeCheckFlags(current) & 4 /* CaptureThis */) { - var isDeclaration = node.kind !== 64 /* Identifier */; + if (getNodeCheckFlags(current) & 4) { + var isDeclaration = node.kind !== 64; if (isDeclaration) { error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } @@ -13264,12 +13684,12 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; } - var enclosingClass = ts.getAncestor(node, 191 /* ClassDeclaration */); + var enclosingClass = ts.getAncestor(node, 194); if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { return; } if (ts.getClassBaseTypeNode(enclosingClass)) { - var isDeclaration = node.kind !== 64 /* Identifier */; + var isDeclaration = node.kind !== 64; if (isDeclaration) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } @@ -13282,43 +13702,55 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 195 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 198 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 207 /* SourceFile */ && ts.isExternalModule(parent)) { + if (parent.kind === 210 && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } - function checkCollisionWithConstDeclarations(node) { - if (node.initializer && (ts.getCombinedNodeFlags(node) & 6144 /* BlockScoped */) === 0) { + function checkVarDeclaredNamesNotShadowed(node) { + if (node.initializer && (ts.getCombinedNodeFlags(node) & 6144) === 0) { var symbol = getSymbolOfNode(node); - if (symbol.flags & 1 /* FunctionScopedVariable */) { - var localDeclarationSymbol = resolveName(node, node.name.text, 3 /* Variable */, undefined, undefined); - if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { - if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 4096 /* Const */) { - error(node, ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0, symbolToString(localDeclarationSymbol)); + if (symbol.flags & 1) { + var localDeclarationSymbol = resolveName(node, node.name.text, 3, undefined, undefined); + if (localDeclarationSymbol && + localDeclarationSymbol !== symbol && + localDeclarationSymbol.flags & 2) { + if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 6144) { + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 192); + var container = varDeclList.parent.kind === 173 && + varDeclList.parent.parent; + var namesShareScope = container && + (container.kind === 172 && ts.isAnyFunction(container.parent) || + (container.kind === 199 && container.kind === 198) || + container.kind === 210); + if (!namesShareScope) { + var name = symbolToString(localDeclarationSymbol); + error(ts.getErrorSpanForNode(node), ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); + } } } } } } function isParameterDeclaration(node) { - while (node.kind === 146 /* BindingElement */) { + while (node.kind === 148) { node = node.parent.parent; } - return node.kind === 124 /* Parameter */; + return node.kind === 126; } function checkParameterInitializer(node) { - if (getRootDeclaration(node).kind === 124 /* Parameter */) { + if (getRootDeclaration(node).kind === 126) { var func = ts.getContainingFunction(node); visit(node.initializer); } function visit(n) { - if (n.kind === 64 /* Identifier */) { + if (n.kind === 64) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; - if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455 /* Value */) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 124 /* Parameter */) { + if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455) === referencedSymbol) { + if (referencedSymbol.valueDeclaration.kind === 126) { if (referencedSymbol.valueDeclaration === node) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); return; @@ -13337,17 +13769,16 @@ var ts; } function checkVariableLikeDeclaration(node) { checkSourceElement(node.type); - if (ts.hasDynamicName(node)) { + if (node.name.kind === 124) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } - return; } if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && getRootDeclaration(node).kind === 124 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && getRootDeclaration(node).kind === 126 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -13375,9 +13806,11 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, undefined); } } - if (node.kind !== 126 /* PropertyDeclaration */ && node.kind !== 125 /* PropertySignature */) { + if (node.kind !== 128 && node.kind !== 127) { checkExportsOnMergedDeclarations(node); - checkCollisionWithConstDeclarations(node); + if (node.kind === 191 || node.kind === 148) { + checkVarDeclaredNamesNotShadowed(node); + } checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -13404,40 +13837,40 @@ var ts; } function inBlockOrObjectLiteralExpression(node) { while (node) { - if (node.kind === 170 /* Block */ || node.kind === 148 /* ObjectLiteralExpression */) { + if (node.kind === 172 || node.kind === 150) { return true; } node = node.parent; } } function checkExpressionStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); } function checkIfStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); checkSourceElement(node.elseStatement); } function checkDoStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkSourceElement(node.statement); checkExpression(node.expression); } function checkWhileStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.statement); } function checkForStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind == 189 /* VariableDeclarationList */) { + if (!checkGrammarStatementInAmbientContext(node)) { + if (node.initializer && node.initializer.kind == 192) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 189 /* VariableDeclarationList */) { + if (node.initializer.kind === 192) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -13450,31 +13883,22 @@ var ts; checkExpression(node.iterator); checkSourceElement(node.statement); } + function checkForOfStatement(node) { + checkGrammarForOfStatement(node); + } function checkForInStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { - if (node.initializer.kind === 189 /* VariableDeclarationList */) { - var variableList = node.initializer; - if (!checkGrammarVariableDeclarationList(variableList)) { - if (variableList.declarations.length > 1) { - grammarErrorOnFirstToken(variableList.declarations[1], ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement); - } - } - } - } - if (node.initializer.kind === 189 /* VariableDeclarationList */) { + checkGrammarForInOrForOfStatement(node); + if (node.initializer.kind === 192) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { var decl = variableDeclarationList.declarations[0]; checkVariableDeclaration(decl); - if (decl.type) { - error(decl, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation); - } } } else { var varExpr = node.initializer; var exprType = checkExpression(varExpr); - if (exprType !== anyType && exprType !== stringType) { + if (!allConstituentTypesHaveKind(exprType, 1 | 258)) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); } else { @@ -13482,19 +13906,19 @@ var ts; } } var exprType = checkExpression(node.expression); - if (!isTypeOfKind(exprType, 1 /* Any */ | 48128 /* ObjectType */ | 512 /* TypeParameter */)) { + if (!allConstituentTypesHaveKind(exprType, 1 | 48128 | 512)) { error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } checkSourceElement(node.statement); } function checkBreakOrContinueStatement(node) { - checkGrammarForStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); + checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } function isGetAccessorWithAnnotatatedSetAccessor(node) { - return !!(node.kind === 130 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 131 /* SetAccessor */))); + return !!(node.kind === 132 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 133))); } function checkReturnStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { var functionBlock = ts.getContainingFunction(node); if (!functionBlock) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); @@ -13505,11 +13929,11 @@ var ts; if (func) { var returnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); var exprType = checkExpressionCached(node.expression); - if (func.kind === 131 /* SetAccessor */) { + if (func.kind === 133) { error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } else { - if (func.kind === 129 /* Constructor */) { + if (func.kind === 131) { if (!isTypeAssignableTo(exprType, returnType)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -13522,8 +13946,8 @@ var ts; } } function checkWithStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { - if (node.parserContextFlags & 1 /* StrictMode */) { + if (!checkGrammarStatementInAmbientContext(node)) { + if (node.parserContextFlags & 1) { grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); } } @@ -13531,12 +13955,12 @@ var ts; error(node.expression, ts.Diagnostics.All_symbols_within_a_with_block_will_be_resolved_to_any); } function checkSwitchStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); var firstDefaultClause; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); ts.forEach(node.clauses, function (clause) { - if (clause.kind === 201 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 204 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -13548,7 +13972,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 200 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 203) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -13559,13 +13983,13 @@ var ts; }); } function checkLabeledStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { var current = node.parent; while (current) { if (ts.isAnyFunction(current)) { break; } - if (current.kind === 184 /* LabeledStatement */ && current.label.text === node.label.text) { + if (current.kind === 187 && 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; @@ -13576,7 +14000,7 @@ var ts; checkSourceElement(node.statement); } function checkThrowStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { if (node.expression === undefined) { grammarErrorAfterFirstToken(node, ts.Diagnostics.Line_break_not_permitted_here); } @@ -13586,7 +14010,7 @@ var ts; } } function checkTryStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkBlock(node.tryBlock); var catchClause = node.catchClause; if (catchClause) { @@ -13602,24 +14026,24 @@ var ts; checkBlock(node.finallyBlock); } function checkIndexConstraints(type) { - var declaredNumberIndexer = getIndexDeclarationOfSymbol(type.symbol, 1 /* Number */); - var declaredStringIndexer = getIndexDeclarationOfSymbol(type.symbol, 0 /* String */); - var stringIndexType = getIndexTypeOfType(type, 0 /* String */); - var numberIndexType = getIndexTypeOfType(type, 1 /* Number */); + var declaredNumberIndexer = getIndexDeclarationOfSymbol(type.symbol, 1); + var declaredStringIndexer = getIndexDeclarationOfSymbol(type.symbol, 0); + var stringIndexType = getIndexTypeOfType(type, 0); + var numberIndexType = getIndexTypeOfType(type, 1); if (stringIndexType || numberIndexType) { ts.forEach(getPropertiesOfObjectType(type), function (prop) { var propType = getTypeOfSymbol(prop); - checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0 /* String */); - checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1 /* Number */); + checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0); + checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1); }); - if (type.flags & 1024 /* Class */ && type.symbol.valueDeclaration.kind === 191 /* ClassDeclaration */) { + if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 194) { var classDeclaration = type.symbol.valueDeclaration; for (var i = 0; i < classDeclaration.members.length; i++) { var member = classDeclaration.members[i]; - if (!(member.flags & 128 /* Static */) && ts.hasDynamicName(member)) { + if (!(member.flags & 128) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); - checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0 /* String */); - checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, 1 /* Number */); + checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0); + checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, 1); } } } @@ -13627,8 +14051,8 @@ var ts; var errorNode; if (stringIndexType && numberIndexType) { errorNode = declaredNumberIndexer || declaredStringIndexer; - if (!errorNode && (type.flags & 2048 /* Interface */)) { - var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { return getIndexTypeOfType(base, 0 /* String */) && getIndexTypeOfType(base, 1 /* Number */); }); + if (!errorNode && (type.flags & 2048)) { + var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); }); errorNode = someBaseTypeHasBothIndexers ? undefined : type.symbol.declarations[0]; } } @@ -13639,22 +14063,22 @@ var ts; if (!indexType) { return; } - if (indexKind === 1 /* Number */ && !isNumericName(prop.valueDeclaration.name)) { + if (indexKind === 1 && !isNumericName(prop.valueDeclaration.name)) { return; } var errorNode; - if (prop.valueDeclaration.name.kind === 122 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 124 || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { errorNode = indexDeclaration; } - else if (containingType.flags & 2048 /* Interface */) { + else if (containingType.flags & 2048) { var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); }); errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; } if (errorNode && !isTypeAssignableTo(propertyType, indexType)) { - var errorMessage = indexKind === 0 /* String */ ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; + var errorMessage = indexKind === 0 ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); } } @@ -13665,6 +14089,7 @@ var ts; case "number": case "boolean": case "string": + case "symbol": case "void": error(name, message, name.text); } @@ -13705,7 +14130,7 @@ var ts; checkTypeAssignableTo(type, baseType, node.name, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); var staticBaseType = getTypeOfSymbol(baseType.symbol); checkTypeAssignableTo(staticType, getTypeWithoutConstructors(staticBaseType), node.name, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); - if (baseType.symbol !== resolveEntityName(node, baseTypeNode.typeName, 107455 /* Value */)) { + if (baseType.symbol !== resolveEntityName(node, baseTypeNode.typeName, 107455)) { error(baseTypeNode, ts.Diagnostics.Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0, typeToString(baseType)); } checkKindsOfPropertyMemberOverrides(type, baseType); @@ -13719,8 +14144,8 @@ var ts; if (produceDiagnostics) { var t = getTypeFromTypeReferenceNode(typeRefNode); if (t !== unknownType) { - var declaredType = (t.flags & 4096 /* Reference */) ? t.target : t; - if (declaredType.flags & (1024 /* Class */ | 2048 /* Interface */)) { + var declaredType = (t.flags & 4096) ? t.target : t; + if (declaredType.flags & (1024 | 2048)) { checkTypeAssignableTo(type, t, node.name, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); } else { @@ -13737,45 +14162,45 @@ var ts; } } function getTargetSymbol(s) { - return s.flags & 16777216 /* Instantiated */ ? getSymbolLinks(s).target : s; + return s.flags & 16777216 ? getSymbolLinks(s).target : s; } function checkKindsOfPropertyMemberOverrides(type, baseType) { var baseProperties = getPropertiesOfObjectType(baseType); for (var i = 0, len = baseProperties.length; i < len; ++i) { var base = getTargetSymbol(baseProperties[i]); - if (base.flags & 134217728 /* Prototype */) { + if (base.flags & 134217728) { continue; } var derived = getTargetSymbol(getPropertyOfObjectType(type, base.name)); if (derived) { var baseDeclarationFlags = getDeclarationFlagsFromSymbol(base); var derivedDeclarationFlags = getDeclarationFlagsFromSymbol(derived); - if ((baseDeclarationFlags & 32 /* Private */) || (derivedDeclarationFlags & 32 /* Private */)) { + if ((baseDeclarationFlags & 32) || (derivedDeclarationFlags & 32)) { continue; } - if ((baseDeclarationFlags & 128 /* Static */) !== (derivedDeclarationFlags & 128 /* Static */)) { + if ((baseDeclarationFlags & 128) !== (derivedDeclarationFlags & 128)) { continue; } - if ((base.flags & derived.flags & 8192 /* Method */) || ((base.flags & 98308 /* PropertyOrAccessor */) && (derived.flags & 98308 /* PropertyOrAccessor */))) { + if ((base.flags & derived.flags & 8192) || ((base.flags & 98308) && (derived.flags & 98308))) { continue; } var errorMessage; - if (base.flags & 8192 /* Method */) { - if (derived.flags & 98304 /* Accessor */) { + if (base.flags & 8192) { + if (derived.flags & 98304) { errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; } else { - ts.Debug.assert((derived.flags & 4 /* Property */) !== 0); + ts.Debug.assert((derived.flags & 4) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property; } } - else if (base.flags & 4 /* Property */) { - ts.Debug.assert((derived.flags & 8192 /* Method */) !== 0); + else if (base.flags & 4) { + ts.Debug.assert((derived.flags & 8192) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; } else { - ts.Debug.assert((base.flags & 98304 /* Accessor */) !== 0); - ts.Debug.assert((derived.flags & 8192 /* Method */) !== 0); + ts.Debug.assert((base.flags & 98304) !== 0); + ts.Debug.assert((derived.flags & 8192) !== 0); errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; } error(derived.valueDeclaration.name, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); @@ -13783,7 +14208,7 @@ var ts; } } function isAccessor(kind) { - return kind === 130 /* GetAccessor */ || kind === 131 /* SetAccessor */; + return kind === 132 || kind === 133; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -13815,9 +14240,7 @@ var ts; return true; } var seen = {}; - ts.forEach(type.declaredProperties, function (p) { - seen[p.name] = { prop: p, containingType: type }; - }); + ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); var ok = true; for (var i = 0, len = type.baseTypes.length; i < len; ++i) { var base = type.baseTypes[i]; @@ -13834,7 +14257,7 @@ var ts; ok = false; var typeName1 = typeToString(existing.containingType); var typeName2 = typeToString(base); - var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_properties_0_of_types_1_and_2_are_not_identical, prop.name, typeName1, typeName2); + var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2); errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(typeNode, errorInfo)); } @@ -13850,7 +14273,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 192 /* InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 195); 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); @@ -13879,14 +14302,14 @@ var ts; } function computeEnumMemberValues(node) { var nodeLinks = getNodeLinks(node); - if (!(nodeLinks.flags & 128 /* EnumValuesComputed */)) { + if (!(nodeLinks.flags & 128)) { var enumSymbol = getSymbolOfNode(node); var enumType = getDeclaredTypeOfSymbol(enumSymbol); var autoValue = 0; var ambient = ts.isInAmbientContext(node); var enumIsConst = ts.isConst(node); ts.forEach(node.members, function (member) { - if (member.name.kind !== 122 /* ComputedPropertyName */ && isNumericLiteralName(member.name.text)) { + if (member.name.kind !== 124 && isNumericLiteralName(member.name.text)) { error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); } var initializer = member.initializer; @@ -13916,24 +14339,24 @@ var ts; getNodeLinks(member).enumMemberValue = autoValue++; } }); - nodeLinks.flags |= 128 /* EnumValuesComputed */; + nodeLinks.flags |= 128; } function getConstantValueForEnumMemberInitializer(initializer, enumIsConst) { return evalConstant(initializer); function evalConstant(e) { switch (e.kind) { - case 161 /* PrefixUnaryExpression */: + case 163: var value = evalConstant(e.operand); if (value === undefined) { return undefined; } switch (e.operator) { - case 33 /* PlusToken */: return value; - case 34 /* MinusToken */: return -value; - case 47 /* TildeToken */: return enumIsConst ? ~value : undefined; + case 33: return value; + case 34: return -value; + case 47: return enumIsConst ? ~value : undefined; } return undefined; - case 163 /* BinaryExpression */: + case 165: if (!enumIsConst) { return undefined; } @@ -13945,27 +14368,27 @@ var ts; if (right === undefined) { return undefined; } - switch (e.operator) { - case 44 /* BarToken */: return left | right; - case 43 /* AmpersandToken */: return left & right; - case 41 /* GreaterThanGreaterThanToken */: return left >> right; - case 42 /* GreaterThanGreaterThanGreaterThanToken */: return left >>> right; - case 40 /* LessThanLessThanToken */: return left << right; - case 45 /* CaretToken */: return left ^ right; - case 35 /* AsteriskToken */: return left * right; - case 36 /* SlashToken */: return left / right; - case 33 /* PlusToken */: return left + right; - case 34 /* MinusToken */: return left - right; - case 37 /* PercentToken */: return left % right; + switch (e.operatorToken.kind) { + case 44: return left | right; + case 43: return left & right; + case 41: return left >> right; + case 42: return left >>> right; + case 40: return left << right; + case 45: return left ^ right; + case 35: return left * right; + case 36: return left / right; + case 33: return left + right; + case 34: return left - right; + case 37: return left % right; } return undefined; - case 7 /* NumericLiteral */: + case 7: return +e.text; - case 155 /* ParenthesizedExpression */: + case 157: return enumIsConst ? evalConstant(e.expression) : undefined; - case 64 /* Identifier */: - case 150 /* ElementAccessExpression */: - case 149 /* PropertyAccessExpression */: + case 64: + case 152: + case 151: if (!enumIsConst) { return undefined; } @@ -13973,13 +14396,14 @@ var ts; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType; var propertyName; - if (e.kind === 64 /* Identifier */) { + if (e.kind === 64) { enumType = currentType; propertyName = e.text; } else { - if (e.kind === 150 /* ElementAccessExpression */) { - if (e.argumentExpression === undefined || e.argumentExpression.kind !== 8 /* StringLiteral */) { + if (e.kind === 152) { + if (e.argumentExpression === undefined || + e.argumentExpression.kind !== 8) { return undefined; } var enumType = getTypeOfNode(e.expression); @@ -13997,7 +14421,7 @@ var ts; return undefined; } var property = getPropertyOfObjectType(enumType, propertyName); - if (!property || !(property.flags & 8 /* EnumMember */)) { + if (!property || !(property.flags & 8)) { return undefined; } var propertyDecl = property.valueDeclaration; @@ -14035,7 +14459,7 @@ var ts; } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 194 /* EnumDeclaration */) { + if (declaration.kind !== 197) { return false; } var enumDeclaration = declaration; @@ -14058,7 +14482,7 @@ var ts; var declarations = symbol.declarations; for (var i = 0; i < declarations.length; i++) { var declaration = declarations[i]; - if ((declaration.kind === 191 /* ClassDeclaration */ || (declaration.kind === 190 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { + if ((declaration.kind === 194 || (declaration.kind === 193 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } } @@ -14067,14 +14491,14 @@ var ts; function checkModuleDeclaration(node) { if (produceDiagnostics) { if (!checkGrammarModifiers(node)) { - if (!ts.isInAmbientContext(node) && node.name.kind === 8 /* StringLiteral */) { + if (!ts.isInAmbientContext(node) && node.name.kind === 8) { grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names); } - else if (node.name.kind === 64 /* Identifier */ && node.body.kind === 196 /* ModuleBlock */) { + else if (node.name.kind === 64 && node.body.kind === 199) { var statements = node.body.statements; for (var i = 0, n = statements.length; i < n; i++) { var statement = statements[i]; - if (statement.kind === 198 /* ExportAssignment */) { + if (statement.kind === 201) { grammarErrorOnNode(statement, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); } else if (ts.isExternalModuleImportDeclaration(statement)) { @@ -14087,7 +14511,7 @@ var ts; checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - if (symbol.flags & 512 /* ValueModule */ && symbol.declarations.length > 1 && !ts.isInAmbientContext(node) && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { + if (symbol.flags & 512 && symbol.declarations.length > 1 && !ts.isInAmbientContext(node) && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (classOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { @@ -14098,7 +14522,7 @@ var ts; } } } - if (node.name.kind === 8 /* StringLiteral */) { + if (node.name.kind === 8) { if (!isGlobalSourceFile(node.parent)) { error(node.name, ts.Diagnostics.Ambient_external_modules_cannot_be_nested_in_other_modules); } @@ -14110,7 +14534,7 @@ var ts; checkSourceElement(node.body); } function getFirstIdentifier(node) { - while (node.kind === 121 /* QualifiedName */) { + while (node.kind === 123) { node = node.left; } return node; @@ -14124,26 +14548,26 @@ var ts; if (ts.isInternalModuleImportDeclaration(node)) { target = resolveImport(symbol); if (target !== unknownSymbol) { - if (target.flags & 107455 /* Value */) { + if (target.flags & 107455) { var moduleName = getFirstIdentifier(node.moduleReference); - if (resolveEntityName(node, moduleName, 107455 /* Value */ | 1536 /* Namespace */).flags & 1536 /* Namespace */) { + if (resolveEntityName(node, moduleName, 107455 | 1536).flags & 1536) { checkExpressionOrQualifiedName(node.moduleReference); } else { error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName)); } } - if (target.flags & 793056 /* Type */) { + if (target.flags & 793056) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0); } } } else { - if (node.parent.kind === 207 /* SourceFile */) { + if (node.parent.kind === 210) { target = resolveImport(symbol); } - else if (node.parent.kind === 196 /* ModuleBlock */ && node.parent.parent.name.kind === 8 /* StringLiteral */) { - if (ts.getExternalModuleImportDeclarationExpression(node).kind === 8 /* StringLiteral */) { + else if (node.parent.kind === 199 && node.parent.parent.name.kind === 8) { + if (ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { if (isExternalModuleNameRelative(ts.getExternalModuleImportDeclarationExpression(node).text)) { error(node, ts.Diagnostics.Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name); target = unknownSymbol; @@ -14161,18 +14585,20 @@ var ts; } } if (target !== unknownSymbol) { - var excludedMeanings = (symbol.flags & 107455 /* Value */ ? 107455 /* Value */ : 0) | (symbol.flags & 793056 /* Type */ ? 793056 /* Type */ : 0) | (symbol.flags & 1536 /* Namespace */ ? 1536 /* Namespace */ : 0); + var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | + (symbol.flags & 793056 ? 793056 : 0) | + (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { error(node, ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0, symbolToString(symbol)); } } } function checkExportAssignment(node) { - if (!checkGrammarModifiers(node) && (node.flags & 243 /* Modifier */)) { + if (!checkGrammarModifiers(node) && (node.flags & 243)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } var container = node.parent; - if (container.kind !== 207 /* SourceFile */) { + if (container.kind !== 210) { container = container.parent; } checkTypeOfExportAssignmentSymbol(getSymbolOfNode(container)); @@ -14181,176 +14607,179 @@ var ts; if (!node) return; switch (node.kind) { - case 123 /* TypeParameter */: + case 125: return checkTypeParameter(node); - case 124 /* Parameter */: + case 126: return checkParameter(node); - case 126 /* PropertyDeclaration */: - case 125 /* PropertySignature */: + case 128: + case 127: return checkPropertyDeclaration(node); - case 136 /* FunctionType */: - case 137 /* ConstructorType */: - case 132 /* CallSignature */: - case 133 /* ConstructSignature */: + case 138: + case 139: + case 134: + case 135: return checkSignatureDeclaration(node); - case 134 /* IndexSignature */: + case 136: return checkSignatureDeclaration(node); - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: + case 130: + case 129: return checkMethodDeclaration(node); - case 129 /* Constructor */: + case 131: return checkConstructorDeclaration(node); - case 130 /* GetAccessor */: - case 131 /* SetAccessor */: + case 132: + case 133: return checkAccessorDeclaration(node); - case 135 /* TypeReference */: + case 137: return checkTypeReference(node); - case 138 /* TypeQuery */: + case 140: return checkTypeQuery(node); - case 139 /* TypeLiteral */: + case 141: return checkTypeLiteral(node); - case 140 /* ArrayType */: + case 142: return checkArrayType(node); - case 141 /* TupleType */: + case 143: return checkTupleType(node); - case 142 /* UnionType */: + case 144: return checkUnionType(node); - case 143 /* ParenthesizedType */: + case 145: return checkSourceElement(node.type); - case 190 /* FunctionDeclaration */: + case 193: return checkFunctionDeclaration(node); - case 170 /* Block */: - case 196 /* ModuleBlock */: + case 172: + case 199: return checkBlock(node); - case 171 /* VariableStatement */: + case 173: return checkVariableStatement(node); - case 173 /* ExpressionStatement */: + case 175: return checkExpressionStatement(node); - case 174 /* IfStatement */: + case 176: return checkIfStatement(node); - case 175 /* DoStatement */: + case 177: return checkDoStatement(node); - case 176 /* WhileStatement */: + case 178: return checkWhileStatement(node); - case 177 /* ForStatement */: + case 179: return checkForStatement(node); - case 178 /* ForInStatement */: + case 180: return checkForInStatement(node); - case 179 /* ContinueStatement */: - case 180 /* BreakStatement */: + case 181: + return checkForOfStatement(node); + case 182: + case 183: return checkBreakOrContinueStatement(node); - case 181 /* ReturnStatement */: + case 184: return checkReturnStatement(node); - case 182 /* WithStatement */: + case 185: return checkWithStatement(node); - case 183 /* SwitchStatement */: + case 186: return checkSwitchStatement(node); - case 184 /* LabeledStatement */: + case 187: return checkLabeledStatement(node); - case 185 /* ThrowStatement */: + case 188: return checkThrowStatement(node); - case 186 /* TryStatement */: + case 189: return checkTryStatement(node); - case 188 /* VariableDeclaration */: + case 191: return checkVariableDeclaration(node); - case 146 /* BindingElement */: + case 148: return checkBindingElement(node); - case 191 /* ClassDeclaration */: + case 194: return checkClassDeclaration(node); - case 192 /* InterfaceDeclaration */: + case 195: return checkInterfaceDeclaration(node); - case 193 /* TypeAliasDeclaration */: + case 196: return checkTypeAliasDeclaration(node); - case 194 /* EnumDeclaration */: + case 197: return checkEnumDeclaration(node); - case 195 /* ModuleDeclaration */: + case 198: return checkModuleDeclaration(node); - case 197 /* ImportDeclaration */: + case 200: return checkImportDeclaration(node); - case 198 /* ExportAssignment */: + case 201: return checkExportAssignment(node); - case 172 /* EmptyStatement */: - checkGrammarForStatementInAmbientContext(node); + case 174: + checkGrammarStatementInAmbientContext(node); return; - case 187 /* DebuggerStatement */: - checkGrammarForStatementInAmbientContext(node); + case 190: + checkGrammarStatementInAmbientContext(node); return; } } function checkFunctionExpressionBodies(node) { switch (node.kind) { - case 156 /* FunctionExpression */: - case 157 /* ArrowFunction */: + case 158: + case 159: ts.forEach(node.parameters, checkFunctionExpressionBodies); checkFunctionExpressionOrObjectLiteralMethodBody(node); break; - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: + case 130: + case 129: ts.forEach(node.parameters, checkFunctionExpressionBodies); if (ts.isObjectLiteralMethod(node)) { checkFunctionExpressionOrObjectLiteralMethodBody(node); } break; - case 129 /* Constructor */: - case 130 /* GetAccessor */: - case 131 /* SetAccessor */: - case 190 /* FunctionDeclaration */: + case 131: + case 132: + case 133: + case 193: ts.forEach(node.parameters, checkFunctionExpressionBodies); break; - case 182 /* WithStatement */: + case 185: checkFunctionExpressionBodies(node.expression); break; - case 124 /* Parameter */: - case 126 /* PropertyDeclaration */: - case 125 /* PropertySignature */: - case 144 /* ObjectBindingPattern */: - case 145 /* ArrayBindingPattern */: - case 146 /* BindingElement */: - case 147 /* ArrayLiteralExpression */: - case 148 /* ObjectLiteralExpression */: - case 204 /* PropertyAssignment */: - case 149 /* PropertyAccessExpression */: - case 150 /* ElementAccessExpression */: - case 151 /* CallExpression */: - case 152 /* NewExpression */: - case 153 /* TaggedTemplateExpression */: - case 165 /* TemplateExpression */: - case 169 /* TemplateSpan */: - case 154 /* TypeAssertionExpression */: - case 155 /* ParenthesizedExpression */: - case 159 /* TypeOfExpression */: - case 160 /* VoidExpression */: - case 158 /* DeleteExpression */: - case 161 /* PrefixUnaryExpression */: - case 162 /* PostfixUnaryExpression */: - case 163 /* BinaryExpression */: - case 164 /* ConditionalExpression */: - case 167 /* SpreadElementExpression */: - case 170 /* Block */: - case 196 /* ModuleBlock */: - case 171 /* VariableStatement */: - case 173 /* ExpressionStatement */: - case 174 /* IfStatement */: - case 175 /* DoStatement */: - case 176 /* WhileStatement */: - case 177 /* ForStatement */: - case 178 /* ForInStatement */: - case 179 /* ContinueStatement */: - case 180 /* BreakStatement */: - case 181 /* ReturnStatement */: - case 183 /* SwitchStatement */: - case 200 /* CaseClause */: - case 201 /* DefaultClause */: - case 184 /* LabeledStatement */: - case 185 /* ThrowStatement */: - case 186 /* TryStatement */: - case 203 /* CatchClause */: - case 188 /* VariableDeclaration */: - case 189 /* VariableDeclarationList */: - case 191 /* ClassDeclaration */: - case 194 /* EnumDeclaration */: - case 206 /* EnumMember */: - case 207 /* SourceFile */: + case 126: + case 128: + case 127: + case 146: + case 147: + case 148: + case 149: + case 150: + case 207: + case 151: + case 152: + case 153: + case 154: + case 155: + case 167: + case 171: + case 156: + case 157: + case 161: + case 162: + case 160: + case 163: + case 164: + case 165: + case 166: + case 169: + case 172: + case 199: + case 173: + case 175: + case 176: + case 177: + case 178: + case 179: + case 180: + case 181: + case 182: + case 183: + case 184: + case 186: + case 203: + case 204: + case 187: + case 188: + case 189: + case 206: + case 191: + case 192: + case 194: + case 197: + case 209: + case 210: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -14362,7 +14791,7 @@ var ts; } function checkSourceFileWorker(node) { var links = getNodeLinks(node); - if (!(links.flags & 1 /* TypeChecked */)) { + if (!(links.flags & 1)) { checkGrammarSourceFile(node); emitExtends = false; potentialThisCollisions.length = 0; @@ -14370,9 +14799,9 @@ var ts; checkFunctionExpressionBodies(node); if (ts.isExternalModule(node)) { var symbol = getExportAssignmentSymbol(node.symbol); - if (symbol && symbol.flags & 8388608 /* Import */) { + if (symbol && symbol.flags & 8388608) { getSymbolLinks(symbol).referenced = true; - markLinkedImportsAsReferenced(ts.getDeclarationOfKind(symbol, 197 /* ImportDeclaration */)); + markLinkedImportsAsReferenced(ts.getDeclarationOfKind(symbol, 200)); } } if (potentialThisCollisions.length) { @@ -14380,9 +14809,9 @@ var ts; potentialThisCollisions.length = 0; } if (emitExtends) { - links.flags |= 8 /* EmitExtends */; + links.flags |= 8; } - links.flags |= 1 /* TypeChecked */; + links.flags |= 1; } } function getDiagnostics(sourceFile) { @@ -14406,7 +14835,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 182 /* WithStatement */ && node.parent.statement === node) { + if (node.parent.kind === 185 && node.parent.statement === node) { return true; } node = node.parent; @@ -14442,27 +14871,27 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 207 /* SourceFile */: + case 210: if (!ts.isExternalModule(location)) break; - case 195 /* ModuleDeclaration */: - copySymbols(getSymbolOfNode(location).exports, meaning & 8914931 /* ModuleMember */); + case 198: + copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 194 /* EnumDeclaration */: - copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); + case 197: + copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 191 /* ClassDeclaration */: - case 192 /* InterfaceDeclaration */: - if (!(memberFlags & 128 /* Static */)) { - copySymbols(getSymbolOfNode(location).members, meaning & 793056 /* Type */); + case 194: + case 195: + if (!(memberFlags & 128)) { + copySymbols(getSymbolOfNode(location).members, meaning & 793056); } break; - case 156 /* FunctionExpression */: + case 158: if (location.name) { copySymbol(location.symbol, meaning); } break; - case 203 /* CatchClause */: + case 206: if (location.name.text) { copySymbol(location.symbol, meaning); } @@ -14475,91 +14904,94 @@ var ts; return ts.mapToArray(symbols); } function isTypeDeclarationName(name) { - return name.kind == 64 /* Identifier */ && isTypeDeclaration(name.parent) && name.parent.name === name; + return name.kind == 64 && + isTypeDeclaration(name.parent) && + name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { - case 123 /* TypeParameter */: - case 191 /* ClassDeclaration */: - case 192 /* InterfaceDeclaration */: - case 193 /* TypeAliasDeclaration */: - case 194 /* EnumDeclaration */: + case 125: + case 194: + case 195: + case 196: + case 197: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 121 /* QualifiedName */) + while (node.parent && node.parent.kind === 123) node = node.parent; - return node.parent && node.parent.kind === 135 /* TypeReference */; + return node.parent && node.parent.kind === 137; } function isTypeNode(node) { - if (135 /* FirstTypeNode */ <= node.kind && node.kind <= 143 /* LastTypeNode */) { + if (137 <= node.kind && node.kind <= 145) { return true; } switch (node.kind) { - case 110 /* AnyKeyword */: - case 117 /* NumberKeyword */: - case 119 /* StringKeyword */: - case 111 /* BooleanKeyword */: + case 110: + case 117: + case 119: + case 111: + case 120: return true; - case 98 /* VoidKeyword */: - return node.parent.kind !== 160 /* VoidExpression */; - case 8 /* StringLiteral */: - return node.parent.kind === 124 /* Parameter */; - case 64 /* Identifier */: - if (node.parent.kind === 121 /* QualifiedName */ && node.parent.right === node) { + case 98: + return node.parent.kind !== 162; + case 8: + return node.parent.kind === 126; + case 64: + if (node.parent.kind === 123 && node.parent.right === node) { node = node.parent; } - case 121 /* QualifiedName */: - ts.Debug.assert(node.kind === 64 /* Identifier */ || node.kind === 121 /* QualifiedName */, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); + case 123: + ts.Debug.assert(node.kind === 64 || node.kind === 123, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); var parent = node.parent; - if (parent.kind === 138 /* TypeQuery */) { + if (parent.kind === 140) { return false; } - if (135 /* FirstTypeNode */ <= parent.kind && parent.kind <= 143 /* LastTypeNode */) { + if (137 <= parent.kind && parent.kind <= 145) { return true; } switch (parent.kind) { - case 123 /* TypeParameter */: + case 125: return node === parent.constraint; - case 126 /* PropertyDeclaration */: - case 125 /* PropertySignature */: - case 124 /* Parameter */: - case 188 /* VariableDeclaration */: + case 128: + case 127: + case 126: + case 191: return node === parent.type; - case 190 /* FunctionDeclaration */: - case 156 /* FunctionExpression */: - case 157 /* ArrowFunction */: - case 129 /* Constructor */: - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: - case 130 /* GetAccessor */: - case 131 /* SetAccessor */: + case 193: + case 158: + case 159: + case 131: + case 130: + case 129: + case 132: + case 133: return node === parent.type; - case 132 /* CallSignature */: - case 133 /* ConstructSignature */: - case 134 /* IndexSignature */: + case 134: + case 135: + case 136: return node === parent.type; - case 154 /* TypeAssertionExpression */: + case 156: return node === parent.type; - case 151 /* CallExpression */: - case 152 /* NewExpression */: + case 153: + case 154: return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; - case 153 /* TaggedTemplateExpression */: + case 155: return false; } } return false; } function getLeftSideOfImportOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 121 /* QualifiedName */) { + while (nodeOnRightSide.parent.kind === 123) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 197 /* ImportDeclaration */) { + if (nodeOnRightSide.parent.kind === 200) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 198 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 201) { return nodeOnRightSide.parent.exportName === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -14568,16 +15000,17 @@ var ts; return getLeftSideOfImportOrExportAssignment(node) !== undefined; } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 121 /* QualifiedName */ && node.parent.right === node) || (node.parent.kind === 149 /* PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 123 && node.parent.right === node) || + (node.parent.kind === 151 && node.parent.name === node); } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 198 /* ExportAssignment */) { - return resolveEntityName(entityName.parent.parent, entityName, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Import */); + if (entityName.parent.kind === 201) { + return resolveEntityName(entityName.parent.parent, entityName, 107455 | 793056 | 1536 | 8388608); } - if (entityName.kind !== 149 /* PropertyAccessExpression */) { + if (entityName.kind !== 151) { if (isInRightSideOfImportOrExportAssignment(entityName)) { return getSymbolOfPartOfRightHandSideOfImport(entityName); } @@ -14589,18 +15022,18 @@ var ts; if (ts.getFullWidth(entityName) === 0) { return undefined; } - if (entityName.kind === 64 /* Identifier */) { - var meaning = 107455 /* Value */ | 8388608 /* Import */; + if (entityName.kind === 64) { + var meaning = 107455 | 8388608; return resolveEntityName(entityName, entityName, meaning); } - else if (entityName.kind === 149 /* PropertyAccessExpression */) { + else if (entityName.kind === 151) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 121 /* QualifiedName */) { + else if (entityName.kind === 123) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -14609,8 +15042,8 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 135 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; - meaning |= 8388608 /* Import */; + var meaning = entityName.parent.kind === 137 ? 793056 : 1536; + meaning |= 8388608; return resolveEntityName(entityName, entityName, meaning); } return undefined; @@ -14622,32 +15055,33 @@ var ts; if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { return getSymbolOfNode(node.parent); } - if (node.kind === 64 /* Identifier */ && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 198 /* ExportAssignment */ ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImport(node); + if (node.kind === 64 && isInRightSideOfImportOrExportAssignment(node)) { + return node.parent.kind === 201 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImport(node); } switch (node.kind) { - case 64 /* Identifier */: - case 149 /* PropertyAccessExpression */: - case 121 /* QualifiedName */: + case 64: + case 151: + case 123: return getSymbolOfEntityNameOrPropertyAccessExpression(node); - case 92 /* ThisKeyword */: - case 90 /* SuperKeyword */: + case 92: + case 90: var type = checkExpression(node); return type.symbol; - case 112 /* ConstructorKeyword */: + case 112: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 129 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 131) { return constructorDeclaration.parent.symbol; } return undefined; - case 8 /* StringLiteral */: - if (ts.isExternalModuleImportDeclaration(node.parent.parent) && ts.getExternalModuleImportDeclarationExpression(node.parent.parent) === node) { + case 8: + if (ts.isExternalModuleImportDeclaration(node.parent.parent) && + ts.getExternalModuleImportDeclarationExpression(node.parent.parent) === node) { var importSymbol = getSymbolOfNode(node.parent.parent); var moduleType = getTypeOfSymbol(importSymbol); return moduleType ? moduleType.symbol : undefined; } - case 7 /* NumericLiteral */: - if (node.parent.kind == 150 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { + case 7: + if (node.parent.kind == 152 && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -14661,8 +15095,8 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 205 /* ShorthandPropertyAssignment */) { - return resolveEntityName(location, location.name, 107455 /* Value */); + if (location && location.kind === 208) { + return resolveEntityName(location, location.name, 107455); } return undefined; } @@ -14708,7 +15142,7 @@ var ts; function getAugmentedPropertiesOfType(type) { var type = getApparentType(type); var propsByName = createSymbolTable(getPropertiesOfType(type)); - if (getSignaturesOfType(type, 0 /* Call */).length || getSignaturesOfType(type, 1 /* Construct */).length) { + if (getSignaturesOfType(type, 0).length || getSignaturesOfType(type, 1).length) { ts.forEach(getPropertiesOfType(globalFunctionType), function (p) { if (!ts.hasProperty(propsByName, p.name)) { propsByName[p.name] = p; @@ -14718,7 +15152,7 @@ var ts; return getNamedMembers(propsByName); } function getRootSymbols(symbol) { - if (symbol.flags & 268435456 /* UnionProperty */) { + if (symbol.flags & 268435456) { var symbols = []; var name = symbol.name; ts.forEach(getSymbolLinks(symbol).unionType.types, function (t) { @@ -14726,7 +15160,7 @@ var ts; }); return symbols; } - else if (symbol.flags & 67108864 /* Transient */) { + else if (symbol.flags & 67108864) { var target = getSymbolLinks(symbol).target; if (target) { return [target]; @@ -14735,7 +15169,7 @@ var ts; return [symbol]; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 512 /* ValueModule */ && symbol.declarations.length === 1 && symbol.declarations[0].kind === 207 /* SourceFile */; + return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 210; } function isNodeDescendentOf(node, ancestor) { while (node) { @@ -14749,11 +15183,11 @@ var ts; for (var node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { if (node.locals && ts.hasProperty(node.locals, name)) { var symbolWithRelevantName = node.locals[name]; - if (symbolWithRelevantName.flags & (107455 /* Value */ | 1048576 /* ExportValue */)) { + if (symbolWithRelevantName.flags & (107455 | 1048576)) { return false; } - if (symbolWithRelevantName.flags & 8388608 /* Import */) { - var importDeclarationWithRelevantName = ts.getDeclarationOfKind(symbolWithRelevantName, 197 /* ImportDeclaration */); + if (symbolWithRelevantName.flags & 8388608) { + var importDeclarationWithRelevantName = ts.getDeclarationOfKind(symbolWithRelevantName, 200); if (isReferencedImportDeclaration(importDeclarationWithRelevantName)) { return false; } @@ -14777,7 +15211,7 @@ var ts; function getLocalNameForSymbol(symbol, location) { var node = location; while (node) { - if ((node.kind === 195 /* ModuleDeclaration */ || node.kind === 194 /* EnumDeclaration */) && getSymbolOfNode(node) === symbol) { + if ((node.kind === 198 || node.kind === 197) && getSymbolOfNode(node) === symbol) { return getLocalNameOfContainer(node); } node = node.parent; @@ -14788,7 +15222,7 @@ var ts; var symbol = getNodeLinks(node).resolvedSymbol; if (symbol) { var exportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); - if (symbol !== exportSymbol && !(exportSymbol.flags & 944 /* ExportHasLocal */)) { + if (symbol !== exportSymbol && !(exportSymbol.flags & 944)) { symbol = exportSymbol; } if (symbol.parent) { @@ -14801,14 +15235,14 @@ var ts; return symbol && symbolIsValue(symbol) && !isConstEnumSymbol(symbol) ? symbolToString(symbol) : undefined; } function isTopLevelValueImportWithEntityName(node) { - if (node.parent.kind !== 207 /* SourceFile */ || !ts.isInternalModuleImportDeclaration(node)) { + if (node.parent.kind !== 210 || !ts.isInternalModuleImportDeclaration(node)) { return false; } return isImportResolvedToValue(getSymbolOfNode(node)); } function isImportResolvedToValue(symbol) { var target = resolveImport(symbol); - return target !== unknownSymbol && target.flags & 107455 /* Value */ && !isConstEnumOrConstEnumOnlyModule(target); + return target !== unknownSymbol && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target); } function isConstEnumOrConstEnumOnlyModule(s) { return isConstEnumSymbol(s) || s.constEnumOnlyModule; @@ -14818,7 +15252,7 @@ var ts; if (getSymbolLinks(symbol).referenced) { return true; } - if (node.flags & 1 /* Export */) { + if (node.flags & 1) { return isImportResolvedToValue(symbol); } return false; @@ -14827,7 +15261,8 @@ var ts; if (ts.nodeIsPresent(node.body)) { var symbol = getSymbolOfNode(node); var signaturesOfSymbol = getSignaturesOfSymbol(symbol); - return signaturesOfSymbol.length > 1 || (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); + return signaturesOfSymbol.length > 1 || + (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); } return false; } @@ -14839,14 +15274,14 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 206 /* EnumMember */) { + if (node.kind === 209) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; - if (symbol && (symbol.flags & 8 /* EnumMember */)) { + if (symbol && (symbol.flags & 8)) { var declaration = symbol.valueDeclaration; var constantValue; - if (declaration.kind === 206 /* EnumMember */) { + if (declaration.kind === 209) { return getEnumMemberValue(declaration); } } @@ -14854,7 +15289,7 @@ var ts; } function writeTypeOfDeclaration(declaration, enclosingDeclaration, flags, writer) { var symbol = getSymbolOfNode(declaration); - var type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? getTypeOfSymbol(symbol) : unknownType; + var type = symbol && !(symbol.flags & (2048 | 131072)) ? getTypeOfSymbol(symbol) : unknownType; getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { @@ -14862,7 +15297,7 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); } function isUnknownIdentifier(location, name) { - return !resolveName(location, name, 107455 /* Value */, undefined, undefined); + return !resolveName(location, name, 107455, undefined, undefined); } function createResolver() { return { @@ -14895,7 +15330,7 @@ var ts; getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); getSymbolLinks(unknownSymbol).type = unknownType; globals[undefinedSymbol.name] = undefinedSymbol; - globalArraySymbol = getGlobalSymbol("Array"); + globalArraySymbol = getGlobalTypeSymbol("Array"); globalArrayType = getTypeOfGlobalSymbol(globalArraySymbol, 1); globalObjectType = getGlobalType("Object"); globalFunctionType = getGlobalType("Function"); @@ -14903,29 +15338,38 @@ var ts; globalNumberType = getGlobalType("Number"); globalBooleanType = getGlobalType("Boolean"); globalRegExpType = getGlobalType("RegExp"); - globalTemplateStringsArrayType = languageVersion >= 2 /* ES6 */ ? getGlobalType("TemplateStringsArray") : unknownType; + if (languageVersion >= 2) { + globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); + globalESSymbolType = getGlobalType("Symbol"); + globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); + } + else { + globalTemplateStringsArrayType = unknownType; + globalESSymbolType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + globalESSymbolConstructorSymbol = undefined; + } anyArrayType = createArrayType(anyType); } function checkGrammarModifiers(node) { switch (node.kind) { - case 130 /* GetAccessor */: - case 131 /* SetAccessor */: - case 129 /* Constructor */: - case 126 /* PropertyDeclaration */: - case 125 /* PropertySignature */: - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: - case 134 /* IndexSignature */: - case 191 /* ClassDeclaration */: - case 192 /* InterfaceDeclaration */: - case 195 /* ModuleDeclaration */: - case 194 /* EnumDeclaration */: - case 198 /* ExportAssignment */: - case 171 /* VariableStatement */: - case 190 /* FunctionDeclaration */: - case 193 /* TypeAliasDeclaration */: - case 197 /* ImportDeclaration */: - case 124 /* Parameter */: + case 132: + case 133: + case 131: + case 128: + case 127: + case 130: + case 129: + case 136: + case 194: + case 195: + case 198: + case 197: + case 201: + case 173: + case 193: + case 196: + case 200: + case 126: break; default: return false; @@ -14938,14 +15382,14 @@ var ts; for (var i = 0, n = node.modifiers.length; i < n; i++) { var modifier = node.modifiers[i]; switch (modifier.kind) { - case 107 /* PublicKeyword */: - case 106 /* ProtectedKeyword */: - case 105 /* PrivateKeyword */: + case 107: + case 106: + case 105: var text; - if (modifier.kind === 107 /* PublicKeyword */) { + if (modifier.kind === 107) { text = "public"; } - else if (modifier.kind === 106 /* ProtectedKeyword */) { + else if (modifier.kind === 106) { text = "protected"; lastProtected = modifier; } @@ -14953,81 +15397,81 @@ var ts; text = "private"; lastPrivate = modifier; } - if (flags & 112 /* AccessibilityModifier */) { + if (flags & 112) { return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen); } - else if (flags & 128 /* Static */) { + else if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } - else if (node.parent.kind === 196 /* ModuleBlock */ || node.parent.kind === 207 /* SourceFile */) { + else if (node.parent.kind === 199 || node.parent.kind === 210) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } flags |= ts.modifierToFlag(modifier.kind); break; - case 108 /* StaticKeyword */: - if (flags & 128 /* Static */) { + case 108: + if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (node.parent.kind === 196 /* ModuleBlock */ || node.parent.kind === 207 /* SourceFile */) { + else if (node.parent.kind === 199 || node.parent.kind === 210) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } - else if (node.kind === 124 /* Parameter */) { + else if (node.kind === 126) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } - flags |= 128 /* Static */; + flags |= 128; lastStatic = modifier; break; - case 77 /* ExportKeyword */: - if (flags & 1 /* Export */) { + case 77: + if (flags & 1) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); } - else if (flags & 2 /* Ambient */) { + else if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (node.parent.kind === 191 /* ClassDeclaration */) { + else if (node.parent.kind === 194) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 124 /* Parameter */) { + else if (node.kind === 126) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } - flags |= 1 /* Export */; + flags |= 1; break; - case 113 /* DeclareKeyword */: - if (flags & 2 /* Ambient */) { + case 113: + if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (node.parent.kind === 191 /* ClassDeclaration */) { + else if (node.parent.kind === 194) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 124 /* Parameter */) { + else if (node.kind === 126) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 196 /* ModuleBlock */) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 199) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } - flags |= 2 /* Ambient */; + flags |= 2; lastDeclare = modifier; break; } } - if (node.kind === 129 /* Constructor */) { - if (flags & 128 /* Static */) { + if (node.kind === 131) { + if (flags & 128) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } - else if (flags & 64 /* Protected */) { + else if (flags & 64) { return grammarErrorOnNode(lastProtected, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected"); } - else if (flags & 32 /* Private */) { + else if (flags & 32) { return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } } - else if (node.kind === 197 /* ImportDeclaration */ && flags & 2 /* Ambient */) { + else if (node.kind === 200 && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 192 /* InterfaceDeclaration */ && flags & 2 /* Ambient */) { + else if (node.kind === 195 && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); } - else if (node.kind === 124 /* Parameter */ && (flags & 112 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 126 && (flags & 112) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } } @@ -15095,30 +15539,30 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter); } } - else if (parameter.dotDotDotToken) { + if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter); } - else if (parameter.flags & 243 /* Modifier */) { + if (parameter.flags & 243) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); } - else if (parameter.questionToken) { + if (parameter.questionToken) { return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark); } - else if (parameter.initializer) { + if (parameter.initializer) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_initializer); } - else if (!parameter.type) { + if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - else if (parameter.type.kind !== 119 /* StringKeyword */ && parameter.type.kind !== 117 /* NumberKeyword */) { + if (parameter.type.kind !== 119 && parameter.type.kind !== 117) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } - else if (!node.type) { + if (!node.type) { return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_a_type_annotation); } } function checkGrammarForIndexSignatureModifier(node) { - if (node.flags & 243 /* Modifier */) { + if (node.flags & 243) { grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_not_permitted_on_index_signature_members); } } @@ -15134,21 +15578,23 @@ var ts; } } function checkGrammarTypeArguments(node, typeArguments) { - return checkGrammarForDisallowedTrailingComma(typeArguments) || checkGrammarForAtLeastOneTypeArgument(node, typeArguments); + return checkGrammarForDisallowedTrailingComma(typeArguments) || + checkGrammarForAtLeastOneTypeArgument(node, typeArguments); } function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); for (var i = 0, n = arguments.length; i < n; i++) { var arg = arguments[i]; - if (arg.kind === 168 /* OmittedExpression */) { + if (arg.kind === 170) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } } } function checkGrammarArguments(node, arguments) { - return checkGrammarForDisallowedTrailingComma(arguments) || checkGrammarForOmittedArgument(node, arguments); + return checkGrammarForDisallowedTrailingComma(arguments) || + checkGrammarForOmittedArgument(node, arguments); } function checkGrammarHeritageClause(node) { var types = node.types; @@ -15168,7 +15614,7 @@ var ts; for (var i = 0, n = node.heritageClauses.length; i < n; i++) { ts.Debug.assert(i <= 2); var heritageClause = node.heritageClauses[i]; - if (heritageClause.token === 78 /* ExtendsKeyword */) { + if (heritageClause.token === 78) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } @@ -15181,7 +15627,7 @@ var ts; seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 101 /* ImplementsKeyword */); + ts.Debug.assert(heritageClause.token === 101); if (seenImplementsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen); } @@ -15197,14 +15643,14 @@ var ts; for (var i = 0, n = node.heritageClauses.length; i < n; i++) { ts.Debug.assert(i <= 1); var heritageClause = node.heritageClauses[i]; - if (heritageClause.token === 78 /* ExtendsKeyword */) { + if (heritageClause.token === 78) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 101 /* ImplementsKeyword */); + ts.Debug.assert(heritageClause.token === 101); return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause); } checkGrammarHeritageClause(heritageClause); @@ -15213,14 +15659,11 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 122 /* ComputedPropertyName */) { + if (node.kind !== 124) { return false; } var computedPropertyName = node; - if (languageVersion < 2 /* ES6 */) { - return grammarErrorOnNode(node, ts.Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher); - } - else if (computedPropertyName.expression.kind === 163 /* BinaryExpression */ && computedPropertyName.expression.operator === 23 /* CommaToken */) { + if (computedPropertyName.expression.kind === 165 && computedPropertyName.expression.operatorToken.kind === 23) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } @@ -15243,29 +15686,30 @@ var ts; var GetAccessor = 2; var SetAccesor = 4; var GetOrSetAccessor = GetAccessor | SetAccesor; - var inStrictMode = (node.parserContextFlags & 1 /* StrictMode */) !== 0; + var inStrictMode = (node.parserContextFlags & 1) !== 0; for (var i = 0, n = node.properties.length; i < n; i++) { var prop = node.properties[i]; var name = prop.name; - if (prop.kind === 168 /* OmittedExpression */ || name.kind === 122 /* ComputedPropertyName */) { + if (prop.kind === 170 || + name.kind === 124) { checkGrammarComputedPropertyName(name); continue; } var currentKind; - if (prop.kind === 204 /* PropertyAssignment */ || prop.kind === 205 /* ShorthandPropertyAssignment */) { + if (prop.kind === 207 || prop.kind === 208) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name.kind === 7 /* NumericLiteral */) { + if (name.kind === 7) { checkGrammarNumbericLiteral(name); } currentKind = Property; } - else if (prop.kind === 128 /* MethodDeclaration */) { + else if (prop.kind === 130) { currentKind = Property; } - else if (prop.kind === 130 /* GetAccessor */) { + else if (prop.kind === 132) { currentKind = GetAccessor; } - else if (prop.kind === 131 /* SetAccessor */) { + else if (prop.kind === 133) { currentKind = SetAccesor; } else { @@ -15295,9 +15739,40 @@ var ts; } } } + function checkGrammarForInOrForOfStatement(forInOrOfStatement) { + if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { + return true; + } + if (forInOrOfStatement.initializer.kind === 192) { + var variableList = forInOrOfStatement.initializer; + if (!checkGrammarVariableDeclarationList(variableList)) { + if (variableList.declarations.length > 1) { + var diagnostic = forInOrOfStatement.kind === 180 ? 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 === 180 ? 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 === 180 ? 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); + } + } + } + return false; + } + function checkGrammarForOfStatement(forOfStatement) { + return grammarErrorOnFirstToken(forOfStatement, ts.Diagnostics.for_of_statements_are_not_currently_supported); + if (languageVersion < 2) { + return grammarErrorOnFirstToken(forOfStatement, ts.Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher); + } + return checkGrammarForInOrForOfStatement(forOfStatement); + } function checkGrammarAccessor(accessor) { var kind = accessor.kind; - if (languageVersion < 1 /* ES5 */) { + if (languageVersion < 1) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); } else if (ts.isInAmbientContext(accessor)) { @@ -15309,10 +15784,10 @@ var ts; else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 130 /* GetAccessor */ && accessor.parameters.length) { + else if (kind === 132 && accessor.parameters.length) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 131 /* SetAccessor */) { + else if (kind === 133) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -15324,7 +15799,7 @@ var ts; if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter); } - else if (parameter.flags & 243 /* Modifier */) { + else if (parameter.flags & 243) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } else if (parameter.questionToken) { @@ -15336,16 +15811,18 @@ var ts; } } } - function checkGrammarForDisallowedComputedProperty(node, message) { - if (node.kind === 122 /* ComputedPropertyName */) { + function checkGrammarForNonSymbolComputedProperty(node, message) { + if (node.kind === 124 && !ts.isWellKnownSymbolSyntactically(node.expression)) { return grammarErrorOnNode(node, message); } } function checkGrammarMethod(node) { - if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionLikeDeclaration(node) || checkGrammarForGenerator(node)) { + if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || + checkGrammarFunctionLikeDeclaration(node) || + checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 148 /* ObjectLiteralExpression */) { + if (node.parent.kind === 150) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -15353,32 +15830,33 @@ var ts; return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } - if (node.parent.kind === 191 /* ClassDeclaration */) { + if (node.parent.kind === 194) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } if (ts.isInAmbientContext(node)) { - return checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_an_ambient_context); + return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol); } else if (!node.body) { - return checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_method_overloads); + 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 === 192 /* InterfaceDeclaration */) { - return checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_interfaces); + else if (node.parent.kind === 195) { + 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 === 139 /* TypeLiteral */) { - return checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_type_literals); + else if (node.parent.kind === 141) { + 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 177 /* ForStatement */: - case 178 /* ForInStatement */: - case 175 /* DoStatement */: - case 176 /* WhileStatement */: + case 179: + case 180: + case 181: + case 177: + case 178: return true; - case 184 /* LabeledStatement */: + case 187: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -15390,17 +15868,17 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 184 /* LabeledStatement */: + case 187: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 179 /* ContinueStatement */ && !isIterationStatement(current.statement, true); + var isMisplacedContinueLabel = node.kind === 182 && !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); } return false; } break; - case 183 /* SwitchStatement */: - if (node.kind === 180 /* BreakStatement */ && !node.label) { + case 186: + if (node.kind === 183 && !node.label) { return false; } break; @@ -15413,11 +15891,11 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 180 /* 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; + var message = node.kind === 183 ? 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 === 180 /* 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; + var message = node.kind === 183 ? 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); } } @@ -15452,7 +15930,22 @@ var ts; } } } - return checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + var checkLetConstNames = languageVersion >= 2 && (ts.isLet(node) || ts.isConst(node)); + return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || + checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + } + function checkGrammarNameInLetOrConstDeclarations(name) { + if (name.kind === 64) { + if (name.text === "let") { + return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); + } + } + else { + var elements = name.elements; + for (var i = 0; i < elements.length; ++i) { + checkGrammarNameInLetOrConstDeclarations(elements[i].name); + } + } } function checkGrammarVariableDeclarationList(declarationList) { var declarations = declarationList.declarations; @@ -15462,7 +15955,7 @@ var ts; if (!declarationList.declarations.length) { return grammarErrorAtPos(ts.getSourceFileOfNode(declarationList), declarations.pos, declarations.end - declarations.pos, ts.Diagnostics.Variable_declaration_list_cannot_be_empty); } - if (languageVersion < 2 /* ES6 */) { + if (languageVersion < 2) { if (ts.isLet(declarationList)) { return grammarErrorOnFirstToken(declarationList, ts.Diagnostics.let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher); } @@ -15473,14 +15966,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 174 /* IfStatement */: - case 175 /* DoStatement */: - case 176 /* WhileStatement */: - case 182 /* WithStatement */: - case 177 /* ForStatement */: - case 178 /* ForInStatement */: + case 176: + case 177: + case 178: + case 185: + case 179: + case 180: + case 181: return false; - case 184 /* LabeledStatement */: + case 187: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -15496,26 +15990,26 @@ var ts; } } function isIntegerLiteral(expression) { - if (expression.kind === 161 /* PrefixUnaryExpression */) { + if (expression.kind === 163) { var unaryExpression = expression; - if (unaryExpression.operator === 33 /* PlusToken */ || unaryExpression.operator === 34 /* MinusToken */) { + if (unaryExpression.operator === 33 || unaryExpression.operator === 34) { expression = unaryExpression.operand; } } - if (expression.kind === 7 /* NumericLiteral */) { + if (expression.kind === 7) { return /^[0-9]+([eE]\+?[0-9]+)?$/.test(expression.text); } return false; } function checkGrammarEnumDeclaration(enumDecl) { - var enumIsConst = (enumDecl.flags & 4096 /* Const */) !== 0; + var enumIsConst = (enumDecl.flags & 4096) !== 0; var hasError = false; if (!enumIsConst) { var inConstantEnumMemberSection = true; var inAmbientContext = ts.isInAmbientContext(enumDecl); for (var i = 0, n = enumDecl.members.length; i < n; i++) { var node = enumDecl.members[i]; - if (node.name.kind === 122 /* ComputedPropertyName */) { + if (node.name.kind === 124) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); } else if (inAmbientContext) { @@ -15567,7 +16061,7 @@ var ts; } } function checkGrammarEvalOrArgumentsInStrictMode(contextNode, identifier) { - if (contextNode && (contextNode.parserContextFlags & 1 /* StrictMode */) && ts.isEvalOrArgumentsIdentifier(identifier)) { + if (contextNode && (contextNode.parserContextFlags & 1) && ts.isEvalOrArgumentsIdentifier(identifier)) { var name = ts.declarationNameToString(identifier); return grammarErrorOnNode(identifier, ts.Diagnostics.Invalid_use_of_0_in_strict_mode, name); } @@ -15583,18 +16077,19 @@ var ts; } } function checkGrammarProperty(node) { - if (node.parent.kind === 191 /* ClassDeclaration */) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_class_property_declarations)) { + if (node.parent.kind === 194) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || + checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 192 /* InterfaceDeclaration */) { - if (checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_interfaces)) { + else if (node.parent.kind === 195) { + 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 === 139 /* TypeLiteral */) { - if (checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_type_literals)) { + else if (node.parent.kind === 141) { + if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } } @@ -15603,7 +16098,10 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 192 /* InterfaceDeclaration */ || node.kind === 197 /* ImportDeclaration */ || node.kind === 198 /* ExportAssignment */ || (node.flags & 2 /* Ambient */)) { + if (node.kind === 195 || + node.kind === 200 || + node.kind === 201 || + (node.flags & 2)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -15611,7 +16109,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var i = 0, n = file.statements.length; i < n; i++) { var decl = file.statements[i]; - if (ts.isDeclaration(decl) || decl.kind === 171 /* VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 173) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -15621,7 +16119,7 @@ var ts; function checkGrammarSourceFile(node) { return ts.isInAmbientContext(node) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node); } - function checkGrammarForStatementInAmbientContext(node) { + function checkGrammarStatementInAmbientContext(node) { if (ts.isInAmbientContext(node)) { if (isAccessor(node.parent.kind)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = true; @@ -15630,7 +16128,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isAnyFunction(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 170 /* Block */ || node.parent.kind === 196 /* ModuleBlock */ || node.parent.kind === 207 /* SourceFile */) { + if (node.parent.kind === 172 || node.parent.kind === 199 || node.parent.kind === 210) { var links = getNodeLinks(node.parent); if (!links.hasReportedStatementInAmbientContext) { return links.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -15641,11 +16139,11 @@ var ts; } } function checkGrammarNumbericLiteral(node) { - if (node.flags & 8192 /* OctalLiteral */) { - if (node.parserContextFlags & 1 /* StrictMode */) { + if (node.flags & 8192) { + if (node.parserContextFlags & 1) { return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode); } - else if (languageVersion >= 1 /* ES5 */) { + else if (languageVersion >= 1) { return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); } } @@ -15754,7 +16252,8 @@ var ts; return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line; } function emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments) { - if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && + getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { writer.writeLine(); } } @@ -15778,15 +16277,15 @@ var ts; }); } function writeCommentRange(currentSourceFile, writer, comment, newLine) { - if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */) { + if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { var firstCommentLineAndCharacter = ts.getLineAndCharacterOfPosition(currentSourceFile, comment.pos); - var lastLine = ts.getLineStarts(currentSourceFile).length; + var lineCount = ts.getLineStarts(currentSourceFile).length; var firstCommentLineIndent; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = currentLine === lastLine ? (comment.end + 1) : ts.getPositionFromLineAndCharacter(currentSourceFile, currentLine + 1, 1); + var nextLineStart = (currentLine + 1) === lineCount ? currentSourceFile.text.length + 1 : ts.getStartPositionOfLine(currentLine + 1, currentSourceFile); if (pos !== comment.pos) { if (firstCommentLineIndent === undefined) { - firstCommentLineIndent = calculateIndent(ts.getPositionFromLineAndCharacter(currentSourceFile, firstCommentLineAndCharacter.line, 1), comment.pos); + firstCommentLineIndent = calculateIndent(ts.getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); } var currentWriterIndentSpacing = writer.getIndent() * getIndentSize(); var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(pos, nextLineStart); @@ -15826,7 +16325,7 @@ var ts; function calculateIndent(pos, end) { var currentLineIndent = 0; for (; pos < end && ts.isWhiteSpace(currentSourceFile.text.charCodeAt(pos)); pos++) { - if (currentSourceFile.text.charCodeAt(pos) === 9 /* tab */) { + if (currentSourceFile.text.charCodeAt(pos) === 9) { currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize()); } else { @@ -15838,21 +16337,21 @@ var ts; } function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 129 /* Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 131 && ts.nodeIsPresent(member.body)) { return member; } }); } - function getAllAccessorDeclarations(node, accessor) { + function getAllAccessorDeclarations(declarations, accessor) { var firstAccessor; var getAccessor; var setAccessor; - if (accessor.name.kind === 122 /* ComputedPropertyName */) { + if (ts.hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 130 /* GetAccessor */) { + if (accessor.kind === 132) { getAccessor = accessor; } - else if (accessor.kind === 131 /* SetAccessor */) { + else if (accessor.kind === 133) { setAccessor = accessor; } else { @@ -15860,16 +16359,20 @@ var ts; } } else { - ts.forEach(node.members, function (member) { - if ((member.kind === 130 /* GetAccessor */ || member.kind === 131 /* SetAccessor */) && member.name.text === accessor.name.text && (member.flags & 128 /* Static */) === (accessor.flags & 128 /* Static */)) { - if (!firstAccessor) { - firstAccessor = member; - } - if (member.kind === 130 /* GetAccessor */ && !getAccessor) { - getAccessor = member; - } - if (member.kind === 131 /* SetAccessor */ && !setAccessor) { - setAccessor = member; + ts.forEach(declarations, function (member) { + if ((member.kind === 132 || member.kind === 133) && (member.flags & 128) === (accessor.flags & 128)) { + var memberName = ts.getPropertyNameForPropertyNameNode(member.name); + var accessorName = ts.getPropertyNameForPropertyNameNode(accessor.name); + if (memberName === accessorName) { + if (!firstAccessor) { + firstAccessor = member; + } + if (member.kind === 132 && !getAccessor) { + getAccessor = member; + } + if (member.kind === 133 && !setAccessor) { + setAccessor = member; + } } } }); @@ -15903,7 +16406,7 @@ var ts; function emitDeclarations(host, resolver, diagnostics, jsFilePath, root) { var newLine = host.getNewLine(); var compilerOptions = host.getCompilerOptions(); - var languageVersion = compilerOptions.target || 0 /* ES3 */; + var languageVersion = compilerOptions.target || 0; var write; var writeLine; var increaseIndent; @@ -15913,8 +16416,7 @@ var ts; var enclosingDeclaration; var currentSourceFile; var reportedDeclarationError = false; - var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { - } : writeJsDocComments; + var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; var aliasDeclarationEmitInfo = []; var referencePathsOutput = ""; @@ -15923,7 +16425,9 @@ var ts; var addedGlobalFileReference = false; ts.forEach(root.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); - if (referencedFile && ((referencedFile.flags & 1024 /* DeclarationFile */) || shouldEmitToOwnFile(referencedFile, compilerOptions) || !addedGlobalFileReference)) { + if (referencedFile && ((referencedFile.flags & 1024) || + shouldEmitToOwnFile(referencedFile, compilerOptions) || + !addedGlobalFileReference)) { writeReferencePath(referencedFile); if (!isExternalModuleOrDeclarationFile(referencedFile)) { addedGlobalFileReference = true; @@ -15940,7 +16444,8 @@ var ts; if (!compilerOptions.noResolve) { ts.forEach(sourceFile.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && !ts.contains(emittedReferencedFiles, referencedFile))) { + if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && + !ts.contains(emittedReferencedFiles, referencedFile))) { writeReferencePath(referencedFile); emittedReferencedFiles.push(referencedFile); } @@ -16007,7 +16512,7 @@ var ts; setWriter(oldWriter); } function handleSymbolAccessibilityError(symbolAccesibilityResult) { - if (symbolAccesibilityResult.accessibility === 0 /* Accessible */) { + if (symbolAccesibilityResult.accessibility === 0) { if (symbolAccesibilityResult && symbolAccesibilityResult.aliasesToMakeVisible) { writeAsychronousImportDeclarations(symbolAccesibilityResult.aliasesToMakeVisible); } @@ -16035,7 +16540,7 @@ var ts; emitType(type); } else { - resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer); + resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2, writer); } } function writeReturnTypeAtSignature(signature, getSymbolAccessibilityDiagnostic) { @@ -16045,7 +16550,7 @@ var ts; emitType(signature.type); } else { - resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2 /* UseTypeOfFunction */, writer); + resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2, writer); } } function emitLines(nodes) { @@ -16079,43 +16584,44 @@ var ts; } function emitType(type) { switch (type.kind) { - case 110 /* AnyKeyword */: - case 119 /* StringKeyword */: - case 117 /* NumberKeyword */: - case 111 /* BooleanKeyword */: - case 98 /* VoidKeyword */: - case 8 /* StringLiteral */: + case 110: + case 119: + case 117: + case 111: + case 120: + case 98: + case 8: return writeTextOfNode(currentSourceFile, type); - case 135 /* TypeReference */: + case 137: return emitTypeReference(type); - case 138 /* TypeQuery */: + case 140: return emitTypeQuery(type); - case 140 /* ArrayType */: + case 142: return emitArrayType(type); - case 141 /* TupleType */: + case 143: return emitTupleType(type); - case 142 /* UnionType */: + case 144: return emitUnionType(type); - case 143 /* ParenthesizedType */: + case 145: return emitParenType(type); - case 136 /* FunctionType */: - case 137 /* ConstructorType */: + case 138: + case 139: return emitSignatureDeclarationWithJsDocComments(type); - case 139 /* TypeLiteral */: + case 141: return emitTypeLiteral(type); - case 64 /* Identifier */: + case 64: return emitEntityName(type); - case 121 /* QualifiedName */: + case 123: return emitEntityName(type); default: ts.Debug.fail("Unknown type annotation: " + type.kind); } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 197 /* ImportDeclaration */ ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 200 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); function writeEntityName(entityName) { - if (entityName.kind === 64 /* Identifier */) { + if (entityName.kind === 64) { writeTextOfNode(currentSourceFile, entityName); } else { @@ -16179,22 +16685,22 @@ var ts; } function emitModuleElementDeclarationFlags(node) { if (node.parent === currentSourceFile) { - if (node.flags & 1 /* Export */) { + if (node.flags & 1) { write("export "); } - if (node.kind !== 192 /* InterfaceDeclaration */) { + if (node.kind !== 195) { write("declare "); } } } function emitClassMemberDeclarationFlags(node) { - if (node.flags & 32 /* Private */) { + if (node.flags & 32) { write("private "); } - else if (node.flags & 64 /* Protected */) { + else if (node.flags & 64) { write("protected "); } - if (node.flags & 128 /* Static */) { + if (node.flags & 128) { write("static "); } } @@ -16212,7 +16718,7 @@ var ts; } function writeImportDeclaration(node) { emitJsDocComments(node); - if (node.flags & 1 /* Export */) { + if (node.flags & 1) { write("export "); } write("import "); @@ -16242,7 +16748,7 @@ var ts; emitModuleElementDeclarationFlags(node); write("module "); writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 196 /* ModuleBlock */) { + while (node.body.kind !== 199) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -16308,7 +16814,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 128 /* MethodDeclaration */ && (node.parent.flags & 32 /* Private */); + return node.parent.kind === 130 && (node.parent.flags & 32); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -16318,8 +16824,15 @@ var ts; writeTextOfNode(currentSourceFile, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 136 /* FunctionType */ || node.parent.kind === 137 /* ConstructorType */ || (node.parent.parent && node.parent.parent.kind === 139 /* TypeLiteral */)) { - ts.Debug.assert(node.parent.kind === 128 /* MethodDeclaration */ || node.parent.kind === 127 /* MethodSignature */ || node.parent.kind === 136 /* FunctionType */ || node.parent.kind === 137 /* ConstructorType */ || node.parent.kind === 132 /* CallSignature */ || node.parent.kind === 133 /* ConstructSignature */); + if (node.parent.kind === 138 || + node.parent.kind === 139 || + (node.parent.parent && node.parent.parent.kind === 141)) { + ts.Debug.assert(node.parent.kind === 130 || + node.parent.kind === 129 || + node.parent.kind === 138 || + node.parent.kind === 139 || + node.parent.kind === 134 || + node.parent.kind === 135); emitType(node.constraint); } else { @@ -16329,31 +16842,31 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 191 /* ClassDeclaration */: + case 194: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 192 /* InterfaceDeclaration */: + case 195: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 133 /* ConstructSignature */: + case 135: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 132 /* CallSignature */: + case 134: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: - if (node.parent.flags & 128 /* Static */) { + case 130: + case 129: + 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 === 191 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 194) { 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 190 /* FunctionDeclaration */: + case 193: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -16381,7 +16894,7 @@ var ts; emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 191 /* ClassDeclaration */) { + if (node.parent.parent.kind === 194) { 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; } else { @@ -16399,7 +16912,7 @@ var ts; function emitParameterProperties(constructorDeclaration) { if (constructorDeclaration) { ts.forEach(constructorDeclaration.parameters, function (param) { - if (param.flags & 112 /* AccessibilityModifier */) { + if (param.flags & 112) { emitPropertyDeclaration(param); } }); @@ -16460,29 +16973,29 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 188 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 191 || resolver.isDeclarationVisible(node)) { writeTextOfNode(currentSourceFile, node.name); - if ((node.kind === 126 /* PropertyDeclaration */ || node.kind === 125 /* PropertySignature */) && ts.hasQuestionToken(node)) { + if ((node.kind === 128 || node.kind === 127) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 126 /* PropertyDeclaration */ || node.kind === 125 /* PropertySignature */) && node.parent.kind === 139 /* TypeLiteral */) { + if ((node.kind === 128 || node.kind === 127) && node.parent.kind === 141) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } - else if (!(node.flags & 32 /* Private */)) { + else if (!(node.flags & 32)) { writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError); } } function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.kind === 188 /* VariableDeclaration */) { - diagnosticMessage = 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; + if (node.kind === 191) { + diagnosticMessage = 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 === 126 /* PropertyDeclaration */ || node.kind === 125 /* PropertySignature */) { - if (node.flags & 128 /* Static */) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : 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.kind === 128 || node.kind === 127) { + if (node.flags & 128) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : 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 === 191 /* ClassDeclaration */) { - diagnosticMessage = 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 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; + else if (node.parent.kind === 194) { + diagnosticMessage = 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 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; @@ -16524,17 +17037,17 @@ var ts; if (ts.hasDynamicName(node)) { return; } - var accessors = getAllAccessorDeclarations(node.parent, node); + var accessors = getAllAccessorDeclarations(node.parent.members, node); if (node === accessors.firstAccessor) { emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); emitClassMemberDeclarationFlags(node); writeTextOfNode(currentSourceFile, node.name); - if (!(node.flags & 32 /* Private */)) { + if (!(node.flags & 32)) { var accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { - var anotherAccessor = node.kind === 130 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 132 ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -16547,13 +17060,13 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 130 /* GetAccessor */ ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : undefined; + return accessor.kind === 132 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : undefined; } } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 131 /* SetAccessor */) { - if (accessorWithTypeAnnotation.parent.flags & 128 /* Static */) { + if (accessorWithTypeAnnotation.kind === 133) { + 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 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } else { @@ -16566,11 +17079,11 @@ var ts; }; } else { - if (accessorWithTypeAnnotation.flags & 128 /* Static */) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; + if (accessorWithTypeAnnotation.flags & 128) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; } else { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; } return { diagnosticMessage: diagnosticMessage, @@ -16584,19 +17097,20 @@ var ts; if (ts.hasDynamicName(node)) { return; } - if ((node.kind !== 190 /* FunctionDeclaration */ || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { + if ((node.kind !== 193 || resolver.isDeclarationVisible(node)) && + !resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 190 /* FunctionDeclaration */) { + if (node.kind === 193) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 128 /* MethodDeclaration */) { + else if (node.kind === 130) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 190 /* FunctionDeclaration */) { + if (node.kind === 193) { write("function "); writeTextOfNode(currentSourceFile, node.name); } - else if (node.kind === 129 /* Constructor */) { + else if (node.kind === 131) { write("constructor"); } else { @@ -16613,11 +17127,11 @@ var ts; emitSignatureDeclaration(node); } function emitSignatureDeclaration(node) { - if (node.kind === 133 /* ConstructSignature */ || node.kind === 137 /* ConstructorType */) { + if (node.kind === 135 || node.kind === 139) { write("new "); } emitTypeParameters(node.typeParameters); - if (node.kind === 134 /* IndexSignature */) { + if (node.kind === 136) { write("["); } else { @@ -16626,20 +17140,20 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 134 /* IndexSignature */) { + if (node.kind === 136) { write("]"); } else { write(")"); } - var isFunctionTypeOrConstructorType = node.kind === 136 /* FunctionType */ || node.kind === 137 /* ConstructorType */; - if (isFunctionTypeOrConstructorType || node.parent.kind === 139 /* TypeLiteral */) { + var isFunctionTypeOrConstructorType = node.kind === 138 || node.kind === 139; + if (isFunctionTypeOrConstructorType || node.parent.kind === 141) { if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 129 /* Constructor */ && !(node.flags & 32 /* Private */)) { + else if (node.kind !== 131 && !(node.flags & 32)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -16650,29 +17164,29 @@ var ts; function getReturnTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.kind) { - case 133 /* ConstructSignature */: + case 135: 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 132 /* CallSignature */: + case 134: 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 134 /* IndexSignature */: + case 136: 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 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: - if (node.flags & 128 /* Static */) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : 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; + case 130: + case 129: + if (node.flags & 128) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : 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 === 191 /* 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 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; + else if (node.parent.kind === 194) { + 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 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 190 /* 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 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; + case 193: + 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 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: ts.Debug.fail("This is unknown kind for signature: " + node.kind); @@ -16699,38 +17213,40 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 136 /* FunctionType */ || node.parent.kind === 137 /* ConstructorType */ || node.parent.parent.kind === 139 /* TypeLiteral */) { + if (node.parent.kind === 138 || + node.parent.kind === 139 || + node.parent.parent.kind === 141) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } - else if (!(node.parent.flags & 32 /* Private */)) { + else if (!(node.parent.flags & 32)) { writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); } function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 129 /* Constructor */: - diagnosticMessage = 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 131: + diagnosticMessage = 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; break; - case 133 /* ConstructSignature */: + case 135: diagnosticMessage = 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; break; - case 132 /* CallSignature */: + case 134: diagnosticMessage = 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; break; - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: - if (node.parent.flags & 128 /* Static */) { - diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : 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; + case 130: + case 129: + if (node.parent.flags & 128) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : 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 === 191 /* ClassDeclaration */) { - diagnosticMessage = 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 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + else if (node.parent.parent.kind === 194) { + diagnosticMessage = 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 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? 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; } break; - case 190 /* FunctionDeclaration */: - diagnosticMessage = 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 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; + case 193: + diagnosticMessage = 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 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); @@ -16744,45 +17260,45 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 129 /* Constructor */: - case 190 /* FunctionDeclaration */: - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: + case 131: + case 193: + case 130: + case 129: return emitFunctionDeclaration(node); - case 133 /* ConstructSignature */: - case 132 /* CallSignature */: - case 134 /* IndexSignature */: + case 135: + case 134: + case 136: return emitSignatureDeclarationWithJsDocComments(node); - case 130 /* GetAccessor */: - case 131 /* SetAccessor */: + case 132: + case 133: return emitAccessorDeclaration(node); - case 171 /* VariableStatement */: + case 173: return emitVariableStatement(node); - case 126 /* PropertyDeclaration */: - case 125 /* PropertySignature */: + case 128: + case 127: return emitPropertyDeclaration(node); - case 192 /* InterfaceDeclaration */: + case 195: return emitInterfaceDeclaration(node); - case 191 /* ClassDeclaration */: + case 194: return emitClassDeclaration(node); - case 193 /* TypeAliasDeclaration */: + case 196: return emitTypeAliasDeclaration(node); - case 206 /* EnumMember */: + case 209: return emitEnumMemberDeclaration(node); - case 194 /* EnumDeclaration */: + case 197: return emitEnumDeclaration(node); - case 195 /* ModuleDeclaration */: + case 198: return emitModuleDeclaration(node); - case 197 /* ImportDeclaration */: + case 200: return emitImportDeclaration(node); - case 198 /* ExportAssignment */: + case 201: return emitExportAssignment(node); - case 207 /* SourceFile */: + case 210: return emitSourceFile(node); } } function writeReferencePath(referencedFile) { - var declFileName = referencedFile.flags & 1024 /* DeclarationFile */ ? referencedFile.fileName : shouldEmitToOwnFile(referencedFile, compilerOptions) ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; + var declFileName = referencedFile.flags & 1024 ? referencedFile.fileName : shouldEmitToOwnFile(referencedFile, compilerOptions) ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); referencePathsOutput += "/// " + newLine; } @@ -16796,7 +17312,7 @@ var ts; ts.getDeclarationDiagnostics = getDeclarationDiagnostics; function emitFiles(resolver, host, targetSourceFile) { var compilerOptions = host.getCompilerOptions(); - var languageVersion = compilerOptions.target || 0 /* ES3 */; + var languageVersion = compilerOptions.target || 0; var sourceMapDataList = compilerOptions.sourceMap ? [] : undefined; var diagnostics = []; var newLine = host.getNewLine(); @@ -16839,28 +17355,19 @@ var ts; var tempVariables; var tempParameters; var writeEmittedFiles = writeJavaScriptFile; - var emitLeadingComments = compilerOptions.removeComments ? function (node) { - } : emitLeadingDeclarationComments; - var emitTrailingComments = compilerOptions.removeComments ? function (node) { - } : emitTrailingDeclarationComments; - var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { - } : emitLeadingCommentsOfLocalPosition; + var emitLeadingComments = compilerOptions.removeComments ? function (node) { } : emitLeadingDeclarationComments; + var emitTrailingComments = compilerOptions.removeComments ? function (node) { } : emitTrailingDeclarationComments; + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfLocalPosition; var detachedCommentsInfo; - var emitDetachedComments = compilerOptions.removeComments ? function (node) { - } : emitDetachedCommentsAtPosition; - var emitPinnedOrTripleSlashComments = compilerOptions.removeComments ? function (node) { - } : emitPinnedOrTripleSlashCommentsOfNode; + var emitDetachedComments = compilerOptions.removeComments ? function (node) { } : emitDetachedCommentsAtPosition; + var emitPinnedOrTripleSlashComments = compilerOptions.removeComments ? function (node) { } : emitPinnedOrTripleSlashCommentsOfNode; var writeComment = writeCommentRange; var emit = emitNode; - var emitStart = function (node) { - }; - var emitEnd = function (node) { - }; + var emitStart = function (node) { }; + var emitEnd = function (node) { }; var emitToken = emitTokenText; - var scopeEmitStart = function (scopeDeclaration, scopeName) { - }; - var scopeEmitEnd = function () { - }; + var scopeEmitStart = function (scopeDeclaration, scopeName) { }; + var scopeEmitEnd = function () { }; var sourceMapData; if (compilerOptions.sourceMap) { initializeEmitterWithSourceMaps(); @@ -16948,9 +17455,16 @@ var ts; } 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)))) { + 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, @@ -16996,7 +17510,7 @@ var ts; var parentIndex = getSourceMapNameIndex(); if (parentIndex !== -1) { var name = node.name; - if (!name || name.kind !== 122 /* ComputedPropertyName */) { + if (!name || name.kind !== 124) { scopeName = "." + scopeName; } scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; @@ -17013,10 +17527,18 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 190 /* FunctionDeclaration */ || node.kind === 156 /* FunctionExpression */ || node.kind === 128 /* MethodDeclaration */ || node.kind === 127 /* MethodSignature */ || node.kind === 130 /* GetAccessor */ || node.kind === 131 /* SetAccessor */ || node.kind === 195 /* ModuleDeclaration */ || node.kind === 191 /* ClassDeclaration */ || node.kind === 194 /* EnumDeclaration */) { + else if (node.kind === 193 || + node.kind === 158 || + node.kind === 130 || + node.kind === 129 || + node.kind === 132 || + node.kind === 133 || + node.kind === 198 || + node.kind === 194 || + node.kind === 197) { if (node.name) { var name = node.name; - scopeName = name.kind === 122 /* ComputedPropertyName */ ? ts.getTextOfNode(name) : node.name.text; + scopeName = name.kind === 124 ? ts.getTextOfNode(name) : node.name.text; } recordScopeNameStart(scopeName); } @@ -17075,7 +17597,7 @@ var ts; sourceMapDecodedMappings: [] }; sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); - if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47 /* slash */) { + if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47) { sourceMapData.sourceMapSourceRoot += ts.directorySeparator; } if (compilerOptions.mapRoot) { @@ -17096,7 +17618,7 @@ var ts; } function emitNodeWithMap(node) { if (node) { - if (node.kind != 207 /* SourceFile */) { + if (node.kind != 210) { recordEmitNodeStartSpan(node); emitNode(node); recordEmitNodeEndSpan(node); @@ -17125,10 +17647,10 @@ var ts; if (name && resolver.isUnknownIdentifier(location, name)) { break; } - name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + 97 /* a */) : tempCount - 25); + name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + 97) : tempCount - 25); tempCount++; } - var result = ts.createNode(64 /* Identifier */); + var result = ts.createNode(64); result.text = name; return result; } @@ -17138,6 +17660,11 @@ var ts; } tempVariables.push(name); } + function createAndRecordTempVariable(location) { + var temp = createTempVariable(location, false); + recordTempDeclaration(temp); + return temp; + } function emitTempDeclarations(newLine) { if (tempVariables) { if (newLine) { @@ -17181,10 +17708,44 @@ var ts; write(","); } } - function emitList(nodes, start, count, multiLine, trailingComma) { - if (multiLine) { - increaseIndent(); + 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]); + } + var closeTokenIsOnSameLineAsLastElement = nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes)); + if (nodes.hasTrailingComma && allowTrailingComma) { + write(","); + } + decreaseIndent(); + if (closeTokenIsOnSameLineAsLastElement) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + } + function emitList(nodes, start, count, multiLine, trailingComma) { for (var i = 0; i < count; i++) { if (multiLine) { if (i) { @@ -17203,7 +17764,6 @@ var ts; write(","); } if (multiLine) { - decreaseIndent(); writeLine(); } } @@ -17212,11 +17772,6 @@ var ts; emitList(nodes, 0, nodes.length, false, false); } } - function emitMultiLineList(nodes) { - if (nodes) { - emitList(nodes, 0, nodes.length, true, false); - } - } function emitLines(nodes) { emitLinesStartingAt(nodes, 0); } @@ -17230,17 +17785,18 @@ var ts; if (text.length <= 0) { return false; } - if (text.charCodeAt(1) === 66 /* B */ || text.charCodeAt(1) === 98 /* b */ || text.charCodeAt(1) === 79 /* O */ || text.charCodeAt(1) === 111 /* o */) { + if (text.charCodeAt(1) === 66 || text.charCodeAt(1) === 98 || + text.charCodeAt(1) === 79 || text.charCodeAt(1) === 111) { return true; } return false; } function emitLiteral(node) { - var text = languageVersion < 2 /* ES6 */ && ts.isTemplateLiteralKind(node.kind) ? getTemplateLiteralAsStringLiteral(node) : node.parent ? ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node) : node.text; - if (compilerOptions.sourceMap && (node.kind === 8 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { + var text = languageVersion < 2 && ts.isTemplateLiteralKind(node.kind) ? getTemplateLiteralAsStringLiteral(node) : node.parent ? ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node) : node.text; + if (compilerOptions.sourceMap && (node.kind === 8 || ts.isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } - else if (languageVersion < 2 /* ES6 */ && node.kind === 7 /* NumericLiteral */ && isBinaryOrOctalIntegerLiteral(text)) { + else if (languageVersion < 2 && node.kind === 7 && isBinaryOrOctalIntegerLiteral(text)) { write(node.text); } else { @@ -17251,7 +17807,7 @@ var ts; return '"' + ts.escapeString(node.text) + '"'; } function emitTemplateExpression(node) { - if (languageVersion >= 2 /* ES6 */) { + if (languageVersion >= 2) { ts.forEachChild(node, emit); return; } @@ -17266,7 +17822,7 @@ var ts; } for (var i = 0; i < node.templateSpans.length; i++) { var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 155 /* ParenthesizedExpression */ && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1 /* GreaterThan */; + var needsParens = templateSpan.expression.kind !== 157 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { write(" + "); } @@ -17285,34 +17841,34 @@ var ts; } function templateNeedsParens(template, parent) { switch (parent.kind) { - case 151 /* CallExpression */: - case 152 /* NewExpression */: + case 153: + case 154: return parent.expression === template; - case 153 /* TaggedTemplateExpression */: - case 155 /* ParenthesizedExpression */: + case 155: + case 157: return false; default: - return comparePrecedenceToBinaryPlus(parent) !== -1 /* LessThan */; + return comparePrecedenceToBinaryPlus(parent) !== -1; } } function comparePrecedenceToBinaryPlus(expression) { switch (expression.kind) { - case 163 /* BinaryExpression */: - switch (expression.operator) { - case 35 /* AsteriskToken */: - case 36 /* SlashToken */: - case 37 /* PercentToken */: - return 1 /* GreaterThan */; - case 33 /* PlusToken */: - case 34 /* MinusToken */: - return 0 /* EqualTo */; + case 165: + switch (expression.operatorToken.kind) { + case 35: + case 36: + case 37: + return 1; + case 33: + case 34: + return 0; default: - return -1 /* LessThan */; + return -1; } - case 164 /* ConditionalExpression */: - return -1 /* LessThan */; + case 166: + return -1; default: - return 1 /* GreaterThan */; + return 1; } } } @@ -17321,15 +17877,16 @@ var ts; emit(span.literal); } function emitExpressionForPropertyName(node) { - if (node.kind === 8 /* StringLiteral */) { + ts.Debug.assert(node.kind !== 148); + if (node.kind === 8) { emitLiteral(node); } - else if (node.kind === 122 /* ComputedPropertyName */) { + else if (node.kind === 124) { emit(node.expression); } else { write("\""); - if (node.kind === 7 /* NumericLiteral */) { + if (node.kind === 7) { write(node.text); } else { @@ -17341,33 +17898,33 @@ var ts; function isNotExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 124 /* Parameter */: - case 188 /* VariableDeclaration */: - case 146 /* BindingElement */: - case 126 /* PropertyDeclaration */: - case 125 /* PropertySignature */: - case 204 /* PropertyAssignment */: - case 205 /* ShorthandPropertyAssignment */: - case 206 /* EnumMember */: - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: - case 190 /* FunctionDeclaration */: - case 130 /* GetAccessor */: - case 131 /* SetAccessor */: - case 156 /* FunctionExpression */: - case 191 /* ClassDeclaration */: - case 192 /* InterfaceDeclaration */: - case 194 /* EnumDeclaration */: - case 195 /* ModuleDeclaration */: - case 197 /* ImportDeclaration */: + case 126: + case 191: + case 148: + case 128: + case 127: + case 207: + case 208: + case 209: + case 130: + case 129: + case 193: + case 132: + case 133: + case 158: + case 194: + case 195: + case 197: + case 198: + case 200: return parent.name === node; - case 180 /* BreakStatement */: - case 179 /* ContinueStatement */: - case 198 /* ExportAssignment */: + case 183: + case 182: + case 201: return false; - case 184 /* LabeledStatement */: + case 187: return node.parent.label === node; - case 203 /* CatchClause */: + case 206: return node.parent.name === node; } } @@ -17391,7 +17948,7 @@ var ts; } } function emitThis(node) { - if (resolver.getNodeCheckFlags(node) & 2 /* LexicalThis */) { + if (resolver.getNodeCheckFlags(node) & 2) { write("_this"); } else { @@ -17400,10 +17957,10 @@ var ts; } function emitSuper(node) { var flags = resolver.getNodeCheckFlags(node); - if (flags & 16 /* SuperInstance */) { + if (flags & 16) { write("_super.prototype"); } - else if (flags & 32 /* SuperStatic */) { + else if (flags & 32) { write("_super"); } else { @@ -17444,31 +18001,20 @@ var ts; } function needsParenthesisForPropertyAccess(node) { switch (node.kind) { - case 64 /* Identifier */: - case 147 /* ArrayLiteralExpression */: - case 149 /* PropertyAccessExpression */: - case 150 /* ElementAccessExpression */: - case 151 /* CallExpression */: - case 155 /* ParenthesizedExpression */: + case 64: + case 149: + case 151: + case 152: + case 153: + case 157: return false; } return true; } - function emitArrayLiteral(node) { - var elements = node.elements; - var length = elements.length; - if (length === 0) { - write("[]"); - return; - } - if (languageVersion >= 2 /* ES6 */) { - write("["); - emitList(elements, 0, elements.length, (node.flags & 256 /* MultiLine */) !== 0, elements.hasTrailingComma); - write("]"); - return; - } + function emitListWithSpread(elements, multiLine, trailingComma) { var pos = 0; var group = 0; + var length = elements.length; while (pos < length) { if (group === 1) { write(".concat("); @@ -17477,18 +18023,24 @@ var ts; write(", "); } var e = elements[pos]; - if (e.kind === 167 /* SpreadElementExpression */) { + if (e.kind === 169) { e = e.expression; emitParenthesized(e, group === 0 && needsParenthesisForPropertyAccess(e)); pos++; } else { var i = pos; - while (i < length && elements[i].kind !== 167 /* SpreadElementExpression */) { + while (i < length && elements[i].kind !== 169) { i++; } write("["); - emitList(elements, pos, i - pos, (node.flags & 256 /* MultiLine */) !== 0, elements.hasTrailingComma); + if (multiLine) { + increaseIndent(); + } + emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); + if (multiLine) { + decreaseIndent(); + } write("]"); pos = i; } @@ -17498,18 +18050,187 @@ var ts; write(")"); } } + function isSpreadElementExpression(node) { + return node.kind === 169; + } + 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, (node.flags & 256) !== 0, elements.hasTrailingComma); + } + } + function createSynthesizedNode(kind) { + var node = ts.createNode(kind); + node.pos = -1; + node.end = -1; + return node; + } + function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { + var parenthesizedObjectLiteral = createDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex); + return emit(parenthesizedObjectLiteral); + } + function createDownlevelObjectLiteralWithComputedProperties(originalObjectLiteral, firstComputedPropertyIndex) { + var tempVar = createAndRecordTempVariable(originalObjectLiteral); + var initialObjectLiteral = createSynthesizedNode(150); + initialObjectLiteral.properties = originalObjectLiteral.properties.slice(0, firstComputedPropertyIndex); + initialObjectLiteral.flags |= 256; + var propertyPatches = createBinaryExpression(tempVar, 52, initialObjectLiteral); + ts.forEach(originalObjectLiteral.properties, function (property) { + var patchedProperty = tryCreatePatchingPropertyAssignment(originalObjectLiteral, tempVar, property); + if (patchedProperty) { + propertyPatches = createBinaryExpression(propertyPatches, 23, patchedProperty); + } + }); + propertyPatches = createBinaryExpression(propertyPatches, 23, tempVar); + var result = createParenthesizedExpression(propertyPatches); + return result; + } + function addCommentsToSynthesizedNode(node, leadingCommentRanges, trailingCommentRanges) { + node.leadingCommentRanges = leadingCommentRanges; + node.trailingCommentRanges = trailingCommentRanges; + } + function tryCreatePatchingPropertyAssignment(objectLiteral, tempVar, property) { + var leftHandSide = createMemberAccessForPropertyName(tempVar, property.name); + var maybeRightHandSide = tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property); + return maybeRightHandSide && createBinaryExpression(leftHandSide, 52, maybeRightHandSide); + } + function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property) { + switch (property.kind) { + case 207: + return property.initializer; + case 208: + var prefix = createIdentifier(resolver.getExpressionNamePrefix(property.name)); + return createPropertyAccessExpression(prefix, property.name); + case 130: + return createFunctionExpression(property.parameters, property.body); + case 132: + case 133: + var _a = getAllAccessorDeclarations(objectLiteral.properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; + if (firstAccessor !== property) { + return undefined; + } + var propertyDescriptor = createSynthesizedNode(150); + var descriptorProperties = []; + if (getAccessor) { + var getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); + descriptorProperties.push(getProperty); + } + if (setAccessor) { + var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpression(setAccessor.parameters, setAccessor.body)); + descriptorProperties.push(setProperty); + } + var trueExpr = createSynthesizedNode(94); + var enumerableTrue = createPropertyAssignment(createIdentifier("enumerable"), trueExpr); + descriptorProperties.push(enumerableTrue); + var configurableTrue = createPropertyAssignment(createIdentifier("configurable"), trueExpr); + descriptorProperties.push(configurableTrue); + propertyDescriptor.properties = descriptorProperties; + var objectDotDefineProperty = createPropertyAccessExpression(createIdentifier("Object"), createIdentifier("defineProperty")); + return createCallExpression(objectDotDefineProperty, createNodeArray(propertyDescriptor)); + default: + ts.Debug.fail("ObjectLiteralElement kind " + property.kind + " not accounted for."); + } + } + function createParenthesizedExpression(expression) { + var result = createSynthesizedNode(157); + result.expression = expression; + return result; + } + function createNodeArray() { + var elements = []; + for (var _i = 0; _i < arguments.length; _i++) { + elements[_i - 0] = arguments[_i]; + } + var result = elements; + result.pos = -1; + result.end = -1; + return result; + } + function createBinaryExpression(left, operator, right) { + var result = createSynthesizedNode(165); + result.operatorToken = createSynthesizedNode(operator); + result.left = left; + result.right = right; + return result; + } + function createMemberAccessForPropertyName(expression, memberName) { + if (memberName.kind === 64) { + return createPropertyAccessExpression(expression, memberName); + } + else if (memberName.kind === 8 || memberName.kind === 7) { + return createElementAccessExpression(expression, memberName); + } + else if (memberName.kind === 124) { + return createElementAccessExpression(expression, memberName.expression); + } + else { + ts.Debug.fail("Kind '" + memberName.kind + "' not accounted for."); + } + } + function createPropertyAssignment(name, initializer) { + var result = createSynthesizedNode(207); + result.name = name; + result.initializer = initializer; + return result; + } + function createFunctionExpression(parameters, body) { + var result = createSynthesizedNode(158); + result.parameters = parameters; + result.body = body; + return result; + } + function createPropertyAccessExpression(expression, name) { + var result = createSynthesizedNode(151); + result.expression = expression; + result.name = name; + return result; + } + function createElementAccessExpression(expression, argumentExpression) { + var result = createSynthesizedNode(152); + result.expression = expression; + result.argumentExpression = argumentExpression; + return result; + } + function createIdentifier(name) { + var result = createSynthesizedNode(64); + result.text = name; + return result; + } + function createCallExpression(invokedExpression, arguments) { + var result = createSynthesizedNode(153); + result.expression = invokedExpression; + result.arguments = arguments; + return result; + } 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 === 124) { + numInitialNonComputedProperties = i; + break; + } + } + var hasComputedProperty = numInitialNonComputedProperties !== properties.length; + if (hasComputedProperty) { + emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); + return; + } + } write("{"); var properties = node.properties; if (properties.length) { - var multiLine = (node.flags & 256 /* MultiLine */) !== 0; - if (!multiLine) { - write(" "); - } - emitList(properties, 0, properties.length, multiLine, properties.hasTrailingComma && languageVersion >= 1 /* ES5 */); - if (!multiLine) { - write(" "); - } + emitLinePreservingList(node, properties, languageVersion >= 1, true); } write("}"); } @@ -17520,7 +18241,7 @@ var ts; } function emitMethod(node) { emit(node.name); - if (languageVersion < 2 /* ES6 */) { + if (languageVersion < 2) { write(": function "); } emitSignatureAndBody(node); @@ -17532,7 +18253,7 @@ var ts; } function emitShorthandPropertyAssignment(node) { emit(node.name); - if (languageVersion < 2 /* ES6 */ || resolver.getExpressionNamePrefix(node.name)) { + if (languageVersion <= 1 || resolver.getExpressionNamePrefix(node.name)) { write(": "); emitExpressionIdentifier(node.name); } @@ -17542,7 +18263,7 @@ var ts; if (constantValue !== undefined) { write(constantValue.toString()); if (!compilerOptions.removeComments) { - var propertyName = node.kind === 149 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + var propertyName = node.kind === 151 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); write(" /* " + propertyName + " */"); } return true; @@ -17571,15 +18292,78 @@ var ts; emit(node.argumentExpression); write("]"); } + function hasSpreadElement(elements) { + return ts.forEach(elements, function (e) { return e.kind === 169; }); + } + function skipParentheses(node) { + while (node.kind === 157 || node.kind === 156) { + node = node.expression; + } + return node; + } + function emitCallTarget(node) { + if (node.kind === 64 || node.kind === 92 || node.kind === 90) { + emit(node); + return node; + } + var temp = createAndRecordTempVariable(node); + write("("); + emit(temp); + write(" = "); + emit(node); + write(")"); + return temp; + } + function emitCallWithSpread(node) { + var target; + var expr = skipParentheses(node.expression); + if (expr.kind === 151) { + target = emitCallTarget(expr.expression); + write("."); + emit(expr.name); + } + else if (expr.kind === 152) { + target = emitCallTarget(expr.expression); + write("["); + emit(expr.argumentExpression); + write("]"); + } + else if (expr.kind === 90) { + target = expr; + write("_super"); + } + else { + emit(node.expression); + } + write(".apply("); + if (target) { + if (target.kind === 90) { + emitThis(target); + } + else { + emit(target); + } + } + else { + write("void 0"); + } + write(", "); + emitListWithSpread(node.arguments, false, false); + write(")"); + } function emitCallExpression(node) { + if (languageVersion < 2 && hasSpreadElement(node.arguments)) { + emitCallWithSpread(node); + return; + } var superCall = false; - if (node.expression.kind === 90 /* SuperKeyword */) { + if (node.expression.kind === 90) { write("_super"); superCall = true; } else { emit(node.expression); - superCall = node.expression.kind === 149 /* PropertyAccessExpression */ && node.expression.expression.kind === 90 /* SuperKeyword */; + superCall = node.expression.kind === 151 && node.expression.expression.kind === 90; } if (superCall) { write(".call("); @@ -17611,12 +18395,19 @@ var ts; emit(node.template); } function emitParenExpression(node) { - if (node.expression.kind === 154 /* TypeAssertionExpression */) { + if (node.expression.kind === 156) { var operand = node.expression.expression; - while (operand.kind == 154 /* TypeAssertionExpression */) { + while (operand.kind == 156) { operand = operand.expression; } - if (operand.kind !== 161 /* PrefixUnaryExpression */ && operand.kind !== 160 /* VoidExpression */ && operand.kind !== 159 /* TypeOfExpression */ && operand.kind !== 158 /* DeleteExpression */ && operand.kind !== 162 /* PostfixUnaryExpression */ && operand.kind !== 152 /* NewExpression */ && !(operand.kind === 151 /* CallExpression */ && node.parent.kind === 152 /* NewExpression */) && !(operand.kind === 156 /* FunctionExpression */ && node.parent.kind === 151 /* CallExpression */)) { + if (operand.kind !== 163 && + operand.kind !== 162 && + operand.kind !== 161 && + operand.kind !== 160 && + operand.kind !== 164 && + operand.kind !== 154 && + !(operand.kind === 153 && node.parent.kind === 154) && + !(operand.kind === 158 && node.parent.kind === 153)) { emit(operand); return; } @@ -17626,28 +18417,28 @@ var ts; write(")"); } function emitDeleteExpression(node) { - write(ts.tokenToString(73 /* DeleteKeyword */)); + write(ts.tokenToString(73)); write(" "); emit(node.expression); } function emitVoidExpression(node) { - write(ts.tokenToString(98 /* VoidKeyword */)); + write(ts.tokenToString(98)); write(" "); emit(node.expression); } function emitTypeOfExpression(node) { - write(ts.tokenToString(96 /* TypeOfKeyword */)); + write(ts.tokenToString(96)); write(" "); emit(node.expression); } function emitPrefixUnaryExpression(node) { write(ts.tokenToString(node.operator)); - if (node.operand.kind === 161 /* PrefixUnaryExpression */) { + if (node.operand.kind === 163) { var operand = node.operand; - if (node.operator === 33 /* PlusToken */ && (operand.operator === 33 /* PlusToken */ || operand.operator === 38 /* PlusPlusToken */)) { + if (node.operator === 33 && (operand.operator === 33 || operand.operator === 38)) { write(" "); } - else if (node.operator === 34 /* MinusToken */ && (operand.operator === 34 /* MinusToken */ || operand.operator === 39 /* MinusMinusToken */)) { + else if (node.operator === 34 && (operand.operator === 34 || operand.operator === 39)) { write(" "); } } @@ -17658,18 +18449,48 @@ var ts; write(ts.tokenToString(node.operator)); } function emitBinaryExpression(node) { - if (languageVersion < 2 /* ES6 */ && node.operator === 52 /* EqualsToken */ && (node.left.kind === 148 /* ObjectLiteralExpression */ || node.left.kind === 147 /* ArrayLiteralExpression */)) { + if (languageVersion < 2 && node.operatorToken.kind === 52 && + (node.left.kind === 150 || node.left.kind === 149)) { emitDestructuring(node); } else { emit(node.left); - if (node.operator !== 23 /* CommaToken */) + if (node.operatorToken.kind !== 23) { write(" "); - write(ts.tokenToString(node.operator)); - write(" "); + } + write(ts.tokenToString(node.operatorToken.kind)); + var operatorEnd = ts.getLineAndCharacterOfPosition(currentSourceFile, node.operatorToken.end); + var rightStart = ts.getLineAndCharacterOfPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.right.pos)); + var onDifferentLine = operatorEnd.line !== rightStart.line; + if (onDifferentLine) { + var exprStart = ts.getLineAndCharacterOfPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + var firstCharOfExpr = getFirstNonWhitespaceCharacterIndexOnLine(exprStart.line); + var shouldIndent = rightStart.character > firstCharOfExpr; + if (shouldIndent) { + increaseIndent(); + } + writeLine(); + } + else { + write(" "); + } emit(node.right); + if (shouldIndent) { + decreaseIndent(); + } } } + function getFirstNonWhitespaceCharacterIndexOnLine(line) { + var lineStart = ts.getLineStarts(currentSourceFile)[line]; + var text = currentSourceFile.text; + for (var i = lineStart; i < text.length; i++) { + var ch = text.charCodeAt(i); + if (!ts.isWhiteSpace(text.charCodeAt(i)) || ts.isLineBreak(ch)) { + break; + } + } + return i - lineStart; + } function emitConditionalExpression(node) { emit(node.condition); write(" ? "); @@ -17677,25 +18498,37 @@ var ts; write(" : "); emit(node.whenFalse); } + function isSingleLineEmptyBlock(node) { + if (node && node.kind === 172) { + var block = node; + return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); + } + } function emitBlock(node) { - emitToken(14 /* OpenBraceToken */, node.pos); + if (isSingleLineEmptyBlock(node)) { + emitToken(14, node.pos); + write(" "); + emitToken(15, node.statements.end); + return; + } + emitToken(14, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 196 /* ModuleBlock */) { - ts.Debug.assert(node.parent.kind === 195 /* ModuleDeclaration */); + if (node.kind === 199) { + ts.Debug.assert(node.parent.kind === 198); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 196 /* ModuleBlock */) { + if (node.kind === 199) { emitTempDeclarations(true); } decreaseIndent(); writeLine(); - emitToken(15 /* CloseBraceToken */, node.statements.end); + emitToken(15, node.statements.end); scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 170 /* Block */) { + if (node.kind === 172) { write(" "); emit(node); } @@ -17707,20 +18540,20 @@ var ts; } } function emitExpressionStatement(node) { - emitParenthesized(node.expression, node.expression.kind === 157 /* ArrowFunction */); + emitParenthesized(node.expression, node.expression.kind === 159); write(";"); } function emitIfStatement(node) { - var endPos = emitToken(83 /* IfKeyword */, node.pos); + var endPos = emitToken(83, node.pos); write(" "); - endPos = emitToken(16 /* OpenParenToken */, endPos); + endPos = emitToken(16, endPos); emit(node.expression); - emitToken(17 /* CloseParenToken */, node.expression.end); + emitToken(17, node.expression.end); emitEmbeddedStatement(node.thenStatement); if (node.elseStatement) { writeLine(); - emitToken(75 /* ElseKeyword */, node.thenStatement.end); - if (node.elseStatement.kind === 174 /* IfStatement */) { + emitToken(75, node.thenStatement.end); + if (node.elseStatement.kind === 176) { write(" "); emit(node.elseStatement); } @@ -17732,7 +18565,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 170 /* Block */) { + if (node.statement.kind === 172) { write(" "); } else { @@ -17749,20 +18582,20 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForStatement(node) { - var endPos = emitToken(81 /* ForKeyword */, node.pos); + var endPos = emitToken(81, node.pos); write(" "); - endPos = emitToken(16 /* OpenParenToken */, endPos); - if (node.initializer && node.initializer.kind === 189 /* VariableDeclarationList */) { + endPos = emitToken(16, endPos); + if (node.initializer && node.initializer.kind === 192) { var variableDeclarationList = node.initializer; var declarations = variableDeclarationList.declarations; if (declarations[0] && ts.isLet(declarations[0])) { - emitToken(103 /* LetKeyword */, endPos); + emitToken(103, endPos); } else if (declarations[0] && ts.isConst(declarations[0])) { - emitToken(69 /* ConstKeyword */, endPos); + emitToken(69, endPos); } else { - emitToken(97 /* VarKeyword */, endPos); + emitToken(97, endPos); } write(" "); emitCommaList(variableDeclarationList.declarations); @@ -17777,19 +18610,19 @@ var ts; write(")"); emitEmbeddedStatement(node.statement); } - function emitForInStatement(node) { - var endPos = emitToken(81 /* ForKeyword */, node.pos); + function emitForInOrForOfStatement(node) { + var endPos = emitToken(81, node.pos); write(" "); - endPos = emitToken(16 /* OpenParenToken */, endPos); - if (node.initializer.kind === 189 /* VariableDeclarationList */) { + endPos = emitToken(16, endPos); + if (node.initializer.kind === 192) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { var decl = variableDeclarationList.declarations[0]; if (ts.isLet(decl)) { - emitToken(103 /* LetKeyword */, endPos); + emitToken(103, endPos); } else { - emitToken(97 /* VarKeyword */, endPos); + emitToken(97, endPos); } write(" "); emit(decl); @@ -17798,18 +18631,23 @@ var ts; else { emit(node.initializer); } - write(" in "); + if (node.kind === 180) { + write(" in "); + } + else { + write(" of "); + } emit(node.expression); - emitToken(17 /* CloseParenToken */, node.expression.end); + emitToken(17, node.expression.end); emitEmbeddedStatement(node.statement); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 180 /* BreakStatement */ ? 65 /* BreakKeyword */ : 70 /* ContinueKeyword */, node.pos); + emitToken(node.kind === 183 ? 65 : 70, node.pos); emitOptional(" ", node.label); write(";"); } function emitReturnStatement(node) { - emitToken(89 /* ReturnKeyword */, node.pos); + emitToken(89, node.pos); emitOptional(" ", node.expression); write(";"); } @@ -17820,24 +18658,33 @@ var ts; emitEmbeddedStatement(node.statement); } function emitSwitchStatement(node) { - var endPos = emitToken(91 /* SwitchKeyword */, node.pos); + var endPos = emitToken(91, node.pos); write(" "); - emitToken(16 /* OpenParenToken */, endPos); + emitToken(16, endPos); emit(node.expression); - endPos = emitToken(17 /* CloseParenToken */, node.expression.end); + endPos = emitToken(17, node.expression.end); write(" "); - emitToken(14 /* OpenBraceToken */, endPos); + emitToken(14, endPos); increaseIndent(); emitLines(node.clauses); decreaseIndent(); writeLine(); - emitToken(15 /* CloseBraceToken */, node.clauses.end); + emitToken(15, node.clauses.end); } - function isOnSameLine(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + function nodeStartPositionsAreOnSameLine(node1, node2) { + return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === + getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + } + function nodeEndPositionsAreOnSameLine(node1, node2) { + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, node2.end); + } + function nodeEndIsOnSameLineAsNodeStart(node1, node2) { + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 200 /* CaseClause */) { + if (node.kind === 203) { write("case "); emit(node.expression); write(":"); @@ -17845,7 +18692,7 @@ var ts; else { write("default:"); } - if (node.statements.length === 1 && isOnSameLine(node, node.statements[0])) { + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { write(" "); emit(node.statements[0]); } @@ -17872,16 +18719,16 @@ var ts; } function emitCatchClause(node) { writeLine(); - var endPos = emitToken(67 /* CatchKeyword */, node.pos); + var endPos = emitToken(67, node.pos); write(" "); - emitToken(16 /* OpenParenToken */, endPos); + emitToken(16, endPos); emit(node.name); - emitToken(17 /* CloseParenToken */, node.name.end); + emitToken(17, node.name.end); write(" "); emitBlock(node.block); } function emitDebuggerStatement(node) { - emitToken(71 /* DebuggerKeyword */, node.pos); + emitToken(71, node.pos); write(";"); } function emitLabelledStatement(node) { @@ -17892,12 +18739,12 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 195 /* ModuleDeclaration */); + } while (node && node.kind !== 198); return node; } function emitModuleMemberName(node) { emitStart(node.name); - if (ts.getCombinedNodeFlags(node) & 1 /* Export */) { + if (ts.getCombinedNodeFlags(node) & 1) { var container = getContainingModule(node); write(container ? resolver.getLocalNameOfContainer(container) : "exports"); write("."); @@ -17907,8 +18754,8 @@ var ts; } function emitDestructuring(root, value) { var emitCount = 0; - var isDeclaration = (root.kind === 188 /* VariableDeclaration */ && !(ts.getCombinedNodeFlags(root) & 1 /* Export */)) || root.kind === 124 /* Parameter */; - if (root.kind === 163 /* BinaryExpression */) { + var isDeclaration = (root.kind === 191 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 126; + if (root.kind === 165) { emitAssignmentExpression(root); } else { @@ -17918,7 +18765,7 @@ var ts; if (emitCount++) { write(", "); } - if (name.parent && (name.parent.kind === 188 /* VariableDeclaration */ || name.parent.kind === 146 /* BindingElement */)) { + if (name.parent && (name.parent.kind === 191 || name.parent.kind === 148)) { emitModuleMemberName(name.parent); } else { @@ -17928,7 +18775,7 @@ var ts; emit(value); } function ensureIdentifier(expr) { - if (expr.kind !== 64 /* Identifier */) { + if (expr.kind !== 64) { var identifier = createTempVariable(root); if (!isDeclaration) { recordTempDeclaration(identifier); @@ -17939,48 +18786,48 @@ var ts; return expr; } function createVoidZero() { - var zero = ts.createNode(7 /* NumericLiteral */); + var zero = ts.createNode(7); zero.text = "0"; - var result = ts.createNode(160 /* VoidExpression */); + var result = ts.createNode(162); result.expression = zero; return result; } function createDefaultValueCheck(value, defaultValue) { value = ensureIdentifier(value); - var equals = ts.createNode(163 /* BinaryExpression */); + var equals = ts.createNode(165); equals.left = value; - equals.operator = 30 /* EqualsEqualsEqualsToken */; + equals.operatorToken = ts.createNode(30); equals.right = createVoidZero(); - var cond = ts.createNode(164 /* ConditionalExpression */); + var cond = ts.createNode(166); cond.condition = equals; cond.whenTrue = defaultValue; cond.whenFalse = value; return cond; } function createNumericLiteral(value) { - var node = ts.createNode(7 /* NumericLiteral */); + var node = ts.createNode(7); node.text = "" + value; return node; } function parenthesizeForAccess(expr) { - if (expr.kind === 64 /* Identifier */ || expr.kind === 149 /* PropertyAccessExpression */ || expr.kind === 150 /* ElementAccessExpression */) { + if (expr.kind === 64 || expr.kind === 151 || expr.kind === 152) { return expr; } - var node = ts.createNode(155 /* ParenthesizedExpression */); + var node = ts.createNode(157); node.expression = expr; return node; } function createPropertyAccess(object, propName) { - if (propName.kind !== 64 /* Identifier */) { + if (propName.kind !== 64) { return createElementAccess(object, propName); } - var node = ts.createNode(149 /* PropertyAccessExpression */); + var node = ts.createNode(151); node.expression = parenthesizeForAccess(object); node.name = propName; return node; } function createElementAccess(object, index) { - var node = ts.createNode(150 /* ElementAccessExpression */); + var node = ts.createNode(152); node.expression = parenthesizeForAccess(object); node.argumentExpression = index; return node; @@ -17992,7 +18839,7 @@ var ts; } for (var i = 0; i < properties.length; i++) { var p = properties[i]; - if (p.kind === 204 /* PropertyAssignment */ || p.kind === 205 /* ShorthandPropertyAssignment */) { + if (p.kind === 207 || p.kind === 208) { var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccess(value, propName)); } @@ -18005,8 +18852,8 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 168 /* OmittedExpression */) { - if (e.kind !== 167 /* SpreadElementExpression */) { + if (e.kind !== 170) { + if (e.kind !== 169) { emitDestructuringAssignment(e, createElementAccess(value, createNumericLiteral(i))); } else { @@ -18020,14 +18867,14 @@ var ts; } } function emitDestructuringAssignment(target, value) { - if (target.kind === 163 /* BinaryExpression */ && target.operator === 52 /* EqualsToken */) { + if (target.kind === 165 && target.operatorToken.kind === 52) { value = createDefaultValueCheck(value, target.right); target = target.left; } - if (target.kind === 148 /* ObjectLiteralExpression */) { + if (target.kind === 150) { emitObjectLiteralAssignment(target, value); } - else if (target.kind === 147 /* ArrayLiteralExpression */) { + else if (target.kind === 149) { emitArrayLiteralAssignment(target, value); } else { @@ -18037,18 +18884,18 @@ var ts; function emitAssignmentExpression(root) { var target = root.left; var value = root.right; - if (root.parent.kind === 173 /* ExpressionStatement */) { + if (root.parent.kind === 175) { emitDestructuringAssignment(target, value); } else { - if (root.parent.kind !== 155 /* ParenthesizedExpression */) { + if (root.parent.kind !== 157) { write("("); } value = ensureIdentifier(value); emitDestructuringAssignment(target, value); write(", "); emit(value); - if (root.parent.kind !== 155 /* ParenthesizedExpression */) { + if (root.parent.kind !== 157) { write(")"); } } @@ -18068,11 +18915,11 @@ var ts; } for (var i = 0; i < elements.length; i++) { var element = elements[i]; - if (pattern.kind === 144 /* ObjectBindingPattern */) { + if (pattern.kind === 146) { var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccess(value, propName)); } - else if (element.kind !== 168 /* OmittedExpression */) { + else if (element.kind !== 170) { if (!element.dotDotDotToken) { emitBindingElement(element, createElementAccess(value, createNumericLiteral(i))); } @@ -18093,7 +18940,7 @@ var ts; } function emitVariableDeclaration(node) { if (ts.isBindingPattern(node.name)) { - if (languageVersion < 2 /* ES6 */) { + if (languageVersion < 2) { emitDestructuring(node); } else { @@ -18107,7 +18954,7 @@ var ts; } } function emitVariableStatement(node) { - if (!(node.flags & 1 /* Export */)) { + if (!(node.flags & 1)) { if (ts.isLet(node.declarationList)) { write("let "); } @@ -18122,7 +18969,7 @@ var ts; write(";"); } function emitParameter(node) { - if (languageVersion < 2 /* ES6 */) { + if (languageVersion < 2) { if (ts.isBindingPattern(node.name)) { var name = createTempVariable(node); if (!tempParameters) { @@ -18144,7 +18991,7 @@ var ts; } } function emitDefaultValueAssignments(node) { - if (languageVersion < 2 /* ES6 */) { + if (languageVersion < 2) { var tempIndex = 0; ts.forEach(node.parameters, function (p) { if (ts.isBindingPattern(p.name)) { @@ -18173,7 +19020,7 @@ var ts; } } function emitRestParameter(node) { - if (languageVersion < 2 /* ES6 */ && ts.hasRestParameters(node)) { + if (languageVersion < 2 && ts.hasRestParameters(node)) { var restIndex = node.parameters.length - 1; var restParam = node.parameters[restIndex]; var tempName = createTempVariable(node, true).text; @@ -18211,33 +19058,33 @@ var ts; } } function emitAccessor(node) { - write(node.kind === 130 /* GetAccessor */ ? "get " : "set "); + write(node.kind === 132 ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); } function shouldEmitAsArrowFunction(node) { - return node.kind === 157 /* ArrowFunction */ && languageVersion >= 2 /* ES6 */; + return node.kind === 159 && languageVersion >= 2; } function emitFunctionDeclaration(node) { if (ts.nodeIsMissing(node.body)) { return emitPinnedOrTripleSlashComments(node); } - if (node.kind !== 128 /* MethodDeclaration */ && node.kind !== 127 /* MethodSignature */) { + if (node.kind !== 130 && node.kind !== 129) { emitLeadingComments(node); } if (!shouldEmitAsArrowFunction(node)) { write("function "); } - if (node.kind === 190 /* FunctionDeclaration */ || (node.kind === 156 /* FunctionExpression */ && node.name)) { + if (node.kind === 193 || (node.kind === 158 && node.name)) { emit(node.name); } emitSignatureAndBody(node); - if (node.kind !== 128 /* MethodDeclaration */ && node.kind !== 127 /* MethodSignature */) { + if (node.kind !== 130 && node.kind !== 129) { emitTrailingComments(node); } } function emitCaptureThisForNodeIfNecessary(node) { - if (resolver.getNodeCheckFlags(node) & 4 /* CaptureThis */) { + if (resolver.getNodeCheckFlags(node) & 4) { writeLine(); emitStart(node); write("var _this = this;"); @@ -18249,7 +19096,7 @@ var ts; write("("); if (node) { var parameters = node.parameters; - var omitCount = languageVersion < 2 /* ES6 */ && ts.hasRestParameters(node) ? 1 : 0; + var omitCount = languageVersion < 2 && ts.hasRestParameters(node) ? 1 : 0; emitList(parameters, 0, parameters.length - omitCount, false, false); } write(")"); @@ -18276,66 +19123,16 @@ var ts; else { emitSignatureParameters(node); } - write(" {"); - scopeEmitStart(node); - if (!node.body) { - writeLine(); - write("}"); + if (isSingleLineEmptyBlock(node.body) || !node.body) { + write(" { }"); + } + else if (node.body.kind === 172) { + emitBlockFunctionBody(node, node.body); } else { - increaseIndent(); - emitDetachedComments(node.body.kind === 170 /* Block */ ? node.body.statements : node.body); - var startIndex = 0; - if (node.body.kind === 170 /* Block */) { - startIndex = emitDirectivePrologues(node.body.statements, true); - } - var outPos = writer.getTextPos(); - emitCaptureThisForNodeIfNecessary(node); - emitDefaultValueAssignments(node); - emitRestParameter(node); - if (node.body.kind !== 170 /* Block */ && outPos === writer.getTextPos()) { - decreaseIndent(); - write(" "); - emitStart(node.body); - write("return "); - emitNode(node.body, true); - emitEnd(node.body); - write(";"); - emitTempDeclarations(false); - write(" "); - emitStart(node.body); - write("}"); - emitEnd(node.body); - } - else { - if (node.body.kind === 170 /* Block */) { - emitLinesStartingAt(node.body.statements, startIndex); - } - else { - writeLine(); - emitLeadingComments(node.body); - write("return "); - emit(node.body, true); - write(";"); - emitTrailingComments(node.body); - } - emitTempDeclarations(true); - writeLine(); - if (node.body.kind === 170 /* Block */) { - emitLeadingCommentsOfPosition(node.body.statements.end); - decreaseIndent(); - emitToken(15 /* CloseBraceToken */, node.body.statements.end); - } - else { - decreaseIndent(); - emitStart(node.body); - write("}"); - emitEnd(node.body); - } - } + emitExpressionFunctionBody(node, node.body); } - scopeEmitEnd(); - if (node.flags & 1 /* Export */) { + if (node.flags & 1) { writeLine(); emitStart(node); emitModuleMemberName(node); @@ -18348,14 +19145,85 @@ var ts; tempVariables = saveTempVariables; tempParameters = saveTempParameters; } + function emitFunctionBodyPreamble(node) { + emitCaptureThisForNodeIfNecessary(node); + emitDefaultValueAssignments(node); + emitRestParameter(node); + } + function emitExpressionFunctionBody(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 "); + emitNode(body, true); + emitEnd(body); + write(";"); + emitTempDeclarations(false); + write(" "); + } + else { + increaseIndent(); + writeLine(); + emitLeadingComments(node.body); + write("return "); + emit(node.body, true); + write(";"); + emitTrailingComments(node.body); + emitTempDeclarations(true); + decreaseIndent(); + writeLine(); + } + emitStart(node.body); + write("}"); + emitEnd(node.body); + scopeEmitEnd(); + } + function emitBlockFunctionBody(node, body) { + write(" {"); + scopeEmitStart(node); + var outPos = writer.getTextPos(); + increaseIndent(); + emitDetachedComments(body.statements); + var startIndex = emitDirectivePrologues(body.statements, true); + emitFunctionBodyPreamble(node); + decreaseIndent(); + var preambleEmitted = writer.getTextPos() !== outPos; + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var i = 0, n = body.statements.length; i < n; i++) { + write(" "); + emit(body.statements[i]); + } + emitTempDeclarations(false); + write(" "); + emitLeadingCommentsOfPosition(body.statements.end); + } + else { + increaseIndent(); + emitLinesStartingAt(body.statements, startIndex); + emitTempDeclarations(true); + writeLine(); + emitLeadingCommentsOfPosition(body.statements.end); + decreaseIndent(); + } + emitToken(15, body.statements.end); + scopeEmitEnd(); + } function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 173 /* ExpressionStatement */) { + if (statement && statement.kind === 175) { var expr = statement.expression; - if (expr && expr.kind === 151 /* CallExpression */) { + if (expr && expr.kind === 153) { var func = expr.expression; - if (func && func.kind === 90 /* SuperKeyword */) { + if (func && func.kind === 90) { return statement; } } @@ -18364,7 +19232,7 @@ var ts; } function emitParameterPropertyAssignments(node) { ts.forEach(node.parameters, function (param) { - if (param.flags & 112 /* AccessibilityModifier */) { + if (param.flags & 112) { writeLine(); emitStart(param); emitStart(param.name); @@ -18379,12 +19247,12 @@ var ts; }); } function emitMemberAccessForPropertyName(memberName) { - if (memberName.kind === 8 /* StringLiteral */ || memberName.kind === 7 /* NumericLiteral */) { + if (memberName.kind === 8 || memberName.kind === 7) { write("["); emitNode(memberName); write("]"); } - else if (memberName.kind === 122 /* ComputedPropertyName */) { + else if (memberName.kind === 124) { emitComputedPropertyName(memberName); } else { @@ -18394,7 +19262,7 @@ var ts; } function emitMemberAssignments(node, staticFlag) { ts.forEach(node.members, function (member) { - if (member.kind === 126 /* PropertyDeclaration */ && (member.flags & 128 /* Static */) === staticFlag && member.initializer) { + if (member.kind === 128 && (member.flags & 128) === staticFlag && member.initializer) { writeLine(); emitLeadingComments(member); emitStart(member); @@ -18417,7 +19285,7 @@ var ts; } function emitMemberFunctions(node) { ts.forEach(node.members, function (member) { - if (member.kind === 128 /* MethodDeclaration */ || node.kind === 127 /* MethodSignature */) { + if (member.kind === 130 || node.kind === 129) { if (!member.body) { return emitPinnedOrTripleSlashComments(member); } @@ -18426,7 +19294,7 @@ var ts; emitStart(member); emitStart(member.name); emitNode(node.name); - if (!(member.flags & 128 /* Static */)) { + if (!(member.flags & 128)) { write(".prototype"); } emitMemberAccessForPropertyName(member.name); @@ -18439,15 +19307,15 @@ var ts; write(";"); emitTrailingComments(member); } - else if (member.kind === 130 /* GetAccessor */ || member.kind === 131 /* SetAccessor */) { - var accessors = getAllAccessorDeclarations(node, member); + else if (member.kind === 132 || member.kind === 133) { + var accessors = getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); emitStart(member); write("Object.defineProperty("); emitStart(member.name); emitNode(node.name); - if (!(member.flags & 128 /* Static */)) { + if (!(member.flags & 128)) { write(".prototype"); } write(", "); @@ -18511,17 +19379,17 @@ var ts; writeLine(); emitConstructorOfClass(); emitMemberFunctions(node); - emitMemberAssignments(node, 128 /* Static */); + emitMemberAssignments(node, 128); writeLine(); function emitClassReturnStatement() { write("return "); emitNode(node.name); } - emitToken(15 /* CloseBraceToken */, node.members.end, emitClassReturnStatement); + emitToken(15, node.members.end, emitClassReturnStatement); write(";"); decreaseIndent(); writeLine(); - emitToken(15 /* CloseBraceToken */, node.members.end); + emitToken(15, node.members.end); scopeEmitEnd(); emitStart(node); write(")("); @@ -18530,7 +19398,7 @@ var ts; } write(");"); emitEnd(node); - if (node.flags & 1 /* Export */) { + if (node.flags & 1) { writeLine(); emitStart(node); emitModuleMemberName(node); @@ -18547,7 +19415,7 @@ var ts; tempVariables = undefined; tempParameters = undefined; ts.forEach(node.members, function (member) { - if (member.kind === 129 /* Constructor */ && !member.body) { + if (member.kind === 131 && !member.body) { emitPinnedOrTripleSlashComments(member); } }); @@ -18599,7 +19467,7 @@ var ts; emitLeadingCommentsOfPosition(ctor.body.statements.end); } decreaseIndent(); - emitToken(15 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end); + emitToken(15, ctor ? ctor.body.statements.end : node.members.end); scopeEmitEnd(); emitEnd(ctor || node); if (ctor) { @@ -18621,7 +19489,7 @@ var ts; if (!shouldEmitEnumDeclaration(node)) { return; } - if (!(node.flags & 1 /* Export */)) { + if (!(node.flags & 1)) { emitStart(node); write("var "); emit(node.name); @@ -18640,7 +19508,7 @@ var ts; emitLines(node.members); decreaseIndent(); writeLine(); - emitToken(15 /* CloseBraceToken */, node.members.end); + emitToken(15, node.members.end); scopeEmitEnd(); write(")("); emitModuleMemberName(node); @@ -18648,7 +19516,7 @@ var ts; emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - if (node.flags & 1 /* Export */) { + if (node.flags & 1) { writeLine(); emitStart(node); write("var "); @@ -18690,7 +19558,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 195 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 198) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -18715,7 +19583,7 @@ var ts; write(resolver.getLocalNameOfContainer(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 196 /* ModuleBlock */) { + if (node.body.kind === 199) { var saveTempCount = tempCount; var saveTempVariables = tempVariables; tempCount = 0; @@ -18734,11 +19602,11 @@ var ts; decreaseIndent(); writeLine(); var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; - emitToken(15 /* CloseBraceToken */, moduleBlock.statements.end); + emitToken(15, moduleBlock.statements.end); scopeEmitEnd(); } write(")("); - if (node.flags & 1 /* Export */) { + if (node.flags & 1) { emit(node.name); write(" = "); } @@ -18754,8 +19622,8 @@ var ts; emitImportDeclaration = !ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportWithEntityName(node); } if (emitImportDeclaration) { - if (ts.isExternalModuleImportDeclaration(node) && node.parent.kind === 207 /* SourceFile */ && compilerOptions.module === 2 /* AMD */) { - if (node.flags & 1 /* Export */) { + if (ts.isExternalModuleImportDeclaration(node) && node.parent.kind === 210 && compilerOptions.module === 2) { + if (node.flags & 1) { writeLine(); emitLeadingComments(node); emitStart(node); @@ -18771,7 +19639,7 @@ var ts; writeLine(); emitLeadingComments(node); emitStart(node); - if (!(node.flags & 1 /* Export */)) + if (!(node.flags & 1)) write("var "); emitModuleMemberName(node); write(" = "); @@ -18784,7 +19652,7 @@ var ts; emitStart(literal); emitLiteral(literal); emitEnd(literal); - emitToken(17 /* CloseParenToken */, literal.end); + emitToken(17, literal.end); } write(";"); emitEnd(node); @@ -18803,15 +19671,29 @@ var ts; } function getFirstExportAssignment(sourceFile) { return ts.forEach(sourceFile.statements, function (node) { - if (node.kind === 198 /* ExportAssignment */) { + if (node.kind === 201) { return node; } }); } + function sortAMDModules(amdModules) { + return amdModules.sort(function (moduleA, moduleB) { + if (moduleA.name === moduleB.name) { + return 0; + } + else if (!moduleA.name) { + return 1; + } + else { + return -1; + } + }); + } function emitAMDModule(node, startIndex) { var imports = getExternalImportDeclarations(node); writeLine(); write("define("); + sortAMDModules(node.amdDependencies); if (node.amdModuleName) { write("\"" + node.amdModuleName + "\", "); } @@ -18821,7 +19703,7 @@ var ts; emitLiteral(ts.getExternalModuleImportDeclarationExpression(imp)); }); ts.forEach(node.amdDependencies, function (amdDependency) { - var text = "\"" + amdDependency + "\""; + var text = "\"" + amdDependency.path + "\""; write(", "); write(text); }); @@ -18830,6 +19712,12 @@ var ts; write(", "); emit(imp.name); }); + ts.forEach(node.amdDependencies, function (amdDependency) { + if (amdDependency.name) { + write(", "); + write(amdDependency.name); + } + }); write(") {"); increaseIndent(); emitCaptureThisForNodeIfNecessary(node); @@ -18887,7 +19775,7 @@ var ts; writeLine(); emitDetachedComments(node); var startIndex = emitDirectivePrologues(node.statements, false); - if (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8 /* EmitExtends */) { + if (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8) { writeLine(); write("var __extends = this.__extends || function (d, b) {"); increaseIndent(); @@ -18905,7 +19793,7 @@ var ts; extendsEmitted = true; } if (ts.isExternalModule(node)) { - if (compilerOptions.module === 2 /* AMD */) { + if (compilerOptions.module === 2) { emitAMDModule(node, startIndex); } else { @@ -18923,7 +19811,7 @@ var ts; if (!node) { return; } - if (node.flags & 2 /* Ambient */) { + if (node.flags & 2) { return emitPinnedOrTripleSlashComments(node); } var emitComments = !disableComments && shouldEmitLeadingAndTrailingComments(node); @@ -18937,163 +19825,164 @@ var ts; } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 192 /* InterfaceDeclaration */: - case 190 /* FunctionDeclaration */: - case 197 /* ImportDeclaration */: - case 193 /* TypeAliasDeclaration */: - case 198 /* ExportAssignment */: + case 195: + case 193: + case 200: + case 196: + case 201: return false; - case 195 /* ModuleDeclaration */: + case 198: return shouldEmitModuleDeclaration(node); - case 194 /* EnumDeclaration */: + case 197: return shouldEmitEnumDeclaration(node); } return true; } function emitJavaScriptWorker(node) { switch (node.kind) { - case 64 /* Identifier */: + case 64: return emitIdentifier(node); - case 124 /* Parameter */: + case 126: return emitParameter(node); - case 128 /* MethodDeclaration */: - case 127 /* MethodSignature */: + case 130: + case 129: return emitMethod(node); - case 130 /* GetAccessor */: - case 131 /* SetAccessor */: + case 132: + case 133: return emitAccessor(node); - case 92 /* ThisKeyword */: + case 92: return emitThis(node); - case 90 /* SuperKeyword */: + case 90: return emitSuper(node); - case 88 /* NullKeyword */: + case 88: return write("null"); - case 94 /* TrueKeyword */: + case 94: return write("true"); - case 79 /* FalseKeyword */: + case 79: return write("false"); - case 7 /* NumericLiteral */: - case 8 /* StringLiteral */: - case 9 /* RegularExpressionLiteral */: - case 10 /* NoSubstitutionTemplateLiteral */: - case 11 /* TemplateHead */: - case 12 /* TemplateMiddle */: - case 13 /* TemplateTail */: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: return emitLiteral(node); - case 165 /* TemplateExpression */: + case 167: return emitTemplateExpression(node); - case 169 /* TemplateSpan */: + case 171: return emitTemplateSpan(node); - case 121 /* QualifiedName */: + case 123: return emitQualifiedName(node); - case 144 /* ObjectBindingPattern */: + case 146: return emitObjectBindingPattern(node); - case 145 /* ArrayBindingPattern */: + case 147: return emitArrayBindingPattern(node); - case 146 /* BindingElement */: + case 148: return emitBindingElement(node); - case 147 /* ArrayLiteralExpression */: + case 149: return emitArrayLiteral(node); - case 148 /* ObjectLiteralExpression */: + case 150: return emitObjectLiteral(node); - case 204 /* PropertyAssignment */: + case 207: return emitPropertyAssignment(node); - case 205 /* ShorthandPropertyAssignment */: + case 208: return emitShorthandPropertyAssignment(node); - case 122 /* ComputedPropertyName */: + case 124: return emitComputedPropertyName(node); - case 149 /* PropertyAccessExpression */: + case 151: return emitPropertyAccess(node); - case 150 /* ElementAccessExpression */: + case 152: return emitIndexedAccess(node); - case 151 /* CallExpression */: + case 153: return emitCallExpression(node); - case 152 /* NewExpression */: + case 154: return emitNewExpression(node); - case 153 /* TaggedTemplateExpression */: + case 155: return emitTaggedTemplateExpression(node); - case 154 /* TypeAssertionExpression */: + case 156: return emit(node.expression); - case 155 /* ParenthesizedExpression */: + case 157: return emitParenExpression(node); - case 190 /* FunctionDeclaration */: - case 156 /* FunctionExpression */: - case 157 /* ArrowFunction */: + case 193: + case 158: + case 159: return emitFunctionDeclaration(node); - case 158 /* DeleteExpression */: + case 160: return emitDeleteExpression(node); - case 159 /* TypeOfExpression */: + case 161: return emitTypeOfExpression(node); - case 160 /* VoidExpression */: + case 162: return emitVoidExpression(node); - case 161 /* PrefixUnaryExpression */: + case 163: return emitPrefixUnaryExpression(node); - case 162 /* PostfixUnaryExpression */: + case 164: return emitPostfixUnaryExpression(node); - case 163 /* BinaryExpression */: + case 165: return emitBinaryExpression(node); - case 164 /* ConditionalExpression */: + case 166: return emitConditionalExpression(node); - case 167 /* SpreadElementExpression */: + case 169: return emitSpreadElementExpression(node); - case 168 /* OmittedExpression */: + case 170: return; - case 170 /* Block */: - case 196 /* ModuleBlock */: + case 172: + case 199: return emitBlock(node); - case 171 /* VariableStatement */: + case 173: return emitVariableStatement(node); - case 172 /* EmptyStatement */: + case 174: return write(";"); - case 173 /* ExpressionStatement */: + case 175: return emitExpressionStatement(node); - case 174 /* IfStatement */: + case 176: return emitIfStatement(node); - case 175 /* DoStatement */: + case 177: return emitDoStatement(node); - case 176 /* WhileStatement */: + case 178: return emitWhileStatement(node); - case 177 /* ForStatement */: + case 179: return emitForStatement(node); - case 178 /* ForInStatement */: - return emitForInStatement(node); - case 179 /* ContinueStatement */: - case 180 /* BreakStatement */: + case 181: + case 180: + return emitForInOrForOfStatement(node); + case 182: + case 183: return emitBreakOrContinueStatement(node); - case 181 /* ReturnStatement */: + case 184: return emitReturnStatement(node); - case 182 /* WithStatement */: + case 185: return emitWithStatement(node); - case 183 /* SwitchStatement */: + case 186: return emitSwitchStatement(node); - case 200 /* CaseClause */: - case 201 /* DefaultClause */: + case 203: + case 204: return emitCaseOrDefaultClause(node); - case 184 /* LabeledStatement */: + case 187: return emitLabelledStatement(node); - case 185 /* ThrowStatement */: + case 188: return emitThrowStatement(node); - case 186 /* TryStatement */: + case 189: return emitTryStatement(node); - case 203 /* CatchClause */: + case 206: return emitCatchClause(node); - case 187 /* DebuggerStatement */: + case 190: return emitDebuggerStatement(node); - case 188 /* VariableDeclaration */: + case 191: return emitVariableDeclaration(node); - case 191 /* ClassDeclaration */: + case 194: return emitClassDeclaration(node); - case 192 /* InterfaceDeclaration */: + case 195: return emitInterfaceDeclaration(node); - case 194 /* EnumDeclaration */: + case 197: return emitEnumDeclaration(node); - case 206 /* EnumMember */: + case 209: return emitEnumMember(node); - case 195 /* ModuleDeclaration */: + case 198: return emitModuleDeclaration(node); - case 197 /* ImportDeclaration */: + case 200: return emitImportDeclaration(node); - case 207 /* SourceFile */: + case 210: return emitSourceFile(node); } } @@ -19112,7 +20001,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 207 /* SourceFile */ || node.pos !== node.parent.pos) { + if (node.parent.kind === 210 || node.pos !== node.parent.pos) { var leadingComments; if (hasDetachedComments(node.pos)) { leadingComments = getLeadingCommentsWithoutDetachedComments(); @@ -19131,7 +20020,7 @@ var ts; } function emitTrailingDeclarationComments(node) { if (node.parent) { - if (node.parent.kind === 207 /* SourceFile */ || node.end !== node.parent.end) { + if (node.parent.kind === 210 || node.end !== node.parent.end) { var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, node.end); emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); } @@ -19166,8 +20055,8 @@ var ts; }); if (detachedComments.length) { var lastCommentLine = getLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end); - var astLine = getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); - if (astLine >= lastCommentLine + 2) { + var nodeLine = getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; @@ -19184,10 +20073,13 @@ var ts; function emitPinnedOrTripleSlashCommentsOfNode(node) { var pinnedComments = ts.filter(getLeadingCommentsToEmit(node), isPinnedOrTripleSlashComment); function isPinnedOrTripleSlashComment(comment) { - if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */) { - return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33 /* exclamation */; + if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { + return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; } - else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 /* slash */ && comment.pos + 2 < comment.end && currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 /* slash */ && currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { + else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && + comment.pos + 2 < comment.end && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && + currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { return true; } } @@ -19508,7 +20400,8 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (ts.isExternalModuleImportDeclaration(node) && ts.getExternalModuleImportDeclarationExpression(node).kind === 8 /* StringLiteral */) { + if (ts.isExternalModuleImportDeclaration(node) && + ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { var nameLiteral = ts.getExternalModuleImportDeclarationExpression(node); var moduleName = nameLiteral.text; if (moduleName) { @@ -19526,9 +20419,10 @@ var ts; } } } - else if (node.kind === 195 /* ModuleDeclaration */ && node.name.kind === 8 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || ts.isDeclarationFile(file))) { + else if (node.kind === 198 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportDeclaration(node) && ts.getExternalModuleImportDeclarationExpression(node).kind === 8 /* StringLiteral */) { + if (ts.isExternalModuleImportDeclaration(node) && + ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { var nameLiteral = ts.getExternalModuleImportDeclarationExpression(node); var moduleName = nameLiteral.text; if (moduleName) { @@ -19563,10 +20457,13 @@ var ts; var errorLength = externalModuleErrorSpan.end - errorStart; diagnostics.add(ts.createFileDiagnostic(firstExternalModule, errorStart, errorLength, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } - if (options.outDir || options.sourceRoot || (options.mapRoot && (!options.out || firstExternalModule !== undefined))) { + if (options.outDir || + options.sourceRoot || + (options.mapRoot && + (!options.out || firstExternalModule !== undefined))) { var commonPathComponents; ts.forEach(files, function (sourceFile) { - if (!(sourceFile.flags & 1024 /* DeclarationFile */) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { + if (!(sourceFile.flags & 1024) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); sourcePathComponents.pop(); if (commonPathComponents) { @@ -19656,8 +20553,8 @@ var ts; name: "module", shortName: "m", type: { - "commonjs": 1 /* CommonJS */, - "amd": 2 /* AMD */ + "commonjs": 1, + "amd": 2 }, description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_or_amd, paramType: ts.Diagnostics.KIND, @@ -19747,7 +20644,7 @@ var ts; { name: "target", shortName: "t", - type: { "es3": 0 /* ES3 */, "es5": 1 /* ES5 */, "es6": 2 /* ES6 */ }, + type: { "es3": 0, "es5": 1, "es6": 2 }, description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental, paramType: ts.Diagnostics.VERSION, error: ts.Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6 @@ -19787,11 +20684,11 @@ var ts; var i = 0; while (i < args.length) { var s = args[i++]; - if (s.charCodeAt(0) === 64 /* at */) { + if (s.charCodeAt(0) === 64) { parseResponseFile(s.slice(1)); } - else if (s.charCodeAt(0) === 45 /* minus */) { - s = s.slice(s.charCodeAt(1) === 45 /* minus */ ? 2 : 1).toLowerCase(); + else if (s.charCodeAt(0) === 45) { + s = s.slice(s.charCodeAt(1) === 45 ? 2 : 1).toLowerCase(); if (ts.hasProperty(shortOptionNames, s)) { s = shortOptionNames[s]; } @@ -19839,14 +20736,14 @@ var ts; var args = []; var pos = 0; while (true) { - while (pos < text.length && text.charCodeAt(pos) <= 32 /* space */) + while (pos < text.length && text.charCodeAt(pos) <= 32) pos++; if (pos >= text.length) break; var start = pos; - if (text.charCodeAt(start) === 34 /* doubleQuote */) { + if (text.charCodeAt(start) === 34) { pos++; - while (pos < text.length && text.charCodeAt(pos) !== 34 /* doubleQuote */) + while (pos < text.length && text.charCodeAt(pos) !== 34) pos++; if (pos < text.length) { args.push(text.substring(start + 1, pos)); @@ -19857,7 +20754,7 @@ var ts; } } else { - while (text.charCodeAt(pos) > 32 /* space */) + while (text.charCodeAt(pos) > 32) pos++; args.push(text.substring(start, pos)); } @@ -19955,7 +20852,8 @@ var ts; } var language = matchResult[1]; var territory = matchResult[3]; - if (!trySetLanguageAndTerritory(language, territory, errors) && !trySetLanguageAndTerritory(language, undefined, errors)) { + if (!trySetLanguageAndTerritory(language, territory, errors) && + !trySetLanguageAndTerritory(language, undefined, errors)) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_locale_0, locale)); return false; } @@ -19991,7 +20889,7 @@ var ts; function countLines(program) { var count = 0; ts.forEach(program.getSourceFiles(), function (file) { - count += ts.getLineAndCharacterOfPosition(file, file.end).line; + count += ts.getLineStarts(file).length; }); return count; } @@ -20007,7 +20905,7 @@ var ts; var output = ""; if (diagnostic.file) { var loc = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start); - output += diagnostic.file.fileName + "(" + loc.line + "," + loc.character + "): "; + output += diagnostic.file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + "): "; } var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase(); output += category + " TS" + diagnostic.code + ": " + ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine) + ts.sys.newLine; @@ -20071,32 +20969,32 @@ var ts; if (commandLine.options.locale) { if (!isJSONSupported()) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--locale")); - return ts.sys.exit(1 /* DiagnosticsPresent_OutputsSkipped */); + return ts.sys.exit(1); } validateLocaleAndSetLanguage(commandLine.options.locale, commandLine.errors); } if (commandLine.errors.length > 0) { reportDiagnostics(commandLine.errors); - return ts.sys.exit(1 /* DiagnosticsPresent_OutputsSkipped */); + return ts.sys.exit(1); } if (commandLine.options.version) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Version_0, version)); - return ts.sys.exit(0 /* Success */); + return ts.sys.exit(0); } if (commandLine.options.help) { printVersion(); printHelp(); - return ts.sys.exit(0 /* Success */); + return ts.sys.exit(0); } if (commandLine.options.project) { if (!isJSONSupported()) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--project")); - return ts.sys.exit(1 /* DiagnosticsPresent_OutputsSkipped */); + return ts.sys.exit(1); } configFileName = ts.normalizePath(ts.combinePaths(commandLine.options.project, "tsconfig.json")); if (commandLine.fileNames.length !== 0) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line)); - return ts.sys.exit(1 /* DiagnosticsPresent_OutputsSkipped */); + return ts.sys.exit(1); } } else if (commandLine.fileNames.length === 0 && isJSONSupported()) { @@ -20105,12 +21003,12 @@ var ts; if (commandLine.fileNames.length === 0 && !configFileName) { printVersion(); printHelp(); - return ts.sys.exit(0 /* Success */); + return ts.sys.exit(0); } if (commandLine.options.watch) { if (!ts.sys.watchFile) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.The_current_host_does_not_support_the_0_option, "--watch")); - return ts.sys.exit(1 /* DiagnosticsPresent_OutputsSkipped */); + return ts.sys.exit(1); } if (configFileName) { configFileWatcher = ts.sys.watchFile(configFileName, configFileChanged); @@ -20123,12 +21021,12 @@ var ts; var configObject = ts.readConfigFile(configFileName); if (!configObject) { reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, configFileName)); - return ts.sys.exit(1 /* DiagnosticsPresent_OutputsSkipped */); + return ts.sys.exit(1); } var configParseResult = ts.parseConfigFile(configObject, ts.getDirectoryPath(configFileName)); if (configParseResult.errors.length > 0) { reportDiagnostics(configParseResult.errors); - return ts.sys.exit(1 /* DiagnosticsPresent_OutputsSkipped */); + return ts.sys.exit(1); } rootFileNames = configParseResult.fileNames; compilerOptions = ts.extend(commandLine.options, configParseResult.options); @@ -20204,7 +21102,7 @@ var ts; var start = new Date().getTime(); var program = ts.createProgram(fileNames, compilerOptions, compilerHost); var exitStatus = compileProgram(); - var end = start - new Date().getTime(); + var end = new Date().getTime() - start; if (compilerOptions.listFiles) { ts.forEach(program.getSourceFiles(), function (file) { ts.sys.write(file.fileName + ts.sys.newLine); @@ -20225,7 +21123,7 @@ var ts; reportTimeStatistic("Bind time", ts.bindTime); reportTimeStatistic("Check time", ts.checkTime); reportTimeStatistic("Emit time", ts.emitTime); - reportTimeStatistic("Total time", start - end); + reportTimeStatistic("Total time", end); } return { program: program, exitStatus: exitStatus }; function compileProgram() { @@ -20240,17 +21138,17 @@ var ts; } } if (compilerOptions.noEmit) { - return diagnostics.length ? 1 /* DiagnosticsPresent_OutputsSkipped */ : 0 /* Success */; + return diagnostics.length ? 1 : 0; } var emitOutput = program.emit(); reportDiagnostics(emitOutput.diagnostics); if (emitOutput.emitSkipped) { - return 1 /* DiagnosticsPresent_OutputsSkipped */; + return 1; } if (diagnostics.length > 0 || emitOutput.diagnostics.length > 0) { - 2 /* DiagnosticsPresent_OutputsGenerated */; + 2; } - return 0 /* Success */; + return 0; } } function printVersion() { diff --git a/bin/tsserver b/bin/tsserver new file mode 100644 index 00000000000..003eb0d22af --- /dev/null +++ b/bin/tsserver @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('./tsserver.js') diff --git a/bin/typescript.d.ts b/bin/typescript.d.ts index e54b125f73d..b0cc19c87d3 100644 --- a/bin/typescript.d.ts +++ b/bin/typescript.d.ts @@ -142,110 +142,113 @@ declare module "typescript" { NumberKeyword = 117, SetKeyword = 118, StringKeyword = 119, - TypeKeyword = 120, - QualifiedName = 121, - ComputedPropertyName = 122, - TypeParameter = 123, - Parameter = 124, - PropertySignature = 125, - PropertyDeclaration = 126, - MethodSignature = 127, - MethodDeclaration = 128, - Constructor = 129, - GetAccessor = 130, - SetAccessor = 131, - CallSignature = 132, - ConstructSignature = 133, - IndexSignature = 134, - TypeReference = 135, - FunctionType = 136, - ConstructorType = 137, - TypeQuery = 138, - TypeLiteral = 139, - ArrayType = 140, - TupleType = 141, - UnionType = 142, - ParenthesizedType = 143, - ObjectBindingPattern = 144, - ArrayBindingPattern = 145, - BindingElement = 146, - ArrayLiteralExpression = 147, - ObjectLiteralExpression = 148, - PropertyAccessExpression = 149, - ElementAccessExpression = 150, - CallExpression = 151, - NewExpression = 152, - TaggedTemplateExpression = 153, - TypeAssertionExpression = 154, - ParenthesizedExpression = 155, - FunctionExpression = 156, - ArrowFunction = 157, - DeleteExpression = 158, - TypeOfExpression = 159, - VoidExpression = 160, - PrefixUnaryExpression = 161, - PostfixUnaryExpression = 162, - BinaryExpression = 163, - ConditionalExpression = 164, - TemplateExpression = 165, - YieldExpression = 166, - SpreadElementExpression = 167, - OmittedExpression = 168, - TemplateSpan = 169, - Block = 170, - VariableStatement = 171, - EmptyStatement = 172, - ExpressionStatement = 173, - IfStatement = 174, - DoStatement = 175, - WhileStatement = 176, - ForStatement = 177, - ForInStatement = 178, - ContinueStatement = 179, - BreakStatement = 180, - ReturnStatement = 181, - WithStatement = 182, - SwitchStatement = 183, - LabeledStatement = 184, - ThrowStatement = 185, - TryStatement = 186, - DebuggerStatement = 187, - VariableDeclaration = 188, - VariableDeclarationList = 189, - FunctionDeclaration = 190, - ClassDeclaration = 191, - InterfaceDeclaration = 192, - TypeAliasDeclaration = 193, - EnumDeclaration = 194, - ModuleDeclaration = 195, - ModuleBlock = 196, - ImportDeclaration = 197, - ExportAssignment = 198, - ExternalModuleReference = 199, - CaseClause = 200, - DefaultClause = 201, - HeritageClause = 202, - CatchClause = 203, - PropertyAssignment = 204, - ShorthandPropertyAssignment = 205, - EnumMember = 206, - SourceFile = 207, - SyntaxList = 208, - Count = 209, + SymbolKeyword = 120, + TypeKeyword = 121, + OfKeyword = 122, + QualifiedName = 123, + ComputedPropertyName = 124, + TypeParameter = 125, + Parameter = 126, + PropertySignature = 127, + PropertyDeclaration = 128, + MethodSignature = 129, + MethodDeclaration = 130, + Constructor = 131, + GetAccessor = 132, + SetAccessor = 133, + CallSignature = 134, + ConstructSignature = 135, + IndexSignature = 136, + TypeReference = 137, + FunctionType = 138, + ConstructorType = 139, + TypeQuery = 140, + TypeLiteral = 141, + ArrayType = 142, + TupleType = 143, + UnionType = 144, + ParenthesizedType = 145, + ObjectBindingPattern = 146, + ArrayBindingPattern = 147, + BindingElement = 148, + ArrayLiteralExpression = 149, + ObjectLiteralExpression = 150, + PropertyAccessExpression = 151, + ElementAccessExpression = 152, + CallExpression = 153, + NewExpression = 154, + TaggedTemplateExpression = 155, + TypeAssertionExpression = 156, + ParenthesizedExpression = 157, + FunctionExpression = 158, + ArrowFunction = 159, + DeleteExpression = 160, + TypeOfExpression = 161, + VoidExpression = 162, + PrefixUnaryExpression = 163, + PostfixUnaryExpression = 164, + BinaryExpression = 165, + ConditionalExpression = 166, + TemplateExpression = 167, + YieldExpression = 168, + SpreadElementExpression = 169, + OmittedExpression = 170, + TemplateSpan = 171, + Block = 172, + VariableStatement = 173, + EmptyStatement = 174, + ExpressionStatement = 175, + IfStatement = 176, + DoStatement = 177, + WhileStatement = 178, + ForStatement = 179, + ForInStatement = 180, + ForOfStatement = 181, + ContinueStatement = 182, + BreakStatement = 183, + ReturnStatement = 184, + WithStatement = 185, + SwitchStatement = 186, + LabeledStatement = 187, + ThrowStatement = 188, + TryStatement = 189, + DebuggerStatement = 190, + VariableDeclaration = 191, + VariableDeclarationList = 192, + FunctionDeclaration = 193, + ClassDeclaration = 194, + InterfaceDeclaration = 195, + TypeAliasDeclaration = 196, + EnumDeclaration = 197, + ModuleDeclaration = 198, + ModuleBlock = 199, + ImportDeclaration = 200, + ExportAssignment = 201, + ExternalModuleReference = 202, + CaseClause = 203, + DefaultClause = 204, + HeritageClause = 205, + CatchClause = 206, + PropertyAssignment = 207, + ShorthandPropertyAssignment = 208, + EnumMember = 209, + SourceFile = 210, + SyntaxList = 211, + Count = 212, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 120, + LastKeyword = 122, FirstFutureReservedWord = 101, LastFutureReservedWord = 109, - FirstTypeNode = 135, - LastTypeNode = 143, + FirstTypeNode = 137, + LastTypeNode = 145, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 120, + LastToken = 122, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -254,7 +257,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 121, + FirstNode = 123, } const enum NodeFlags { Export = 1, @@ -487,7 +490,7 @@ declare module "typescript" { } interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } interface ConditionalExpression extends Expression { @@ -585,6 +588,10 @@ declare module "typescript" { initializer: VariableDeclarationList | Expression; expression: Expression; } + interface ForOfStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } interface BreakOrContinueStatement extends Statement { label?: Identifier; } @@ -686,7 +693,10 @@ declare module "typescript" { endOfFileToken: Node; fileName: string; text: string; - amdDependencies: string[]; + amdDependencies: { + path: string; + name: string; + }[]; amdModuleName: string; referencedFiles: FileReference[]; hasNoDefaultLib: boolean; @@ -991,8 +1001,9 @@ declare module "typescript" { ObjectLiteral = 131072, ContainsUndefinedOrNull = 262144, ContainsObjectLiteral = 524288, - Intrinsic = 127, - Primitive = 510, + ESSymbol = 1048576, + Intrinsic = 1048703, + Primitive = 1049086, StringLike = 258, NumberLike = 132, ObjectType = 48128, @@ -1278,6 +1289,7 @@ declare module "typescript" { equals = 61, exclamation = 33, greaterThan = 62, + hash = 35, lessThan = 60, minus = 45, openBrace = 123, @@ -1344,8 +1356,8 @@ declare module "typescript" { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; @@ -1367,7 +1379,7 @@ declare module "typescript" { function createNode(kind: SyntaxKind): Node; function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; function modifierToFlag(token: SyntaxKind): NodeFlags; - function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile; + function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; function isEvalOrArgumentsIdentifier(node: Node): boolean; function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; function isLeftHandSideExpression(expr: Expression): boolean; @@ -1429,9 +1441,9 @@ declare module "typescript" { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** @@ -1493,7 +1505,7 @@ declare module "typescript" { getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; @@ -1568,6 +1580,7 @@ declare module "typescript" { InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; + [s: string]: boolean | number | string; } interface DefinitionInfo { fileName: string; @@ -1701,6 +1714,9 @@ declare module "typescript" { InMultiLineCommentTrivia = 1, InSingleQuoteStringLiteral = 2, InDoubleQuoteStringLiteral = 3, + InTemplateHeadOrNoSubstitutionTemplate = 4, + InTemplateMiddleOrTail = 5, + InTemplateSubstitutionPosition = 6, } enum TokenClass { Punctuation = 0, @@ -1722,7 +1738,26 @@ declare module "typescript" { classification: TokenClass; } interface Classifier { - getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult; + /** + * Gives lexical classifications of tokens on a line without any syntactic context. + * For instance, a token consisting of the text 'string' can be either an identifier + * named 'string' or the keyword 'string', however, because this classifier is not aware, + * it relies on certain heuristics to give acceptable results. For classifications where + * speed trumps accuracy, this function is preferable; however, for true accuracy, the + * syntactic classifier is ideal. In fact, in certain editing scenarios, combining the + * lexical, syntactic, and semantic classifiers may issue the best user experience. + * + * @param text The text of a line to classify. + * @param lexState The state of the lexical classifier at the end of the previous line. + * @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier. + * If there is no syntactic classifier (syntacticClassifierAbsent=true), + * certain heuristics may be used in its place; however, if there is a + * syntactic classifier (syntacticClassifierAbsent=false), certain + * classifications which may be incorrectly categorized will be given + * back as Identifiers in order to allow the syntactic classifier to + * subsume the classification. + */ + getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; } /** * The document registry represents a store of SourceFile objects that can be shared between @@ -1858,7 +1893,7 @@ declare module "typescript" { } function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; var disableIncrementalParsing: boolean; - function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; + function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; function createDocumentRegistry(): DocumentRegistry; function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; diff --git a/bin/typescript.js b/bin/typescript.js new file mode 100644 index 00000000000..1d2c9f37ac8 --- /dev/null +++ b/bin/typescript.js @@ -0,0 +1,30159 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +var ts; +(function (ts) { + (function (SyntaxKind) { + SyntaxKind[SyntaxKind["Unknown"] = 0] = "Unknown"; + SyntaxKind[SyntaxKind["EndOfFileToken"] = 1] = "EndOfFileToken"; + SyntaxKind[SyntaxKind["SingleLineCommentTrivia"] = 2] = "SingleLineCommentTrivia"; + SyntaxKind[SyntaxKind["MultiLineCommentTrivia"] = 3] = "MultiLineCommentTrivia"; + SyntaxKind[SyntaxKind["NewLineTrivia"] = 4] = "NewLineTrivia"; + SyntaxKind[SyntaxKind["WhitespaceTrivia"] = 5] = "WhitespaceTrivia"; + SyntaxKind[SyntaxKind["ConflictMarkerTrivia"] = 6] = "ConflictMarkerTrivia"; + SyntaxKind[SyntaxKind["NumericLiteral"] = 7] = "NumericLiteral"; + SyntaxKind[SyntaxKind["StringLiteral"] = 8] = "StringLiteral"; + SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 9] = "RegularExpressionLiteral"; + SyntaxKind[SyntaxKind["NoSubstitutionTemplateLiteral"] = 10] = "NoSubstitutionTemplateLiteral"; + SyntaxKind[SyntaxKind["TemplateHead"] = 11] = "TemplateHead"; + SyntaxKind[SyntaxKind["TemplateMiddle"] = 12] = "TemplateMiddle"; + SyntaxKind[SyntaxKind["TemplateTail"] = 13] = "TemplateTail"; + SyntaxKind[SyntaxKind["OpenBraceToken"] = 14] = "OpenBraceToken"; + SyntaxKind[SyntaxKind["CloseBraceToken"] = 15] = "CloseBraceToken"; + SyntaxKind[SyntaxKind["OpenParenToken"] = 16] = "OpenParenToken"; + SyntaxKind[SyntaxKind["CloseParenToken"] = 17] = "CloseParenToken"; + SyntaxKind[SyntaxKind["OpenBracketToken"] = 18] = "OpenBracketToken"; + SyntaxKind[SyntaxKind["CloseBracketToken"] = 19] = "CloseBracketToken"; + SyntaxKind[SyntaxKind["DotToken"] = 20] = "DotToken"; + SyntaxKind[SyntaxKind["DotDotDotToken"] = 21] = "DotDotDotToken"; + SyntaxKind[SyntaxKind["SemicolonToken"] = 22] = "SemicolonToken"; + SyntaxKind[SyntaxKind["CommaToken"] = 23] = "CommaToken"; + SyntaxKind[SyntaxKind["LessThanToken"] = 24] = "LessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanToken"] = 25] = "GreaterThanToken"; + SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 26] = "LessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 27] = "GreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 28] = "EqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 29] = "ExclamationEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 30] = "EqualsEqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 31] = "ExclamationEqualsEqualsToken"; + SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 32] = "EqualsGreaterThanToken"; + SyntaxKind[SyntaxKind["PlusToken"] = 33] = "PlusToken"; + SyntaxKind[SyntaxKind["MinusToken"] = 34] = "MinusToken"; + SyntaxKind[SyntaxKind["AsteriskToken"] = 35] = "AsteriskToken"; + SyntaxKind[SyntaxKind["SlashToken"] = 36] = "SlashToken"; + SyntaxKind[SyntaxKind["PercentToken"] = 37] = "PercentToken"; + SyntaxKind[SyntaxKind["PlusPlusToken"] = 38] = "PlusPlusToken"; + SyntaxKind[SyntaxKind["MinusMinusToken"] = 39] = "MinusMinusToken"; + SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 40] = "LessThanLessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 41] = "GreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 42] = "GreaterThanGreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["AmpersandToken"] = 43] = "AmpersandToken"; + SyntaxKind[SyntaxKind["BarToken"] = 44] = "BarToken"; + SyntaxKind[SyntaxKind["CaretToken"] = 45] = "CaretToken"; + SyntaxKind[SyntaxKind["ExclamationToken"] = 46] = "ExclamationToken"; + SyntaxKind[SyntaxKind["TildeToken"] = 47] = "TildeToken"; + SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 48] = "AmpersandAmpersandToken"; + SyntaxKind[SyntaxKind["BarBarToken"] = 49] = "BarBarToken"; + SyntaxKind[SyntaxKind["QuestionToken"] = 50] = "QuestionToken"; + SyntaxKind[SyntaxKind["ColonToken"] = 51] = "ColonToken"; + SyntaxKind[SyntaxKind["EqualsToken"] = 52] = "EqualsToken"; + SyntaxKind[SyntaxKind["PlusEqualsToken"] = 53] = "PlusEqualsToken"; + SyntaxKind[SyntaxKind["MinusEqualsToken"] = 54] = "MinusEqualsToken"; + SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 55] = "AsteriskEqualsToken"; + SyntaxKind[SyntaxKind["SlashEqualsToken"] = 56] = "SlashEqualsToken"; + SyntaxKind[SyntaxKind["PercentEqualsToken"] = 57] = "PercentEqualsToken"; + SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 58] = "LessThanLessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 59] = "GreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 60] = "GreaterThanGreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 61] = "AmpersandEqualsToken"; + SyntaxKind[SyntaxKind["BarEqualsToken"] = 62] = "BarEqualsToken"; + SyntaxKind[SyntaxKind["CaretEqualsToken"] = 63] = "CaretEqualsToken"; + SyntaxKind[SyntaxKind["Identifier"] = 64] = "Identifier"; + SyntaxKind[SyntaxKind["BreakKeyword"] = 65] = "BreakKeyword"; + SyntaxKind[SyntaxKind["CaseKeyword"] = 66] = "CaseKeyword"; + SyntaxKind[SyntaxKind["CatchKeyword"] = 67] = "CatchKeyword"; + SyntaxKind[SyntaxKind["ClassKeyword"] = 68] = "ClassKeyword"; + SyntaxKind[SyntaxKind["ConstKeyword"] = 69] = "ConstKeyword"; + SyntaxKind[SyntaxKind["ContinueKeyword"] = 70] = "ContinueKeyword"; + SyntaxKind[SyntaxKind["DebuggerKeyword"] = 71] = "DebuggerKeyword"; + SyntaxKind[SyntaxKind["DefaultKeyword"] = 72] = "DefaultKeyword"; + SyntaxKind[SyntaxKind["DeleteKeyword"] = 73] = "DeleteKeyword"; + SyntaxKind[SyntaxKind["DoKeyword"] = 74] = "DoKeyword"; + SyntaxKind[SyntaxKind["ElseKeyword"] = 75] = "ElseKeyword"; + SyntaxKind[SyntaxKind["EnumKeyword"] = 76] = "EnumKeyword"; + SyntaxKind[SyntaxKind["ExportKeyword"] = 77] = "ExportKeyword"; + SyntaxKind[SyntaxKind["ExtendsKeyword"] = 78] = "ExtendsKeyword"; + SyntaxKind[SyntaxKind["FalseKeyword"] = 79] = "FalseKeyword"; + SyntaxKind[SyntaxKind["FinallyKeyword"] = 80] = "FinallyKeyword"; + SyntaxKind[SyntaxKind["ForKeyword"] = 81] = "ForKeyword"; + SyntaxKind[SyntaxKind["FunctionKeyword"] = 82] = "FunctionKeyword"; + SyntaxKind[SyntaxKind["IfKeyword"] = 83] = "IfKeyword"; + SyntaxKind[SyntaxKind["ImportKeyword"] = 84] = "ImportKeyword"; + SyntaxKind[SyntaxKind["InKeyword"] = 85] = "InKeyword"; + SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 86] = "InstanceOfKeyword"; + SyntaxKind[SyntaxKind["NewKeyword"] = 87] = "NewKeyword"; + SyntaxKind[SyntaxKind["NullKeyword"] = 88] = "NullKeyword"; + SyntaxKind[SyntaxKind["ReturnKeyword"] = 89] = "ReturnKeyword"; + SyntaxKind[SyntaxKind["SuperKeyword"] = 90] = "SuperKeyword"; + SyntaxKind[SyntaxKind["SwitchKeyword"] = 91] = "SwitchKeyword"; + SyntaxKind[SyntaxKind["ThisKeyword"] = 92] = "ThisKeyword"; + SyntaxKind[SyntaxKind["ThrowKeyword"] = 93] = "ThrowKeyword"; + SyntaxKind[SyntaxKind["TrueKeyword"] = 94] = "TrueKeyword"; + SyntaxKind[SyntaxKind["TryKeyword"] = 95] = "TryKeyword"; + SyntaxKind[SyntaxKind["TypeOfKeyword"] = 96] = "TypeOfKeyword"; + SyntaxKind[SyntaxKind["VarKeyword"] = 97] = "VarKeyword"; + SyntaxKind[SyntaxKind["VoidKeyword"] = 98] = "VoidKeyword"; + SyntaxKind[SyntaxKind["WhileKeyword"] = 99] = "WhileKeyword"; + SyntaxKind[SyntaxKind["WithKeyword"] = 100] = "WithKeyword"; + SyntaxKind[SyntaxKind["ImplementsKeyword"] = 101] = "ImplementsKeyword"; + SyntaxKind[SyntaxKind["InterfaceKeyword"] = 102] = "InterfaceKeyword"; + SyntaxKind[SyntaxKind["LetKeyword"] = 103] = "LetKeyword"; + SyntaxKind[SyntaxKind["PackageKeyword"] = 104] = "PackageKeyword"; + SyntaxKind[SyntaxKind["PrivateKeyword"] = 105] = "PrivateKeyword"; + SyntaxKind[SyntaxKind["ProtectedKeyword"] = 106] = "ProtectedKeyword"; + SyntaxKind[SyntaxKind["PublicKeyword"] = 107] = "PublicKeyword"; + SyntaxKind[SyntaxKind["StaticKeyword"] = 108] = "StaticKeyword"; + SyntaxKind[SyntaxKind["YieldKeyword"] = 109] = "YieldKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 110] = "AnyKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 111] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 112] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 113] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 114] = "GetKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 115] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 116] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 117] = "NumberKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 118] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 119] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 120] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 121] = "TypeKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 122] = "OfKeyword"; + SyntaxKind[SyntaxKind["QualifiedName"] = 123] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 124] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["TypeParameter"] = 125] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 126] = "Parameter"; + SyntaxKind[SyntaxKind["PropertySignature"] = 127] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 128] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 129] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 130] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 131] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 132] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 133] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 134] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 135] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 136] = "IndexSignature"; + SyntaxKind[SyntaxKind["TypeReference"] = 137] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 138] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 139] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 140] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 141] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 142] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 143] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 144] = "UnionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 145] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 146] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 147] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 148] = "BindingElement"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 149] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 150] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 151] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 152] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 153] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 154] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 155] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 156] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 157] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 158] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 159] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 160] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 161] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 162] = "VoidExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 163] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 164] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 165] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 166] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 167] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 168] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElementExpression"] = 169] = "SpreadElementExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 170] = "OmittedExpression"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 171] = "TemplateSpan"; + SyntaxKind[SyntaxKind["Block"] = 172] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 173] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 174] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 175] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 176] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 177] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 178] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 179] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 180] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 181] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 182] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 183] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 184] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 185] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 186] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 187] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 188] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 189] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 190] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 191] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 192] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 193] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 194] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 195] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 196] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 197] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 198] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 199] = "ModuleBlock"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 200] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 201] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 202] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["CaseClause"] = 203] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 204] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 205] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 206] = "CatchClause"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 207] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 208] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["EnumMember"] = 209] = "EnumMember"; + SyntaxKind[SyntaxKind["SourceFile"] = 210] = "SourceFile"; + SyntaxKind[SyntaxKind["SyntaxList"] = 211] = "SyntaxList"; + SyntaxKind[SyntaxKind["Count"] = 212] = "Count"; + SyntaxKind[SyntaxKind["FirstAssignment"] = 52] = "FirstAssignment"; + SyntaxKind[SyntaxKind["LastAssignment"] = 63] = "LastAssignment"; + SyntaxKind[SyntaxKind["FirstReservedWord"] = 65] = "FirstReservedWord"; + SyntaxKind[SyntaxKind["LastReservedWord"] = 100] = "LastReservedWord"; + SyntaxKind[SyntaxKind["FirstKeyword"] = 65] = "FirstKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 122] = "LastKeyword"; + SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 101] = "FirstFutureReservedWord"; + SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 109] = "LastFutureReservedWord"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 137] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 145] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstPunctuation"] = 14] = "FirstPunctuation"; + SyntaxKind[SyntaxKind["LastPunctuation"] = 63] = "LastPunctuation"; + SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; + SyntaxKind[SyntaxKind["LastToken"] = 122] = "LastToken"; + SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; + SyntaxKind[SyntaxKind["LastTriviaToken"] = 6] = "LastTriviaToken"; + SyntaxKind[SyntaxKind["FirstLiteralToken"] = 7] = "FirstLiteralToken"; + SyntaxKind[SyntaxKind["LastLiteralToken"] = 10] = "LastLiteralToken"; + SyntaxKind[SyntaxKind["FirstTemplateToken"] = 10] = "FirstTemplateToken"; + SyntaxKind[SyntaxKind["LastTemplateToken"] = 13] = "LastTemplateToken"; + SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 24] = "FirstBinaryOperator"; + SyntaxKind[SyntaxKind["LastBinaryOperator"] = 63] = "LastBinaryOperator"; + SyntaxKind[SyntaxKind["FirstNode"] = 123] = "FirstNode"; + })(ts.SyntaxKind || (ts.SyntaxKind = {})); + var SyntaxKind = ts.SyntaxKind; + (function (NodeFlags) { + NodeFlags[NodeFlags["Export"] = 1] = "Export"; + NodeFlags[NodeFlags["Ambient"] = 2] = "Ambient"; + NodeFlags[NodeFlags["Public"] = 16] = "Public"; + NodeFlags[NodeFlags["Private"] = 32] = "Private"; + NodeFlags[NodeFlags["Protected"] = 64] = "Protected"; + NodeFlags[NodeFlags["Static"] = 128] = "Static"; + NodeFlags[NodeFlags["MultiLine"] = 256] = "MultiLine"; + NodeFlags[NodeFlags["Synthetic"] = 512] = "Synthetic"; + NodeFlags[NodeFlags["DeclarationFile"] = 1024] = "DeclarationFile"; + NodeFlags[NodeFlags["Let"] = 2048] = "Let"; + NodeFlags[NodeFlags["Const"] = 4096] = "Const"; + NodeFlags[NodeFlags["OctalLiteral"] = 8192] = "OctalLiteral"; + NodeFlags[NodeFlags["Modifier"] = 243] = "Modifier"; + NodeFlags[NodeFlags["AccessibilityModifier"] = 112] = "AccessibilityModifier"; + NodeFlags[NodeFlags["BlockScoped"] = 6144] = "BlockScoped"; + })(ts.NodeFlags || (ts.NodeFlags = {})); + var NodeFlags = ts.NodeFlags; + (function (ParserContextFlags) { + ParserContextFlags[ParserContextFlags["StrictMode"] = 1] = "StrictMode"; + ParserContextFlags[ParserContextFlags["DisallowIn"] = 2] = "DisallowIn"; + ParserContextFlags[ParserContextFlags["Yield"] = 4] = "Yield"; + ParserContextFlags[ParserContextFlags["GeneratorParameter"] = 8] = "GeneratorParameter"; + ParserContextFlags[ParserContextFlags["ThisNodeHasError"] = 16] = "ThisNodeHasError"; + ParserContextFlags[ParserContextFlags["ParserGeneratedFlags"] = 31] = "ParserGeneratedFlags"; + ParserContextFlags[ParserContextFlags["ThisNodeOrAnySubNodesHasError"] = 32] = "ThisNodeOrAnySubNodesHasError"; + ParserContextFlags[ParserContextFlags["HasAggregatedChildData"] = 64] = "HasAggregatedChildData"; + })(ts.ParserContextFlags || (ts.ParserContextFlags = {})); + var ParserContextFlags = ts.ParserContextFlags; + (function (RelationComparisonResult) { + RelationComparisonResult[RelationComparisonResult["Succeeded"] = 1] = "Succeeded"; + RelationComparisonResult[RelationComparisonResult["Failed"] = 2] = "Failed"; + RelationComparisonResult[RelationComparisonResult["FailedAndReported"] = 3] = "FailedAndReported"; + })(ts.RelationComparisonResult || (ts.RelationComparisonResult = {})); + var RelationComparisonResult = ts.RelationComparisonResult; + (function (ExitStatus) { + ExitStatus[ExitStatus["Success"] = 0] = "Success"; + ExitStatus[ExitStatus["DiagnosticsPresent_OutputsSkipped"] = 1] = "DiagnosticsPresent_OutputsSkipped"; + ExitStatus[ExitStatus["DiagnosticsPresent_OutputsGenerated"] = 2] = "DiagnosticsPresent_OutputsGenerated"; + })(ts.ExitStatus || (ts.ExitStatus = {})); + var ExitStatus = ts.ExitStatus; + (function (TypeFormatFlags) { + TypeFormatFlags[TypeFormatFlags["None"] = 0] = "None"; + TypeFormatFlags[TypeFormatFlags["WriteArrayAsGenericType"] = 1] = "WriteArrayAsGenericType"; + TypeFormatFlags[TypeFormatFlags["UseTypeOfFunction"] = 2] = "UseTypeOfFunction"; + TypeFormatFlags[TypeFormatFlags["NoTruncation"] = 4] = "NoTruncation"; + TypeFormatFlags[TypeFormatFlags["WriteArrowStyleSignature"] = 8] = "WriteArrowStyleSignature"; + TypeFormatFlags[TypeFormatFlags["WriteOwnNameForAnyLike"] = 16] = "WriteOwnNameForAnyLike"; + TypeFormatFlags[TypeFormatFlags["WriteTypeArgumentsOfSignature"] = 32] = "WriteTypeArgumentsOfSignature"; + TypeFormatFlags[TypeFormatFlags["InElementType"] = 64] = "InElementType"; + TypeFormatFlags[TypeFormatFlags["UseFullyQualifiedType"] = 128] = "UseFullyQualifiedType"; + })(ts.TypeFormatFlags || (ts.TypeFormatFlags = {})); + var TypeFormatFlags = ts.TypeFormatFlags; + (function (SymbolFormatFlags) { + SymbolFormatFlags[SymbolFormatFlags["None"] = 0] = "None"; + SymbolFormatFlags[SymbolFormatFlags["WriteTypeParametersOrArguments"] = 1] = "WriteTypeParametersOrArguments"; + SymbolFormatFlags[SymbolFormatFlags["UseOnlyExternalAliasing"] = 2] = "UseOnlyExternalAliasing"; + })(ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {})); + var SymbolFormatFlags = ts.SymbolFormatFlags; + (function (SymbolAccessibility) { + SymbolAccessibility[SymbolAccessibility["Accessible"] = 0] = "Accessible"; + SymbolAccessibility[SymbolAccessibility["NotAccessible"] = 1] = "NotAccessible"; + SymbolAccessibility[SymbolAccessibility["CannotBeNamed"] = 2] = "CannotBeNamed"; + })(ts.SymbolAccessibility || (ts.SymbolAccessibility = {})); + var SymbolAccessibility = ts.SymbolAccessibility; + (function (SymbolFlags) { + SymbolFlags[SymbolFlags["FunctionScopedVariable"] = 1] = "FunctionScopedVariable"; + SymbolFlags[SymbolFlags["BlockScopedVariable"] = 2] = "BlockScopedVariable"; + SymbolFlags[SymbolFlags["Property"] = 4] = "Property"; + SymbolFlags[SymbolFlags["EnumMember"] = 8] = "EnumMember"; + SymbolFlags[SymbolFlags["Function"] = 16] = "Function"; + SymbolFlags[SymbolFlags["Class"] = 32] = "Class"; + SymbolFlags[SymbolFlags["Interface"] = 64] = "Interface"; + SymbolFlags[SymbolFlags["ConstEnum"] = 128] = "ConstEnum"; + SymbolFlags[SymbolFlags["RegularEnum"] = 256] = "RegularEnum"; + SymbolFlags[SymbolFlags["ValueModule"] = 512] = "ValueModule"; + SymbolFlags[SymbolFlags["NamespaceModule"] = 1024] = "NamespaceModule"; + SymbolFlags[SymbolFlags["TypeLiteral"] = 2048] = "TypeLiteral"; + SymbolFlags[SymbolFlags["ObjectLiteral"] = 4096] = "ObjectLiteral"; + SymbolFlags[SymbolFlags["Method"] = 8192] = "Method"; + SymbolFlags[SymbolFlags["Constructor"] = 16384] = "Constructor"; + SymbolFlags[SymbolFlags["GetAccessor"] = 32768] = "GetAccessor"; + SymbolFlags[SymbolFlags["SetAccessor"] = 65536] = "SetAccessor"; + SymbolFlags[SymbolFlags["Signature"] = 131072] = "Signature"; + SymbolFlags[SymbolFlags["TypeParameter"] = 262144] = "TypeParameter"; + SymbolFlags[SymbolFlags["TypeAlias"] = 524288] = "TypeAlias"; + SymbolFlags[SymbolFlags["ExportValue"] = 1048576] = "ExportValue"; + SymbolFlags[SymbolFlags["ExportType"] = 2097152] = "ExportType"; + SymbolFlags[SymbolFlags["ExportNamespace"] = 4194304] = "ExportNamespace"; + SymbolFlags[SymbolFlags["Import"] = 8388608] = "Import"; + SymbolFlags[SymbolFlags["Instantiated"] = 16777216] = "Instantiated"; + SymbolFlags[SymbolFlags["Merged"] = 33554432] = "Merged"; + SymbolFlags[SymbolFlags["Transient"] = 67108864] = "Transient"; + SymbolFlags[SymbolFlags["Prototype"] = 134217728] = "Prototype"; + SymbolFlags[SymbolFlags["UnionProperty"] = 268435456] = "UnionProperty"; + SymbolFlags[SymbolFlags["Optional"] = 536870912] = "Optional"; + SymbolFlags[SymbolFlags["Enum"] = 384] = "Enum"; + SymbolFlags[SymbolFlags["Variable"] = 3] = "Variable"; + SymbolFlags[SymbolFlags["Value"] = 107455] = "Value"; + SymbolFlags[SymbolFlags["Type"] = 793056] = "Type"; + SymbolFlags[SymbolFlags["Namespace"] = 1536] = "Namespace"; + SymbolFlags[SymbolFlags["Module"] = 1536] = "Module"; + SymbolFlags[SymbolFlags["Accessor"] = 98304] = "Accessor"; + SymbolFlags[SymbolFlags["FunctionScopedVariableExcludes"] = 107454] = "FunctionScopedVariableExcludes"; + SymbolFlags[SymbolFlags["BlockScopedVariableExcludes"] = 107455] = "BlockScopedVariableExcludes"; + SymbolFlags[SymbolFlags["ParameterExcludes"] = 107455] = "ParameterExcludes"; + SymbolFlags[SymbolFlags["PropertyExcludes"] = 107455] = "PropertyExcludes"; + SymbolFlags[SymbolFlags["EnumMemberExcludes"] = 107455] = "EnumMemberExcludes"; + SymbolFlags[SymbolFlags["FunctionExcludes"] = 106927] = "FunctionExcludes"; + SymbolFlags[SymbolFlags["ClassExcludes"] = 899583] = "ClassExcludes"; + SymbolFlags[SymbolFlags["InterfaceExcludes"] = 792992] = "InterfaceExcludes"; + SymbolFlags[SymbolFlags["RegularEnumExcludes"] = 899327] = "RegularEnumExcludes"; + SymbolFlags[SymbolFlags["ConstEnumExcludes"] = 899967] = "ConstEnumExcludes"; + SymbolFlags[SymbolFlags["ValueModuleExcludes"] = 106639] = "ValueModuleExcludes"; + SymbolFlags[SymbolFlags["NamespaceModuleExcludes"] = 0] = "NamespaceModuleExcludes"; + SymbolFlags[SymbolFlags["MethodExcludes"] = 99263] = "MethodExcludes"; + SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 41919] = "GetAccessorExcludes"; + SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 74687] = "SetAccessorExcludes"; + SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 530912] = "TypeParameterExcludes"; + SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 793056] = "TypeAliasExcludes"; + SymbolFlags[SymbolFlags["ImportExcludes"] = 8388608] = "ImportExcludes"; + SymbolFlags[SymbolFlags["ModuleMember"] = 8914931] = "ModuleMember"; + SymbolFlags[SymbolFlags["ExportHasLocal"] = 944] = "ExportHasLocal"; + SymbolFlags[SymbolFlags["HasLocals"] = 255504] = "HasLocals"; + SymbolFlags[SymbolFlags["HasExports"] = 1952] = "HasExports"; + SymbolFlags[SymbolFlags["HasMembers"] = 6240] = "HasMembers"; + SymbolFlags[SymbolFlags["IsContainer"] = 262128] = "IsContainer"; + SymbolFlags[SymbolFlags["PropertyOrAccessor"] = 98308] = "PropertyOrAccessor"; + SymbolFlags[SymbolFlags["Export"] = 7340032] = "Export"; + })(ts.SymbolFlags || (ts.SymbolFlags = {})); + var SymbolFlags = ts.SymbolFlags; + (function (NodeCheckFlags) { + NodeCheckFlags[NodeCheckFlags["TypeChecked"] = 1] = "TypeChecked"; + NodeCheckFlags[NodeCheckFlags["LexicalThis"] = 2] = "LexicalThis"; + NodeCheckFlags[NodeCheckFlags["CaptureThis"] = 4] = "CaptureThis"; + NodeCheckFlags[NodeCheckFlags["EmitExtends"] = 8] = "EmitExtends"; + NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 16] = "SuperInstance"; + NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 32] = "SuperStatic"; + NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 64] = "ContextChecked"; + NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 128] = "EnumValuesComputed"; + })(ts.NodeCheckFlags || (ts.NodeCheckFlags = {})); + var NodeCheckFlags = ts.NodeCheckFlags; + (function (TypeFlags) { + TypeFlags[TypeFlags["Any"] = 1] = "Any"; + TypeFlags[TypeFlags["String"] = 2] = "String"; + TypeFlags[TypeFlags["Number"] = 4] = "Number"; + TypeFlags[TypeFlags["Boolean"] = 8] = "Boolean"; + TypeFlags[TypeFlags["Void"] = 16] = "Void"; + TypeFlags[TypeFlags["Undefined"] = 32] = "Undefined"; + TypeFlags[TypeFlags["Null"] = 64] = "Null"; + TypeFlags[TypeFlags["Enum"] = 128] = "Enum"; + TypeFlags[TypeFlags["StringLiteral"] = 256] = "StringLiteral"; + TypeFlags[TypeFlags["TypeParameter"] = 512] = "TypeParameter"; + TypeFlags[TypeFlags["Class"] = 1024] = "Class"; + TypeFlags[TypeFlags["Interface"] = 2048] = "Interface"; + TypeFlags[TypeFlags["Reference"] = 4096] = "Reference"; + TypeFlags[TypeFlags["Tuple"] = 8192] = "Tuple"; + TypeFlags[TypeFlags["Union"] = 16384] = "Union"; + TypeFlags[TypeFlags["Anonymous"] = 32768] = "Anonymous"; + TypeFlags[TypeFlags["FromSignature"] = 65536] = "FromSignature"; + TypeFlags[TypeFlags["ObjectLiteral"] = 131072] = "ObjectLiteral"; + TypeFlags[TypeFlags["ContainsUndefinedOrNull"] = 262144] = "ContainsUndefinedOrNull"; + TypeFlags[TypeFlags["ContainsObjectLiteral"] = 524288] = "ContainsObjectLiteral"; + TypeFlags[TypeFlags["ESSymbol"] = 1048576] = "ESSymbol"; + TypeFlags[TypeFlags["Intrinsic"] = 1048703] = "Intrinsic"; + TypeFlags[TypeFlags["Primitive"] = 1049086] = "Primitive"; + TypeFlags[TypeFlags["StringLike"] = 258] = "StringLike"; + TypeFlags[TypeFlags["NumberLike"] = 132] = "NumberLike"; + TypeFlags[TypeFlags["ObjectType"] = 48128] = "ObjectType"; + TypeFlags[TypeFlags["RequiresWidening"] = 786432] = "RequiresWidening"; + })(ts.TypeFlags || (ts.TypeFlags = {})); + var TypeFlags = ts.TypeFlags; + (function (SignatureKind) { + SignatureKind[SignatureKind["Call"] = 0] = "Call"; + SignatureKind[SignatureKind["Construct"] = 1] = "Construct"; + })(ts.SignatureKind || (ts.SignatureKind = {})); + var SignatureKind = ts.SignatureKind; + (function (IndexKind) { + IndexKind[IndexKind["String"] = 0] = "String"; + IndexKind[IndexKind["Number"] = 1] = "Number"; + })(ts.IndexKind || (ts.IndexKind = {})); + var IndexKind = ts.IndexKind; + (function (DiagnosticCategory) { + DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning"; + DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error"; + DiagnosticCategory[DiagnosticCategory["Message"] = 2] = "Message"; + })(ts.DiagnosticCategory || (ts.DiagnosticCategory = {})); + var DiagnosticCategory = ts.DiagnosticCategory; + (function (ModuleKind) { + ModuleKind[ModuleKind["None"] = 0] = "None"; + ModuleKind[ModuleKind["CommonJS"] = 1] = "CommonJS"; + ModuleKind[ModuleKind["AMD"] = 2] = "AMD"; + })(ts.ModuleKind || (ts.ModuleKind = {})); + var ModuleKind = ts.ModuleKind; + (function (ScriptTarget) { + ScriptTarget[ScriptTarget["ES3"] = 0] = "ES3"; + ScriptTarget[ScriptTarget["ES5"] = 1] = "ES5"; + ScriptTarget[ScriptTarget["ES6"] = 2] = "ES6"; + ScriptTarget[ScriptTarget["Latest"] = 2] = "Latest"; + })(ts.ScriptTarget || (ts.ScriptTarget = {})); + var ScriptTarget = ts.ScriptTarget; + (function (CharacterCodes) { + CharacterCodes[CharacterCodes["nullCharacter"] = 0] = "nullCharacter"; + CharacterCodes[CharacterCodes["maxAsciiCharacter"] = 127] = "maxAsciiCharacter"; + CharacterCodes[CharacterCodes["lineFeed"] = 10] = "lineFeed"; + CharacterCodes[CharacterCodes["carriageReturn"] = 13] = "carriageReturn"; + CharacterCodes[CharacterCodes["lineSeparator"] = 8232] = "lineSeparator"; + CharacterCodes[CharacterCodes["paragraphSeparator"] = 8233] = "paragraphSeparator"; + CharacterCodes[CharacterCodes["nextLine"] = 133] = "nextLine"; + CharacterCodes[CharacterCodes["space"] = 32] = "space"; + CharacterCodes[CharacterCodes["nonBreakingSpace"] = 160] = "nonBreakingSpace"; + CharacterCodes[CharacterCodes["enQuad"] = 8192] = "enQuad"; + CharacterCodes[CharacterCodes["emQuad"] = 8193] = "emQuad"; + CharacterCodes[CharacterCodes["enSpace"] = 8194] = "enSpace"; + CharacterCodes[CharacterCodes["emSpace"] = 8195] = "emSpace"; + CharacterCodes[CharacterCodes["threePerEmSpace"] = 8196] = "threePerEmSpace"; + CharacterCodes[CharacterCodes["fourPerEmSpace"] = 8197] = "fourPerEmSpace"; + CharacterCodes[CharacterCodes["sixPerEmSpace"] = 8198] = "sixPerEmSpace"; + CharacterCodes[CharacterCodes["figureSpace"] = 8199] = "figureSpace"; + CharacterCodes[CharacterCodes["punctuationSpace"] = 8200] = "punctuationSpace"; + CharacterCodes[CharacterCodes["thinSpace"] = 8201] = "thinSpace"; + CharacterCodes[CharacterCodes["hairSpace"] = 8202] = "hairSpace"; + CharacterCodes[CharacterCodes["zeroWidthSpace"] = 8203] = "zeroWidthSpace"; + CharacterCodes[CharacterCodes["narrowNoBreakSpace"] = 8239] = "narrowNoBreakSpace"; + CharacterCodes[CharacterCodes["ideographicSpace"] = 12288] = "ideographicSpace"; + CharacterCodes[CharacterCodes["mathematicalSpace"] = 8287] = "mathematicalSpace"; + CharacterCodes[CharacterCodes["ogham"] = 5760] = "ogham"; + CharacterCodes[CharacterCodes["_"] = 95] = "_"; + CharacterCodes[CharacterCodes["$"] = 36] = "$"; + CharacterCodes[CharacterCodes["_0"] = 48] = "_0"; + CharacterCodes[CharacterCodes["_1"] = 49] = "_1"; + CharacterCodes[CharacterCodes["_2"] = 50] = "_2"; + CharacterCodes[CharacterCodes["_3"] = 51] = "_3"; + CharacterCodes[CharacterCodes["_4"] = 52] = "_4"; + CharacterCodes[CharacterCodes["_5"] = 53] = "_5"; + CharacterCodes[CharacterCodes["_6"] = 54] = "_6"; + CharacterCodes[CharacterCodes["_7"] = 55] = "_7"; + CharacterCodes[CharacterCodes["_8"] = 56] = "_8"; + CharacterCodes[CharacterCodes["_9"] = 57] = "_9"; + CharacterCodes[CharacterCodes["a"] = 97] = "a"; + CharacterCodes[CharacterCodes["b"] = 98] = "b"; + CharacterCodes[CharacterCodes["c"] = 99] = "c"; + CharacterCodes[CharacterCodes["d"] = 100] = "d"; + CharacterCodes[CharacterCodes["e"] = 101] = "e"; + CharacterCodes[CharacterCodes["f"] = 102] = "f"; + CharacterCodes[CharacterCodes["g"] = 103] = "g"; + CharacterCodes[CharacterCodes["h"] = 104] = "h"; + CharacterCodes[CharacterCodes["i"] = 105] = "i"; + CharacterCodes[CharacterCodes["j"] = 106] = "j"; + CharacterCodes[CharacterCodes["k"] = 107] = "k"; + CharacterCodes[CharacterCodes["l"] = 108] = "l"; + CharacterCodes[CharacterCodes["m"] = 109] = "m"; + CharacterCodes[CharacterCodes["n"] = 110] = "n"; + CharacterCodes[CharacterCodes["o"] = 111] = "o"; + CharacterCodes[CharacterCodes["p"] = 112] = "p"; + CharacterCodes[CharacterCodes["q"] = 113] = "q"; + CharacterCodes[CharacterCodes["r"] = 114] = "r"; + CharacterCodes[CharacterCodes["s"] = 115] = "s"; + CharacterCodes[CharacterCodes["t"] = 116] = "t"; + CharacterCodes[CharacterCodes["u"] = 117] = "u"; + CharacterCodes[CharacterCodes["v"] = 118] = "v"; + CharacterCodes[CharacterCodes["w"] = 119] = "w"; + CharacterCodes[CharacterCodes["x"] = 120] = "x"; + CharacterCodes[CharacterCodes["y"] = 121] = "y"; + CharacterCodes[CharacterCodes["z"] = 122] = "z"; + CharacterCodes[CharacterCodes["A"] = 65] = "A"; + CharacterCodes[CharacterCodes["B"] = 66] = "B"; + CharacterCodes[CharacterCodes["C"] = 67] = "C"; + CharacterCodes[CharacterCodes["D"] = 68] = "D"; + CharacterCodes[CharacterCodes["E"] = 69] = "E"; + CharacterCodes[CharacterCodes["F"] = 70] = "F"; + CharacterCodes[CharacterCodes["G"] = 71] = "G"; + CharacterCodes[CharacterCodes["H"] = 72] = "H"; + CharacterCodes[CharacterCodes["I"] = 73] = "I"; + CharacterCodes[CharacterCodes["J"] = 74] = "J"; + CharacterCodes[CharacterCodes["K"] = 75] = "K"; + CharacterCodes[CharacterCodes["L"] = 76] = "L"; + CharacterCodes[CharacterCodes["M"] = 77] = "M"; + CharacterCodes[CharacterCodes["N"] = 78] = "N"; + CharacterCodes[CharacterCodes["O"] = 79] = "O"; + CharacterCodes[CharacterCodes["P"] = 80] = "P"; + CharacterCodes[CharacterCodes["Q"] = 81] = "Q"; + CharacterCodes[CharacterCodes["R"] = 82] = "R"; + CharacterCodes[CharacterCodes["S"] = 83] = "S"; + CharacterCodes[CharacterCodes["T"] = 84] = "T"; + CharacterCodes[CharacterCodes["U"] = 85] = "U"; + CharacterCodes[CharacterCodes["V"] = 86] = "V"; + CharacterCodes[CharacterCodes["W"] = 87] = "W"; + CharacterCodes[CharacterCodes["X"] = 88] = "X"; + CharacterCodes[CharacterCodes["Y"] = 89] = "Y"; + CharacterCodes[CharacterCodes["Z"] = 90] = "Z"; + CharacterCodes[CharacterCodes["ampersand"] = 38] = "ampersand"; + CharacterCodes[CharacterCodes["asterisk"] = 42] = "asterisk"; + CharacterCodes[CharacterCodes["at"] = 64] = "at"; + CharacterCodes[CharacterCodes["backslash"] = 92] = "backslash"; + CharacterCodes[CharacterCodes["backtick"] = 96] = "backtick"; + CharacterCodes[CharacterCodes["bar"] = 124] = "bar"; + CharacterCodes[CharacterCodes["caret"] = 94] = "caret"; + CharacterCodes[CharacterCodes["closeBrace"] = 125] = "closeBrace"; + CharacterCodes[CharacterCodes["closeBracket"] = 93] = "closeBracket"; + CharacterCodes[CharacterCodes["closeParen"] = 41] = "closeParen"; + CharacterCodes[CharacterCodes["colon"] = 58] = "colon"; + CharacterCodes[CharacterCodes["comma"] = 44] = "comma"; + CharacterCodes[CharacterCodes["dot"] = 46] = "dot"; + CharacterCodes[CharacterCodes["doubleQuote"] = 34] = "doubleQuote"; + CharacterCodes[CharacterCodes["equals"] = 61] = "equals"; + CharacterCodes[CharacterCodes["exclamation"] = 33] = "exclamation"; + CharacterCodes[CharacterCodes["greaterThan"] = 62] = "greaterThan"; + CharacterCodes[CharacterCodes["hash"] = 35] = "hash"; + CharacterCodes[CharacterCodes["lessThan"] = 60] = "lessThan"; + CharacterCodes[CharacterCodes["minus"] = 45] = "minus"; + CharacterCodes[CharacterCodes["openBrace"] = 123] = "openBrace"; + CharacterCodes[CharacterCodes["openBracket"] = 91] = "openBracket"; + CharacterCodes[CharacterCodes["openParen"] = 40] = "openParen"; + CharacterCodes[CharacterCodes["percent"] = 37] = "percent"; + CharacterCodes[CharacterCodes["plus"] = 43] = "plus"; + CharacterCodes[CharacterCodes["question"] = 63] = "question"; + CharacterCodes[CharacterCodes["semicolon"] = 59] = "semicolon"; + CharacterCodes[CharacterCodes["singleQuote"] = 39] = "singleQuote"; + CharacterCodes[CharacterCodes["slash"] = 47] = "slash"; + CharacterCodes[CharacterCodes["tilde"] = 126] = "tilde"; + CharacterCodes[CharacterCodes["backspace"] = 8] = "backspace"; + CharacterCodes[CharacterCodes["formFeed"] = 12] = "formFeed"; + CharacterCodes[CharacterCodes["byteOrderMark"] = 65279] = "byteOrderMark"; + CharacterCodes[CharacterCodes["tab"] = 9] = "tab"; + CharacterCodes[CharacterCodes["verticalTab"] = 11] = "verticalTab"; + })(ts.CharacterCodes || (ts.CharacterCodes = {})); + var CharacterCodes = ts.CharacterCodes; +})(ts || (ts = {})); +var ts; +(function (ts) { + (function (Ternary) { + Ternary[Ternary["False"] = 0] = "False"; + Ternary[Ternary["Maybe"] = 1] = "Maybe"; + Ternary[Ternary["True"] = -1] = "True"; + })(ts.Ternary || (ts.Ternary = {})); + var Ternary = ts.Ternary; + (function (Comparison) { + Comparison[Comparison["LessThan"] = -1] = "LessThan"; + Comparison[Comparison["EqualTo"] = 0] = "EqualTo"; + Comparison[Comparison["GreaterThan"] = 1] = "GreaterThan"; + })(ts.Comparison || (ts.Comparison = {})); + var Comparison = ts.Comparison; + function forEach(array, callback) { + if (array) { + for (var i = 0, len = array.length; i < len; i++) { + var result = callback(array[i], i); + if (result) { + return result; + } + } + } + return undefined; + } + ts.forEach = forEach; + function contains(array, value) { + if (array) { + for (var i = 0, len = array.length; i < len; i++) { + if (array[i] === value) { + return true; + } + } + } + return false; + } + ts.contains = contains; + function indexOf(array, value) { + if (array) { + for (var i = 0, len = array.length; i < len; i++) { + if (array[i] === value) { + return i; + } + } + } + return -1; + } + ts.indexOf = indexOf; + function countWhere(array, predicate) { + var count = 0; + if (array) { + for (var i = 0, len = array.length; i < len; i++) { + if (predicate(array[i])) { + count++; + } + } + } + return count; + } + ts.countWhere = countWhere; + function filter(array, f) { + if (array) { + var result = []; + for (var i = 0, len = array.length; i < len; i++) { + var item = array[i]; + if (f(item)) { + result.push(item); + } + } + } + return result; + } + ts.filter = filter; + function map(array, f) { + if (array) { + var result = []; + for (var i = 0, len = array.length; i < len; i++) { + result.push(f(array[i])); + } + } + return result; + } + ts.map = map; + function concatenate(array1, array2) { + if (!array2 || !array2.length) + return array1; + if (!array1 || !array1.length) + return array2; + return array1.concat(array2); + } + ts.concatenate = concatenate; + function deduplicate(array) { + if (array) { + var result = []; + for (var i = 0, len = array.length; i < len; i++) { + var item = array[i]; + if (!contains(result, item)) + result.push(item); + } + } + return result; + } + ts.deduplicate = deduplicate; + function sum(array, prop) { + var result = 0; + for (var i = 0; i < array.length; i++) { + result += array[i][prop]; + } + return result; + } + ts.sum = sum; + function addRange(to, from) { + for (var i = 0, n = from.length; i < n; i++) { + to.push(from[i]); + } + } + ts.addRange = addRange; + function lastOrUndefined(array) { + if (array.length === 0) { + return undefined; + } + return array[array.length - 1]; + } + ts.lastOrUndefined = lastOrUndefined; + function binarySearch(array, value) { + var low = 0; + var high = array.length - 1; + while (low <= high) { + var middle = low + ((high - low) >> 1); + var midValue = array[middle]; + if (midValue === value) { + return middle; + } + else if (midValue > value) { + high = middle - 1; + } + else { + low = middle + 1; + } + } + return ~low; + } + ts.binarySearch = binarySearch; + var hasOwnProperty = Object.prototype.hasOwnProperty; + function hasProperty(map, key) { + return hasOwnProperty.call(map, key); + } + ts.hasProperty = hasProperty; + function getProperty(map, key) { + return hasOwnProperty.call(map, key) ? map[key] : undefined; + } + ts.getProperty = getProperty; + function isEmpty(map) { + for (var id in map) { + if (hasProperty(map, id)) { + return false; + } + } + return true; + } + ts.isEmpty = isEmpty; + function clone(object) { + var result = {}; + for (var id in object) { + result[id] = object[id]; + } + return result; + } + ts.clone = clone; + function extend(first, second) { + var result = {}; + for (var id in first) { + result[id] = first[id]; + } + for (var id in second) { + if (!hasProperty(result, id)) { + result[id] = second[id]; + } + } + return result; + } + ts.extend = extend; + function forEachValue(map, callback) { + var result; + for (var id in map) { + if (result = callback(map[id])) + break; + } + return result; + } + ts.forEachValue = forEachValue; + function forEachKey(map, callback) { + var result; + for (var id in map) { + if (result = callback(id)) + break; + } + return result; + } + ts.forEachKey = forEachKey; + function lookUp(map, key) { + return hasProperty(map, key) ? map[key] : undefined; + } + ts.lookUp = lookUp; + function mapToArray(map) { + var result = []; + for (var id in map) { + result.push(map[id]); + } + return result; + } + ts.mapToArray = mapToArray; + function copyMap(source, target) { + for (var p in source) { + target[p] = source[p]; + } + } + ts.copyMap = copyMap; + function arrayToMap(array, makeKey) { + var result = {}; + forEach(array, function (value) { + result[makeKey(value)] = value; + }); + return result; + } + ts.arrayToMap = arrayToMap; + function formatStringFromArgs(text, args, baseIndex) { + baseIndex = baseIndex || 0; + return text.replace(/{(\d+)}/g, function (match, index) { return args[+index + baseIndex]; }); + } + ts.localizedDiagnosticMessages = undefined; + function getLocaleSpecificMessage(message) { + return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] ? ts.localizedDiagnosticMessages[message] : message; + } + ts.getLocaleSpecificMessage = getLocaleSpecificMessage; + function createFileDiagnostic(file, start, length, message) { + Debug.assert(start >= 0, "start must be non-negative, is " + start); + Debug.assert(length >= 0, "length must be non-negative, is " + length); + var text = getLocaleSpecificMessage(message.key); + if (arguments.length > 4) { + text = formatStringFromArgs(text, arguments, 4); + } + return { + file: file, + start: start, + length: length, + messageText: text, + category: message.category, + code: message.code + }; + } + ts.createFileDiagnostic = createFileDiagnostic; + function createCompilerDiagnostic(message) { + var text = getLocaleSpecificMessage(message.key); + if (arguments.length > 1) { + text = formatStringFromArgs(text, arguments, 1); + } + return { + file: undefined, + start: undefined, + length: undefined, + messageText: text, + category: message.category, + code: message.code + }; + } + ts.createCompilerDiagnostic = createCompilerDiagnostic; + function chainDiagnosticMessages(details, message) { + var text = getLocaleSpecificMessage(message.key); + if (arguments.length > 2) { + text = formatStringFromArgs(text, arguments, 2); + } + return { + messageText: text, + category: message.category, + code: message.code, + next: details + }; + } + ts.chainDiagnosticMessages = chainDiagnosticMessages; + function concatenateDiagnosticMessageChains(headChain, tailChain) { + Debug.assert(!headChain.next); + headChain.next = tailChain; + return headChain; + } + ts.concatenateDiagnosticMessageChains = concatenateDiagnosticMessageChains; + function compareValues(a, b) { + if (a === b) + return 0; + if (a === undefined) + return -1; + if (b === undefined) + return 1; + return a < b ? -1 : 1; + } + ts.compareValues = compareValues; + function getDiagnosticFileName(diagnostic) { + return diagnostic.file ? diagnostic.file.fileName : undefined; + } + function compareDiagnostics(d1, d2) { + return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || + compareValues(d1.start, d2.start) || + compareValues(d1.length, d2.length) || + compareValues(d1.code, d2.code) || + compareMessageText(d1.messageText, d2.messageText) || + 0; + } + ts.compareDiagnostics = compareDiagnostics; + function compareMessageText(text1, text2) { + while (text1 && text2) { + var string1 = typeof text1 === "string" ? text1 : text1.messageText; + var string2 = typeof text2 === "string" ? text2 : text2.messageText; + var res = compareValues(string1, string2); + if (res) { + return res; + } + text1 = typeof text1 === "string" ? undefined : text1.next; + text2 = typeof text2 === "string" ? undefined : text2.next; + } + if (!text1 && !text2) { + return 0; + } + return text1 ? 1 : -1; + } + function sortAndDeduplicateDiagnostics(diagnostics) { + return deduplicateSortedDiagnostics(diagnostics.sort(compareDiagnostics)); + } + ts.sortAndDeduplicateDiagnostics = sortAndDeduplicateDiagnostics; + function deduplicateSortedDiagnostics(diagnostics) { + if (diagnostics.length < 2) { + return diagnostics; + } + var newDiagnostics = [diagnostics[0]]; + var previousDiagnostic = diagnostics[0]; + for (var i = 1; i < diagnostics.length; i++) { + var currentDiagnostic = diagnostics[i]; + var isDupe = compareDiagnostics(currentDiagnostic, previousDiagnostic) === 0; + if (!isDupe) { + newDiagnostics.push(currentDiagnostic); + previousDiagnostic = currentDiagnostic; + } + } + return newDiagnostics; + } + ts.deduplicateSortedDiagnostics = deduplicateSortedDiagnostics; + function normalizeSlashes(path) { + return path.replace(/\\/g, "/"); + } + ts.normalizeSlashes = normalizeSlashes; + function getRootLength(path) { + if (path.charCodeAt(0) === 47) { + if (path.charCodeAt(1) !== 47) + return 1; + var p1 = path.indexOf("/", 2); + if (p1 < 0) + return 2; + var p2 = path.indexOf("/", p1 + 1); + if (p2 < 0) + return p1 + 1; + return p2 + 1; + } + if (path.charCodeAt(1) === 58) { + if (path.charCodeAt(2) === 47) + return 3; + return 2; + } + return 0; + } + ts.getRootLength = getRootLength; + ts.directorySeparator = "/"; + function getNormalizedParts(normalizedSlashedPath, rootLength) { + var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); + var normalized = []; + for (var i = 0; i < parts.length; i++) { + var part = parts[i]; + if (part !== ".") { + if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { + normalized.pop(); + } + else { + normalized.push(part); + } + } + } + return normalized; + } + function normalizePath(path) { + var path = normalizeSlashes(path); + var rootLength = getRootLength(path); + var normalized = getNormalizedParts(path, rootLength); + return path.substr(0, rootLength) + normalized.join(ts.directorySeparator); + } + ts.normalizePath = normalizePath; + function getDirectoryPath(path) { + return path.substr(0, Math.max(getRootLength(path), path.lastIndexOf(ts.directorySeparator))); + } + ts.getDirectoryPath = getDirectoryPath; + function isUrl(path) { + return path && !isRootedDiskPath(path) && path.indexOf("://") !== -1; + } + ts.isUrl = isUrl; + function isRootedDiskPath(path) { + return getRootLength(path) !== 0; + } + ts.isRootedDiskPath = isRootedDiskPath; + function normalizedPathComponents(path, rootLength) { + var normalizedParts = getNormalizedParts(path, rootLength); + return [path.substr(0, rootLength)].concat(normalizedParts); + } + function getNormalizedPathComponents(path, currentDirectory) { + var path = normalizeSlashes(path); + var rootLength = getRootLength(path); + if (rootLength == 0) { + path = combinePaths(normalizeSlashes(currentDirectory), path); + rootLength = getRootLength(path); + } + return normalizedPathComponents(path, rootLength); + } + ts.getNormalizedPathComponents = getNormalizedPathComponents; + function getNormalizedAbsolutePath(fileName, currentDirectory) { + return getNormalizedPathFromPathComponents(getNormalizedPathComponents(fileName, currentDirectory)); + } + ts.getNormalizedAbsolutePath = getNormalizedAbsolutePath; + function getNormalizedPathFromPathComponents(pathComponents) { + if (pathComponents && pathComponents.length) { + return pathComponents[0] + pathComponents.slice(1).join(ts.directorySeparator); + } + } + ts.getNormalizedPathFromPathComponents = getNormalizedPathFromPathComponents; + function getNormalizedPathComponentsOfUrl(url) { + var urlLength = url.length; + var rootLength = url.indexOf("://") + "://".length; + while (rootLength < urlLength) { + if (url.charCodeAt(rootLength) === 47) { + rootLength++; + } + else { + break; + } + } + if (rootLength === urlLength) { + return [url]; + } + var indexOfNextSlash = url.indexOf(ts.directorySeparator, rootLength); + if (indexOfNextSlash !== -1) { + rootLength = indexOfNextSlash + 1; + return normalizedPathComponents(url, rootLength); + } + else { + return [url + ts.directorySeparator]; + } + } + function getNormalizedPathOrUrlComponents(pathOrUrl, currentDirectory) { + if (isUrl(pathOrUrl)) { + return getNormalizedPathComponentsOfUrl(pathOrUrl); + } + else { + return getNormalizedPathComponents(pathOrUrl, currentDirectory); + } + } + function getRelativePathToDirectoryOrUrl(directoryPathOrUrl, relativeOrAbsolutePath, currentDirectory, getCanonicalFileName, isAbsolutePathAnUrl) { + var pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, currentDirectory); + var directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, currentDirectory); + if (directoryComponents.length > 1 && directoryComponents[directoryComponents.length - 1] === "") { + directoryComponents.length--; + } + for (var joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) { + if (getCanonicalFileName(directoryComponents[joinStartIndex]) !== getCanonicalFileName(pathComponents[joinStartIndex])) { + break; + } + } + if (joinStartIndex) { + var relativePath = ""; + var relativePathComponents = pathComponents.slice(joinStartIndex, pathComponents.length); + for (; joinStartIndex < directoryComponents.length; joinStartIndex++) { + if (directoryComponents[joinStartIndex] !== "") { + relativePath = relativePath + ".." + ts.directorySeparator; + } + } + return relativePath + relativePathComponents.join(ts.directorySeparator); + } + var absolutePath = getNormalizedPathFromPathComponents(pathComponents); + if (isAbsolutePathAnUrl && isRootedDiskPath(absolutePath)) { + absolutePath = "file:///" + absolutePath; + } + return absolutePath; + } + ts.getRelativePathToDirectoryOrUrl = getRelativePathToDirectoryOrUrl; + function getBaseFileName(path) { + var i = path.lastIndexOf(ts.directorySeparator); + return i < 0 ? path : path.substring(i + 1); + } + ts.getBaseFileName = getBaseFileName; + function combinePaths(path1, path2) { + if (!(path1 && path1.length)) + return path2; + if (!(path2 && path2.length)) + return path1; + if (getRootLength(path2) !== 0) + return path2; + if (path1.charAt(path1.length - 1) === ts.directorySeparator) + return path1 + path2; + return path1 + ts.directorySeparator + path2; + } + ts.combinePaths = combinePaths; + function fileExtensionIs(path, extension) { + var pathLen = path.length; + var extLen = extension.length; + return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; + } + ts.fileExtensionIs = fileExtensionIs; + var supportedExtensions = [".d.ts", ".ts", ".js"]; + function removeFileExtension(path) { + for (var i = 0; i < supportedExtensions.length; i++) { + var ext = supportedExtensions[i]; + if (fileExtensionIs(path, ext)) { + return path.substr(0, path.length - ext.length); + } + } + return path; + } + ts.removeFileExtension = removeFileExtension; + var backslashOrDoubleQuote = /[\"\\]/g; + var escapedCharsRegExp = /[\0-\19\t\v\f\b\0\r\n\u2028\u2029\u0085]/g; + var escapedCharsMap = { + "\0": "\\0", + "\t": "\\t", + "\v": "\\v", + "\f": "\\f", + "\b": "\\b", + "\r": "\\r", + "\n": "\\n", + "\\": "\\\\", + "\"": "\\\"", + "\u2028": "\\u2028", + "\u2029": "\\u2029", + "\u0085": "\\u0085" + }; + function escapeString(s) { + s = backslashOrDoubleQuote.test(s) ? s.replace(backslashOrDoubleQuote, getReplacement) : s; + s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s; + return s; + function getReplacement(c) { + return escapedCharsMap[c] || unicodeEscape(c); + } + function unicodeEscape(c) { + var hexCharCode = c.charCodeAt(0).toString(16); + var paddedHexCode = ("0000" + hexCharCode).slice(-4); + return "\\u" + paddedHexCode; + } + } + ts.escapeString = escapeString; + function getDefaultLibFileName(options) { + return options.target === 2 ? "lib.es6.d.ts" : "lib.d.ts"; + } + ts.getDefaultLibFileName = getDefaultLibFileName; + function Symbol(flags, name) { + this.flags = flags; + this.name = name; + this.declarations = undefined; + } + function Type(checker, flags) { + this.flags = flags; + } + function Signature(checker) { + } + ts.objectAllocator = { + getNodeConstructor: function (kind) { + function Node() { + } + Node.prototype = { + kind: kind, + pos: 0, + end: 0, + flags: 0, + parent: undefined + }; + return Node; + }, + getSymbolConstructor: function () { return Symbol; }, + getTypeConstructor: function () { return Type; }, + getSignatureConstructor: function () { return Signature; } + }; + (function (AssertionLevel) { + AssertionLevel[AssertionLevel["None"] = 0] = "None"; + AssertionLevel[AssertionLevel["Normal"] = 1] = "Normal"; + AssertionLevel[AssertionLevel["Aggressive"] = 2] = "Aggressive"; + AssertionLevel[AssertionLevel["VeryAggressive"] = 3] = "VeryAggressive"; + })(ts.AssertionLevel || (ts.AssertionLevel = {})); + var AssertionLevel = ts.AssertionLevel; + var Debug; + (function (Debug) { + var currentAssertionLevel = 0; + function shouldAssert(level) { + return currentAssertionLevel >= level; + } + Debug.shouldAssert = shouldAssert; + function assert(expression, message, verboseDebugInfo) { + if (!expression) { + var verboseDebugString = ""; + if (verboseDebugInfo) { + verboseDebugString = "\r\nVerbose Debug Information: " + verboseDebugInfo(); + } + throw new Error("Debug Failure. False expression: " + (message || "") + verboseDebugString); + } + } + Debug.assert = assert; + function fail(message) { + Debug.assert(false, message); + } + Debug.fail = fail; + })(Debug = ts.Debug || (ts.Debug = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.sys = (function () { + function getWScriptSystem() { + var fso = new ActiveXObject("Scripting.FileSystemObject"); + var fileStream = new ActiveXObject("ADODB.Stream"); + fileStream.Type = 2; + var binaryStream = new ActiveXObject("ADODB.Stream"); + binaryStream.Type = 1; + var args = []; + for (var i = 0; i < WScript.Arguments.length; i++) { + args[i] = WScript.Arguments.Item(i); + } + function readFile(fileName, encoding) { + if (!fso.FileExists(fileName)) { + return undefined; + } + fileStream.Open(); + try { + if (encoding) { + fileStream.Charset = encoding; + fileStream.LoadFromFile(fileName); + } + else { + fileStream.Charset = "x-ansi"; + fileStream.LoadFromFile(fileName); + var bom = fileStream.ReadText(2) || ""; + fileStream.Position = 0; + fileStream.Charset = bom.length >= 2 && (bom.charCodeAt(0) === 0xFF && bom.charCodeAt(1) === 0xFE || bom.charCodeAt(0) === 0xFE && bom.charCodeAt(1) === 0xFF) ? "unicode" : "utf-8"; + } + return fileStream.ReadText(); + } + catch (e) { + throw e; + } + finally { + fileStream.Close(); + } + } + function writeFile(fileName, data, writeByteOrderMark) { + fileStream.Open(); + binaryStream.Open(); + try { + fileStream.Charset = "utf-8"; + fileStream.WriteText(data); + if (writeByteOrderMark) { + fileStream.Position = 0; + } + else { + fileStream.Position = 3; + } + fileStream.CopyTo(binaryStream); + binaryStream.SaveToFile(fileName, 2); + } + finally { + binaryStream.Close(); + fileStream.Close(); + } + } + function getNames(collection) { + var result = []; + for (var e = new Enumerator(collection); !e.atEnd(); e.moveNext()) { + result.push(e.item().Name); + } + return result.sort(); + } + function readDirectory(path, extension) { + var result = []; + visitDirectory(path); + return result; + function visitDirectory(path) { + var folder = fso.GetFolder(path || "."); + var files = getNames(folder.files); + for (var i = 0; i < files.length; i++) { + var name = files[i]; + if (!extension || ts.fileExtensionIs(name, extension)) { + result.push(ts.combinePaths(path, name)); + } + } + var subfolders = getNames(folder.subfolders); + for (var i = 0; i < subfolders.length; i++) { + visitDirectory(ts.combinePaths(path, subfolders[i])); + } + } + } + return { + args: args, + newLine: "\r\n", + useCaseSensitiveFileNames: false, + write: function (s) { + WScript.StdOut.Write(s); + }, + readFile: readFile, + writeFile: writeFile, + resolvePath: function (path) { + return fso.GetAbsolutePathName(path); + }, + fileExists: function (path) { + return fso.FileExists(path); + }, + directoryExists: function (path) { + return fso.FolderExists(path); + }, + createDirectory: function (directoryName) { + if (!this.directoryExists(directoryName)) { + fso.CreateFolder(directoryName); + } + }, + getExecutingFilePath: function () { + return WScript.ScriptFullName; + }, + getCurrentDirectory: function () { + return new ActiveXObject("WScript.Shell").CurrentDirectory; + }, + readDirectory: readDirectory, + exit: function (exitCode) { + try { + WScript.Quit(exitCode); + } + catch (e) { + } + } + }; + } + function getNodeSystem() { + var _fs = require("fs"); + var _path = require("path"); + var _os = require('os'); + var platform = _os.platform(); + var useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin"; + function readFile(fileName, encoding) { + if (!_fs.existsSync(fileName)) { + return undefined; + } + var buffer = _fs.readFileSync(fileName); + var len = buffer.length; + if (len >= 2 && buffer[0] === 0xFE && buffer[1] === 0xFF) { + len &= ~1; + for (var i = 0; i < len; i += 2) { + var temp = buffer[i]; + buffer[i] = buffer[i + 1]; + buffer[i + 1] = temp; + } + return buffer.toString("utf16le", 2); + } + if (len >= 2 && buffer[0] === 0xFF && buffer[1] === 0xFE) { + return buffer.toString("utf16le", 2); + } + if (len >= 3 && buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) { + return buffer.toString("utf8", 3); + } + return buffer.toString("utf8"); + } + function writeFile(fileName, data, writeByteOrderMark) { + if (writeByteOrderMark) { + data = '\uFEFF' + data; + } + _fs.writeFileSync(fileName, data, "utf8"); + } + function readDirectory(path, extension) { + var result = []; + visitDirectory(path); + return result; + function visitDirectory(path) { + var files = _fs.readdirSync(path || ".").sort(); + var directories = []; + for (var i = 0; i < files.length; i++) { + var name = ts.combinePaths(path, files[i]); + var stat = _fs.lstatSync(name); + if (stat.isFile()) { + if (!extension || ts.fileExtensionIs(name, extension)) { + result.push(name); + } + } + else if (stat.isDirectory()) { + directories.push(name); + } + } + for (var i = 0; i < directories.length; i++) { + visitDirectory(directories[i]); + } + } + } + return { + args: process.argv.slice(2), + newLine: _os.EOL, + useCaseSensitiveFileNames: useCaseSensitiveFileNames, + write: function (s) { + _fs.writeSync(1, s); + }, + readFile: readFile, + writeFile: writeFile, + watchFile: function (fileName, callback) { + _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); + return { + close: function () { _fs.unwatchFile(fileName, fileChanged); } + }; + function fileChanged(curr, prev) { + if (+curr.mtime <= +prev.mtime) { + return; + } + callback(fileName); + } + ; + }, + resolvePath: function (path) { + return _path.resolve(path); + }, + fileExists: function (path) { + return _fs.existsSync(path); + }, + directoryExists: function (path) { + return _fs.existsSync(path) && _fs.statSync(path).isDirectory(); + }, + createDirectory: function (directoryName) { + if (!this.directoryExists(directoryName)) { + _fs.mkdirSync(directoryName); + } + }, + getExecutingFilePath: function () { + return __filename; + }, + getCurrentDirectory: function () { + return process.cwd(); + }, + readDirectory: readDirectory, + getMemoryUsage: function () { + if (global.gc) { + global.gc(); + } + return process.memoryUsage().heapUsed; + }, + exit: function (exitCode) { + process.exit(exitCode); + } + }; + } + if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { + return getWScriptSystem(); + } + else if (typeof module !== "undefined" && module.exports) { + return getNodeSystem(); + } + else { + return undefined; + } + })(); +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.Diagnostics = { + Unterminated_string_literal: { code: 1002, category: 1, key: "Unterminated string literal." }, + Identifier_expected: { code: 1003, category: 1, key: "Identifier expected." }, + _0_expected: { code: 1005, category: 1, key: "'{0}' expected." }, + A_file_cannot_have_a_reference_to_itself: { code: 1006, category: 1, key: "A file cannot have a reference to itself." }, + Trailing_comma_not_allowed: { code: 1009, category: 1, key: "Trailing comma not allowed." }, + Asterisk_Slash_expected: { code: 1010, category: 1, key: "'*/' expected." }, + Unexpected_token: { code: 1012, category: 1, key: "Unexpected token." }, + Catch_clause_parameter_cannot_have_a_type_annotation: { code: 1013, category: 1, key: "Catch clause parameter cannot have a type annotation." }, + A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: 1, key: "A rest parameter must be last in a parameter list." }, + Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: 1, key: "Parameter cannot have question mark and initializer." }, + A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: 1, key: "A required parameter cannot follow an optional parameter." }, + An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: 1, key: "An index signature cannot have a rest parameter." }, + An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: 1, key: "An index signature parameter cannot have an accessibility modifier." }, + An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: 1, key: "An index signature parameter cannot have a question mark." }, + An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: 1, key: "An index signature parameter cannot have an initializer." }, + An_index_signature_must_have_a_type_annotation: { code: 1021, category: 1, key: "An index signature must have a type annotation." }, + An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: 1, key: "An index signature parameter must have a type annotation." }, + An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: 1, key: "An index signature parameter type must be 'string' or 'number'." }, + A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: 1, key: "A class or interface declaration can only have one 'extends' clause." }, + An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: 1, key: "An 'extends' clause must precede an 'implements' clause." }, + A_class_can_only_extend_a_single_class: { code: 1026, category: 1, key: "A class can only extend a single class." }, + A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: 1, key: "A class declaration can only have one 'implements' clause." }, + Accessibility_modifier_already_seen: { code: 1028, category: 1, key: "Accessibility modifier already seen." }, + _0_modifier_must_precede_1_modifier: { code: 1029, category: 1, key: "'{0}' modifier must precede '{1}' modifier." }, + _0_modifier_already_seen: { code: 1030, category: 1, key: "'{0}' modifier already seen." }, + _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: 1, key: "'{0}' modifier cannot appear on a class element." }, + An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: 1, key: "An interface declaration cannot have an 'implements' clause." }, + super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: 1, key: "'super' must be followed by an argument list or member access." }, + Only_ambient_modules_can_use_quoted_names: { code: 1035, category: 1, key: "Only ambient modules can use quoted names." }, + Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: 1, key: "Statements are not allowed in ambient contexts." }, + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: 1, key: "A 'declare' modifier cannot be used in an already ambient context." }, + Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: 1, key: "Initializers are not allowed in ambient contexts." }, + _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: 1, key: "'{0}' modifier cannot appear on a module element." }, + A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: 1, key: "A 'declare' modifier cannot be used with an interface declaration." }, + A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: 1, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, + A_rest_parameter_cannot_be_optional: { code: 1047, category: 1, key: "A rest parameter cannot be optional." }, + A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: 1, key: "A rest parameter cannot have an initializer." }, + A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: 1, key: "A 'set' accessor must have exactly one parameter." }, + A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: 1, key: "A 'set' accessor cannot have an optional parameter." }, + A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: 1, key: "A 'set' accessor parameter cannot have an initializer." }, + A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: 1, key: "A 'set' accessor cannot have rest parameter." }, + A_get_accessor_cannot_have_parameters: { code: 1054, category: 1, key: "A 'get' accessor cannot have parameters." }, + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: 1, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, + Enum_member_must_have_initializer: { code: 1061, category: 1, key: "Enum member must have initializer." }, + An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: 1, key: "An export assignment cannot be used in an internal module." }, + Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: 1, key: "Ambient enum elements can only have integer literal initializers." }, + Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: 1, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, + A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: 1, key: "A 'declare' modifier cannot be used with an import declaration." }, + Invalid_reference_directive_syntax: { code: 1084, category: 1, key: "Invalid 'reference' directive syntax." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: 1, key: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: 1, key: "An accessor cannot be declared in an ambient context." }, + _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: 1, key: "'{0}' modifier cannot appear on a constructor declaration." }, + _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: 1, key: "'{0}' modifier cannot appear on a parameter." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: 1, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, + Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: 1, key: "Type parameters cannot appear on a constructor declaration." }, + Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: 1, key: "Type annotation cannot appear on a constructor declaration." }, + An_accessor_cannot_have_type_parameters: { code: 1094, category: 1, key: "An accessor cannot have type parameters." }, + A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: 1, key: "A 'set' accessor cannot have a return type annotation." }, + An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: 1, key: "An index signature must have exactly one parameter." }, + _0_list_cannot_be_empty: { code: 1097, category: 1, key: "'{0}' list cannot be empty." }, + Type_parameter_list_cannot_be_empty: { code: 1098, category: 1, key: "Type parameter list cannot be empty." }, + Type_argument_list_cannot_be_empty: { code: 1099, category: 1, key: "Type argument list cannot be empty." }, + Invalid_use_of_0_in_strict_mode: { code: 1100, category: 1, key: "Invalid use of '{0}' in strict mode." }, + with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: 1, key: "'with' statements are not allowed in strict mode." }, + delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: 1, key: "'delete' cannot be called on an identifier in strict mode." }, + A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: 1, key: "A 'continue' statement can only be used within an enclosing iteration statement." }, + A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: 1, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, + Jump_target_cannot_cross_function_boundary: { code: 1107, category: 1, key: "Jump target cannot cross function boundary." }, + A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: 1, key: "A 'return' statement can only be used within a function body." }, + Expression_expected: { code: 1109, category: 1, key: "Expression expected." }, + Type_expected: { code: 1110, category: 1, key: "Type expected." }, + A_class_member_cannot_be_declared_optional: { code: 1112, category: 1, key: "A class member cannot be declared optional." }, + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: 1, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, + Duplicate_label_0: { code: 1114, category: 1, key: "Duplicate label '{0}'" }, + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: 1, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, + A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: 1, key: "A 'break' statement can only jump to a label of an enclosing statement." }, + An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: 1, key: "An object literal cannot have multiple properties with the same name in strict mode." }, + An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: 1, key: "An object literal cannot have multiple get/set accessors with the same name." }, + An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: 1, key: "An object literal cannot have property and accessor with the same name." }, + An_export_assignment_cannot_have_modifiers: { code: 1120, category: 1, key: "An export assignment cannot have modifiers." }, + Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: 1, key: "Octal literals are not allowed in strict mode." }, + A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: 1, key: "A tuple type element list cannot be empty." }, + Variable_declaration_list_cannot_be_empty: { code: 1123, category: 1, key: "Variable declaration list cannot be empty." }, + Digit_expected: { code: 1124, category: 1, key: "Digit expected." }, + Hexadecimal_digit_expected: { code: 1125, category: 1, key: "Hexadecimal digit expected." }, + Unexpected_end_of_text: { code: 1126, category: 1, key: "Unexpected end of text." }, + Invalid_character: { code: 1127, category: 1, key: "Invalid character." }, + Declaration_or_statement_expected: { code: 1128, category: 1, key: "Declaration or statement expected." }, + Statement_expected: { code: 1129, category: 1, key: "Statement expected." }, + case_or_default_expected: { code: 1130, category: 1, key: "'case' or 'default' expected." }, + Property_or_signature_expected: { code: 1131, category: 1, key: "Property or signature expected." }, + Enum_member_expected: { code: 1132, category: 1, key: "Enum member expected." }, + Type_reference_expected: { code: 1133, category: 1, key: "Type reference expected." }, + Variable_declaration_expected: { code: 1134, category: 1, key: "Variable declaration expected." }, + Argument_expression_expected: { code: 1135, category: 1, key: "Argument expression expected." }, + Property_assignment_expected: { code: 1136, category: 1, key: "Property assignment expected." }, + Expression_or_comma_expected: { code: 1137, category: 1, key: "Expression or comma expected." }, + Parameter_declaration_expected: { code: 1138, category: 1, key: "Parameter declaration expected." }, + Type_parameter_declaration_expected: { code: 1139, category: 1, key: "Type parameter declaration expected." }, + Type_argument_expected: { code: 1140, category: 1, key: "Type argument expected." }, + String_literal_expected: { code: 1141, category: 1, key: "String literal expected." }, + Line_break_not_permitted_here: { code: 1142, category: 1, key: "Line break not permitted here." }, + or_expected: { code: 1144, category: 1, key: "'{' or ';' expected." }, + Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: 1, key: "Modifiers not permitted on index signature members." }, + Declaration_expected: { code: 1146, category: 1, key: "Declaration expected." }, + Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: 1, key: "Import declarations in an internal module cannot reference an external module." }, + Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: 1, key: "Cannot compile external modules unless the '--module' flag is provided." }, + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: 1, key: "File name '{0}' differs from already included file name '{1}' only in casing" }, + new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: 1, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, + var_let_or_const_expected: { code: 1152, category: 1, key: "'var', 'let' or 'const' expected." }, + let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: 1, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." }, + const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: 1, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." }, + const_declarations_must_be_initialized: { code: 1155, category: 1, key: "'const' declarations must be initialized" }, + const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: 1, key: "'const' declarations can only be declared inside a block." }, + let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: 1, key: "'let' declarations can only be declared inside a block." }, + Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: 1, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." }, + Unterminated_template_literal: { code: 1160, category: 1, key: "Unterminated template literal." }, + Unterminated_regular_expression_literal: { code: 1161, category: 1, key: "Unterminated regular expression literal." }, + An_object_member_cannot_be_declared_optional: { code: 1162, category: 1, key: "An object member cannot be declared optional." }, + yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: 1, key: "'yield' expression must be contained_within a generator declaration." }, + Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: 1, key: "Computed property names are not allowed in enums." }, + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: 1, key: "A computed property name in an ambient context must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: 1, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, + Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: 1, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: 1, key: "A computed property name in a method overload must directly refer to a built-in symbol." }, + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: 1, key: "A computed property name in an interface must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: 1, key: "A computed property name in a type literal must directly refer to a built-in symbol." }, + A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: 1, key: "A comma expression is not allowed in a computed property name." }, + extends_clause_already_seen: { code: 1172, category: 1, key: "'extends' clause already seen." }, + extends_clause_must_precede_implements_clause: { code: 1173, category: 1, key: "'extends' clause must precede 'implements' clause." }, + Classes_can_only_extend_a_single_class: { code: 1174, category: 1, key: "Classes can only extend a single class." }, + implements_clause_already_seen: { code: 1175, category: 1, key: "'implements' clause already seen." }, + Interface_declaration_cannot_have_implements_clause: { code: 1176, category: 1, key: "Interface declaration cannot have 'implements' clause." }, + Binary_digit_expected: { code: 1177, category: 1, key: "Binary digit expected." }, + Octal_digit_expected: { code: 1178, category: 1, key: "Octal digit expected." }, + Unexpected_token_expected: { code: 1179, category: 1, key: "Unexpected token. '{' expected." }, + Property_destructuring_pattern_expected: { code: 1180, category: 1, key: "Property destructuring pattern expected." }, + Array_element_destructuring_pattern_expected: { code: 1181, category: 1, key: "Array element destructuring pattern expected." }, + A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: 1, key: "A destructuring declaration must have an initializer." }, + Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: 1, key: "Destructuring declarations are not allowed in ambient contexts." }, + An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: 1, key: "An implementation cannot be declared in ambient contexts." }, + Modifiers_cannot_appear_here: { code: 1184, category: 1, key: "Modifiers cannot appear here." }, + Merge_conflict_marker_encountered: { code: 1185, category: 1, key: "Merge conflict marker encountered." }, + A_rest_element_cannot_have_an_initializer: { code: 1186, category: 1, key: "A rest element cannot have an initializer." }, + A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: 1, key: "A parameter property may not be a binding pattern." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: 1, key: "Only a single variable declaration is allowed in a 'for...of' statement." }, + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: 1, key: "The variable declaration of a 'for...in' statement cannot have an initializer." }, + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: 1, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, + Duplicate_identifier_0: { code: 2300, category: 1, key: "Duplicate identifier '{0}'." }, + Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1, 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: 1, key: "Static members cannot reference class type parameters." }, + Circular_definition_of_import_alias_0: { code: 2303, category: 1, key: "Circular definition of import alias '{0}'." }, + Cannot_find_name_0: { code: 2304, category: 1, key: "Cannot find name '{0}'." }, + Module_0_has_no_exported_member_1: { code: 2305, category: 1, key: "Module '{0}' has no exported member '{1}'." }, + File_0_is_not_an_external_module: { code: 2306, category: 1, key: "File '{0}' is not an external module." }, + Cannot_find_external_module_0: { code: 2307, category: 1, key: "Cannot find external module '{0}'." }, + A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: 1, key: "A module cannot have more than one export assignment." }, + An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: 1, key: "An export assignment cannot be used in a module with other exported elements." }, + Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: 1, key: "Type '{0}' recursively references itself as a base type." }, + A_class_may_only_extend_another_class: { code: 2311, category: 1, key: "A class may only extend another class." }, + An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: 1, key: "An interface may only extend a class or another interface." }, + Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: 1, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, + Generic_type_0_requires_1_type_argument_s: { code: 2314, category: 1, key: "Generic type '{0}' requires {1} type argument(s)." }, + Type_0_is_not_generic: { code: 2315, category: 1, key: "Type '{0}' is not generic." }, + Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1, key: "Global type '{0}' must be a class or interface type." }, + Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1, key: "Global type '{0}' must have {1} type parameter(s)." }, + Cannot_find_global_type_0: { code: 2318, category: 1, key: "Cannot find global type '{0}'." }, + Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, + Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, + Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, + Type_0_is_not_assignable_to_type_1: { code: 2322, category: 1, key: "Type '{0}' is not assignable to type '{1}'." }, + Property_0_is_missing_in_type_1: { code: 2324, category: 1, key: "Property '{0}' is missing in type '{1}'." }, + Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: 1, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, + Types_of_property_0_are_incompatible: { code: 2326, category: 1, key: "Types of property '{0}' are incompatible." }, + Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: 1, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, + Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: 1, key: "Types of parameters '{0}' and '{1}' are incompatible." }, + Index_signature_is_missing_in_type_0: { code: 2329, category: 1, key: "Index signature is missing in type '{0}'." }, + Index_signatures_are_incompatible: { code: 2330, category: 1, key: "Index signatures are incompatible." }, + this_cannot_be_referenced_in_a_module_body: { code: 2331, category: 1, key: "'this' cannot be referenced in a module body." }, + this_cannot_be_referenced_in_current_location: { code: 2332, category: 1, key: "'this' cannot be referenced in current location." }, + this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: 1, key: "'this' cannot be referenced in constructor arguments." }, + this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: 1, key: "'this' cannot be referenced in a static property initializer." }, + super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: 1, key: "'super' can only be referenced in a derived class." }, + super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: 1, key: "'super' cannot be referenced in constructor arguments." }, + Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: 1, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, + super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: 1, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, + Property_0_does_not_exist_on_type_1: { code: 2339, category: 1, key: "Property '{0}' does not exist on type '{1}'." }, + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, + Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1, key: "Property '{0}' is private and only accessible within class '{1}'." }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: 1, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, + Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1, key: "Type '{0}' does not satisfy the constraint '{1}'." }, + Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, + Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1, key: "Supplied parameters do not match any signature of call target." }, + Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: 1, key: "Untyped function calls may not accept type arguments." }, + Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: 1, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, + Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: 1, key: "Cannot invoke an expression whose type lacks a call signature." }, + Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: 1, key: "Only a void function can be called with the 'new' keyword." }, + Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: 1, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, + Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: 1, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + No_best_common_type_exists_among_return_expressions: { code: 2354, category: 1, key: "No best common type exists among return expressions." }, + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: 1, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, + An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: 1, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, + The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, + The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: 1, key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, + The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: 1, key: "Invalid left-hand side of assignment expression." }, + Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: 1, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, + Type_parameter_name_cannot_be_0: { code: 2368, category: 1, key: "Type parameter name cannot be '{0}'" }, + A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: 1, key: "A parameter property is only allowed in a constructor implementation." }, + A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: 1, key: "A rest parameter must be of an array type." }, + A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: 1, key: "A parameter initializer is only allowed in a function or constructor implementation." }, + Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: 1, key: "Parameter '{0}' cannot be referenced in its initializer." }, + Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: 1, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, + Duplicate_string_index_signature: { code: 2374, category: 1, key: "Duplicate string index signature." }, + Duplicate_number_index_signature: { code: 2375, category: 1, key: "Duplicate number index signature." }, + A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: 1, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, + Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: 1, key: "Constructors for derived classes must contain a 'super' call." }, + A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: 1, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, + Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: 1, key: "Getter and setter accessors do not agree in visibility." }, + get_and_set_accessor_must_have_the_same_type: { code: 2380, category: 1, key: "'get' and 'set' accessor must have the same type." }, + A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: 1, key: "A signature with an implementation cannot use a string literal type." }, + Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: 1, key: "Specialized overload signature is not assignable to any non-specialized signature." }, + Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: 1, key: "Overload signatures must all be exported or not exported." }, + Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: 1, key: "Overload signatures must all be ambient or non-ambient." }, + Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: 1, key: "Overload signatures must all be public, private or protected." }, + Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: 1, key: "Overload signatures must all be optional or required." }, + Function_overload_must_be_static: { code: 2387, category: 1, key: "Function overload must be static." }, + Function_overload_must_not_be_static: { code: 2388, category: 1, key: "Function overload must not be static." }, + Function_implementation_name_must_be_0: { code: 2389, category: 1, key: "Function implementation name must be '{0}'." }, + Constructor_implementation_is_missing: { code: 2390, category: 1, key: "Constructor implementation is missing." }, + Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: 1, key: "Function implementation is missing or not immediately following the declaration." }, + Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: 1, key: "Multiple constructor implementations are not allowed." }, + Duplicate_function_implementation: { code: 2393, category: 1, key: "Duplicate function implementation." }, + Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: 1, key: "Overload signature is not compatible with function implementation." }, + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: 1, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, + Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: 1, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, + Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: 1, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, + Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: 1, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, + Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: 1, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, + Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: 1, key: "Expression resolves to '_super' that compiler uses to capture base class reference." }, + Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: 1, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, + The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: 1, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, + The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: 1, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, + Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: 1, key: "Invalid left-hand side in 'for...in' statement." }, + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: 1, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, + Setters_cannot_return_a_value: { code: 2408, category: 1, key: "Setters cannot return a value." }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: 1, key: "Return type of constructor signature must be assignable to the instance type of the class" }, + All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: 1, key: "All symbols within a 'with' block will be resolved to 'any'." }, + Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: 1, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, + Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: 1, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, + Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: 1, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, + Class_name_cannot_be_0: { code: 2414, category: 1, key: "Class name cannot be '{0}'" }, + Class_0_incorrectly_extends_base_class_1: { code: 2415, category: 1, key: "Class '{0}' incorrectly extends base class '{1}'." }, + Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: 1, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, + Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: 1, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, + Class_0_incorrectly_implements_interface_1: { code: 2420, category: 1, key: "Class '{0}' incorrectly implements interface '{1}'." }, + A_class_may_only_implement_another_class_or_interface: { code: 2422, category: 1, key: "A class may only implement another class or interface." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, + Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: 1, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, + Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: 1, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, + Interface_name_cannot_be_0: { code: 2427, category: 1, key: "Interface name cannot be '{0}'" }, + All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: 1, key: "All declarations of an interface must have identical type parameters." }, + Interface_0_incorrectly_extends_interface_1: { code: 2430, category: 1, key: "Interface '{0}' incorrectly extends interface '{1}'." }, + Enum_name_cannot_be_0: { code: 2431, category: 1, key: "Enum name cannot be '{0}'" }, + In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: 1, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, + A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: 1, key: "A module declaration cannot be in a different file from a class or function with which it is merged" }, + A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: 1, key: "A module declaration cannot be located prior to a class or function with which it is merged" }, + Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: 1, key: "Ambient external modules cannot be nested in other modules." }, + Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: 1, key: "Ambient external module declaration cannot specify relative module name." }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: 1, key: "Module '{0}' is hidden by a local declaration with the same name" }, + Import_name_cannot_be_0: { code: 2438, category: 1, key: "Import name cannot be '{0}'" }, + Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: 1, key: "Import declaration in an ambient external module declaration cannot reference external module through relative external module name." }, + Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: 1, key: "Import declaration conflicts with local declaration of '{0}'" }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: 1, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, + Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: 1, key: "Types have separate declarations of a private property '{0}'." }, + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: 1, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, + Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: 1, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: 1, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: 1, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, + The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: 1, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, + Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: 1, key: "Block-scoped variable '{0}' used before its declaration." }, + The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: 1, key: "The operand of an increment or decrement operator cannot be a constant." }, + Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: 1, key: "Left-hand side of assignment expression cannot be a constant." }, + Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: 1, key: "Cannot redeclare block-scoped variable '{0}'." }, + An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: 1, key: "An enum member cannot have a numeric name." }, + The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: 1, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, + Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: 1, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, + Type_alias_0_circularly_references_itself: { code: 2456, category: 1, key: "Type alias '{0}' circularly references itself." }, + Type_alias_name_cannot_be_0: { code: 2457, category: 1, key: "Type alias name cannot be '{0}'" }, + An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: 1, key: "An AMD module cannot have multiple name assignments." }, + Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: 1, key: "Type '{0}' has no property '{1}' and no string index signature." }, + Type_0_has_no_property_1: { code: 2460, category: 1, key: "Type '{0}' has no property '{1}'." }, + Type_0_is_not_an_array_type: { code: 2461, category: 1, key: "Type '{0}' is not an array type." }, + A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: 1, key: "A rest element must be last in an array destructuring pattern" }, + A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: 1, key: "A binding pattern parameter cannot be optional in an implementation signature." }, + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: 1, key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, + this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: 1, key: "'this' cannot be referenced in a computed property name." }, + super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: 1, key: "'super' cannot be referenced in a computed property name." }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: 1, key: "A computed property name cannot reference a type parameter from its containing type." }, + Cannot_find_global_value_0: { code: 2468, category: 1, key: "Cannot find global value '{0}'." }, + The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: 1, key: "The '{0}' operator cannot be applied to type 'symbol'." }, + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: 1, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: 1, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: 1, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, + Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: 1, key: "Enum declarations must all be const or non-const." }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: 1, key: "In 'const' enum declarations member initializer must be constant expression." }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: 1, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: 1, key: "A const enum member can only be accessed using a string literal." }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: 1, key: "'const' enum member initializer was evaluated to a non-finite value." }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: 1, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, + Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: 1, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: 1, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: 1, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, + for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: 1, key: "'for...of' statements are only available when targeting ECMAScript 6 or higher." }, + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: 1, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, + Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1, key: "Import declaration '{0}' is using private name '{1}'." }, + Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, + Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: 1, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: 1, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: 1, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: 1, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: 1, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: 1, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: 1, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, + Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: 1, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: 1, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: 1, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, + Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, + Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, + Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: 1, key: "Exported variable '{0}' has or is using private name '{1}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: 1, key: "Public static property '{0}' of exported class has or is using private name '{1}'." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: 1, key: "Public property '{0}' of exported class has or is using private name '{1}'." }, + Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: 1, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, + Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: 1, key: "Property '{0}' of exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: 1, key: "Return type of public static property getter from exported class has or is using private name '{0}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: 1, key: "Return type of public property getter from exported class has or is using private name '{0}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: 1, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: 1, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: 1, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: 1, key: "Return type of call signature from exported interface has or is using private name '{0}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: 1, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: 1, key: "Return type of index signature from exported interface has or is using private name '{0}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: 1, key: "Return type of public static method from exported class has or is using private name '{0}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: 1, key: "Return type of public method from exported class has or is using private name '{0}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: 1, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: 1, key: "Return type of method from exported interface has or is using private name '{0}'." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: 1, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: 1, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, + Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: 1, key: "Return type of exported function has or is using private name '{0}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: 1, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: 1, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: 1, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, + Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1, key: "Exported type alias '{0}' has or is using private name '{1}'." }, + The_current_host_does_not_support_the_0_option: { code: 5001, category: 1, key: "The current host does not support the '{0}' option." }, + Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1, key: "Cannot find the common subdirectory path for the input files." }, + Cannot_read_file_0_Colon_1: { code: 5012, category: 1, key: "Cannot read file '{0}': {1}" }, + Unsupported_file_encoding: { code: 5013, category: 1, key: "Unsupported file encoding." }, + Unknown_compiler_option_0: { code: 5023, category: 1, key: "Unknown compiler option '{0}'." }, + Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: 1, key: "Compiler option '{0}' requires a value of type {1}." }, + Could_not_write_file_0_Colon_1: { code: 5033, category: 1, key: "Could not write file '{0}': {1}" }, + Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: 1, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: 1, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: 1, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, + Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: 1, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, + Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: 1, key: "Option 'project' cannot be mixed with source files on a command line." }, + Concatenate_and_emit_output_to_single_file: { code: 6001, category: 2, key: "Concatenate and emit output to single file." }, + Generates_corresponding_d_ts_file: { code: 6002, category: 2, key: "Generates corresponding '.d.ts' file." }, + Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: 2, key: "Specifies the location where debugger should locate map files instead of generated locations." }, + Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: 2, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, + Watch_input_files: { code: 6005, category: 2, key: "Watch input files." }, + Redirect_output_structure_to_the_directory: { code: 6006, category: 2, key: "Redirect output structure to the directory." }, + Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: 2, key: "Do not erase const enum declarations in generated code." }, + Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: 2, key: "Do not emit outputs if any type checking errors were reported." }, + Do_not_emit_comments_to_output: { code: 6009, category: 2, key: "Do not emit comments to output." }, + Do_not_emit_outputs: { code: 6010, category: 2, key: "Do not emit outputs." }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: 2, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, + Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: 2, key: "Specify module code generation: 'commonjs' or 'amd'" }, + Print_this_message: { code: 6017, category: 2, key: "Print this message." }, + Print_the_compiler_s_version: { code: 6019, category: 2, key: "Print the compiler's version." }, + Compile_the_project_in_the_given_directory: { code: 6020, category: 2, key: "Compile the project in the given directory." }, + Syntax_Colon_0: { code: 6023, category: 2, key: "Syntax: {0}" }, + options: { code: 6024, category: 2, key: "options" }, + file: { code: 6025, category: 2, key: "file" }, + Examples_Colon_0: { code: 6026, category: 2, key: "Examples: {0}" }, + Options_Colon: { code: 6027, category: 2, key: "Options:" }, + Version_0: { code: 6029, category: 2, key: "Version {0}" }, + Insert_command_line_options_and_files_from_a_file: { code: 6030, category: 2, key: "Insert command line options and files from a file." }, + File_change_detected_Starting_incremental_compilation: { code: 6032, category: 2, key: "File change detected. Starting incremental compilation..." }, + KIND: { code: 6034, category: 2, key: "KIND" }, + FILE: { code: 6035, category: 2, key: "FILE" }, + VERSION: { code: 6036, category: 2, key: "VERSION" }, + LOCATION: { code: 6037, category: 2, key: "LOCATION" }, + DIRECTORY: { code: 6038, category: 2, key: "DIRECTORY" }, + Compilation_complete_Watching_for_file_changes: { code: 6042, category: 2, key: "Compilation complete. Watching for file changes." }, + Generates_corresponding_map_file: { code: 6043, category: 2, key: "Generates corresponding '.map' file." }, + Compiler_option_0_expects_an_argument: { code: 6044, category: 1, key: "Compiler option '{0}' expects an argument." }, + Unterminated_quoted_string_in_response_file_0: { code: 6045, category: 1, key: "Unterminated quoted string in response file '{0}'." }, + Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: 1, key: "Argument for '--module' option must be 'commonjs' or 'amd'." }, + Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: 1, 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: 1, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, + Unsupported_locale_0: { code: 6049, category: 1, key: "Unsupported locale '{0}'." }, + Unable_to_open_file_0: { code: 6050, category: 1, key: "Unable to open file '{0}'." }, + Corrupted_locale_file_0: { code: 6051, category: 1, key: "Corrupted locale file {0}." }, + Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: 2, key: "Raise error on expressions and declarations with an implied 'any' type." }, + File_0_not_found: { code: 6053, category: 1, key: "File '{0}' not found." }, + File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: 1, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, + Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: 2, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, + Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: 2, key: "Do not emit declarations for code that has an '@internal' annotation." }, + Variable_0_implicitly_has_an_1_type: { code: 7005, category: 1, key: "Variable '{0}' implicitly has an '{1}' type." }, + Parameter_0_implicitly_has_an_1_type: { code: 7006, category: 1, key: "Parameter '{0}' implicitly has an '{1}' type." }, + Member_0_implicitly_has_an_1_type: { code: 7008, category: 1, key: "Member '{0}' implicitly has an '{1}' type." }, + new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: 1, key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, + _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: 1, key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, + Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: 1, key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, + Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: 1, key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: 1, key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, + Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: 1, key: "Index signature of object type implicitly has an 'any' type." }, + Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, + Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, + Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: 1, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, + _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: 1, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, + _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: { code: 7023, category: 1, key: "'{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." }, + Function_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: { code: 7024, category: 1, key: "Function 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." }, + You_cannot_rename_this_element: { code: 8000, category: 1, key: "You cannot rename this element." }, + You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: 1, key: "You cannot rename elements that are defined in the standard TypeScript library." }, + yield_expressions_are_not_currently_supported: { code: 9000, category: 1, key: "'yield' expressions are not currently supported." }, + Generators_are_not_currently_supported: { code: 9001, category: 1, key: "Generators are not currently supported." }, + The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: 1, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, + for_of_statements_are_not_currently_supported: { code: 9003, category: 1, key: "'for...of' statements are not currently supported." } + }; +})(ts || (ts = {})); +var ts; +(function (ts) { + var textToToken = { + "any": 110, + "boolean": 111, + "break": 65, + "case": 66, + "catch": 67, + "class": 68, + "continue": 70, + "const": 69, + "constructor": 112, + "debugger": 71, + "declare": 113, + "default": 72, + "delete": 73, + "do": 74, + "else": 75, + "enum": 76, + "export": 77, + "extends": 78, + "false": 79, + "finally": 80, + "for": 81, + "function": 82, + "get": 114, + "if": 83, + "implements": 101, + "import": 84, + "in": 85, + "instanceof": 86, + "interface": 102, + "let": 103, + "module": 115, + "new": 87, + "null": 88, + "number": 117, + "package": 104, + "private": 105, + "protected": 106, + "public": 107, + "require": 116, + "return": 89, + "set": 118, + "static": 108, + "string": 119, + "super": 90, + "switch": 91, + "symbol": 120, + "this": 92, + "throw": 93, + "true": 94, + "try": 95, + "type": 121, + "typeof": 96, + "var": 97, + "void": 98, + "while": 99, + "with": 100, + "yield": 109, + "of": 122, + "{": 14, + "}": 15, + "(": 16, + ")": 17, + "[": 18, + "]": 19, + ".": 20, + "...": 21, + ";": 22, + ",": 23, + "<": 24, + ">": 25, + "<=": 26, + ">=": 27, + "==": 28, + "!=": 29, + "===": 30, + "!==": 31, + "=>": 32, + "+": 33, + "-": 34, + "*": 35, + "/": 36, + "%": 37, + "++": 38, + "--": 39, + "<<": 40, + ">>": 41, + ">>>": 42, + "&": 43, + "|": 44, + "^": 45, + "!": 46, + "~": 47, + "&&": 48, + "||": 49, + "?": 50, + ":": 51, + "=": 52, + "+=": 53, + "-=": 54, + "*=": 55, + "/=": 56, + "%=": 57, + "<<=": 58, + ">>=": 59, + ">>>=": 60, + "&=": 61, + "|=": 62, + "^=": 63 + }; + 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,]; + var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 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, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 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, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 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, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 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, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 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, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 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, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 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, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + function lookupInUnicodeMap(code, map) { + if (code < map[0]) { + return false; + } + var lo = 0; + var hi = map.length; + var mid; + while (lo + 1 < hi) { + mid = lo + (hi - lo) / 2; + mid -= mid % 2; + if (map[mid] <= code && code <= map[mid + 1]) { + return true; + } + if (code < map[mid]) { + hi = mid; + } + else { + lo = mid + 2; + } + } + return false; + } + function isUnicodeIdentifierStart(code, languageVersion) { + return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); + } + ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart; + function isUnicodeIdentifierPart(code, languageVersion) { + return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) : lookupInUnicodeMap(code, unicodeES3IdentifierPart); + } + function makeReverseMap(source) { + var result = []; + for (var name in source) { + if (source.hasOwnProperty(name)) { + result[source[name]] = name; + } + } + return result; + } + var tokenStrings = makeReverseMap(textToToken); + function tokenToString(t) { + return tokenStrings[t]; + } + ts.tokenToString = tokenToString; + function computeLineStarts(text) { + var result = new Array(); + var pos = 0; + var lineStart = 0; + while (pos < text.length) { + var ch = text.charCodeAt(pos++); + switch (ch) { + case 13: + if (text.charCodeAt(pos) === 10) { + pos++; + } + case 10: + result.push(lineStart); + lineStart = pos; + break; + default: + if (ch > 127 && isLineBreak(ch)) { + result.push(lineStart); + lineStart = pos; + } + break; + } + } + result.push(lineStart); + return result; + } + ts.computeLineStarts = computeLineStarts; + function getPositionOfLineAndCharacter(sourceFile, line, character) { + return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character); + } + ts.getPositionOfLineAndCharacter = getPositionOfLineAndCharacter; + function computePositionOfLineAndCharacter(lineStarts, line, character) { + ts.Debug.assert(line >= 0 && line < lineStarts.length); + return lineStarts[line] + character; + } + ts.computePositionOfLineAndCharacter = computePositionOfLineAndCharacter; + function getLineStarts(sourceFile) { + return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text)); + } + ts.getLineStarts = getLineStarts; + function computeLineAndCharacterOfPosition(lineStarts, position) { + var lineNumber = ts.binarySearch(lineStarts, position); + if (lineNumber < 0) { + lineNumber = ~lineNumber - 1; + } + return { + line: lineNumber, + character: position - lineStarts[lineNumber] + }; + } + ts.computeLineAndCharacterOfPosition = computeLineAndCharacterOfPosition; + function getLineAndCharacterOfPosition(sourceFile, position) { + return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); + } + ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; + var hasOwnProperty = Object.prototype.hasOwnProperty; + function isWhiteSpace(ch) { + return ch === 32 || ch === 9 || ch === 11 || ch === 12 || + ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || + ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; + } + ts.isWhiteSpace = isWhiteSpace; + function isLineBreak(ch) { + return ch === 10 || ch === 13 || ch === 8232 || ch === 8233 || ch === 133; + } + ts.isLineBreak = isLineBreak; + function isDigit(ch) { + return ch >= 48 && ch <= 57; + } + function isOctalDigit(ch) { + return ch >= 48 && ch <= 55; + } + ts.isOctalDigit = isOctalDigit; + function skipTrivia(text, pos, stopAfterLineBreak) { + while (true) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13: + if (text.charCodeAt(pos + 1) === 10) { + pos++; + } + case 10: + pos++; + if (stopAfterLineBreak) { + return pos; + } + continue; + case 9: + case 11: + case 12: + case 32: + pos++; + continue; + case 47: + if (text.charCodeAt(pos + 1) === 47) { + pos += 2; + while (pos < text.length) { + if (isLineBreak(text.charCodeAt(pos))) { + break; + } + pos++; + } + continue; + } + if (text.charCodeAt(pos + 1) === 42) { + pos += 2; + while (pos < text.length) { + if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) { + pos += 2; + break; + } + pos++; + } + continue; + } + break; + case 60: + case 61: + case 62: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos); + continue; + } + break; + default: + if (ch > 127 && (isWhiteSpace(ch) || isLineBreak(ch))) { + pos++; + continue; + } + break; + } + return pos; + } + } + ts.skipTrivia = skipTrivia; + var mergeConflictMarkerLength = "<<<<<<<".length; + function isConflictMarkerTrivia(text, pos) { + ts.Debug.assert(pos >= 0); + if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) { + var ch = text.charCodeAt(pos); + if ((pos + mergeConflictMarkerLength) < text.length) { + for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) { + if (text.charCodeAt(pos + i) !== ch) { + return false; + } + } + return ch === 61 || + text.charCodeAt(pos + mergeConflictMarkerLength) === 32; + } + } + return false; + } + function scanConflictMarkerTrivia(text, pos, error) { + if (error) { + error(ts.Diagnostics.Merge_conflict_marker_encountered, mergeConflictMarkerLength); + } + var ch = text.charCodeAt(pos); + var len = text.length; + if (ch === 60 || ch === 62) { + while (pos < len && !isLineBreak(text.charCodeAt(pos))) { + pos++; + } + } + else { + ts.Debug.assert(ch === 61); + while (pos < len) { + var ch = text.charCodeAt(pos); + if (ch === 62 && isConflictMarkerTrivia(text, pos)) { + break; + } + pos++; + } + } + return pos; + } + function getCommentRanges(text, pos, trailing) { + var result; + var collecting = trailing || pos === 0; + while (true) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13: + if (text.charCodeAt(pos + 1) === 10) + pos++; + case 10: + pos++; + if (trailing) { + return result; + } + collecting = true; + if (result && result.length) { + result[result.length - 1].hasTrailingNewLine = true; + } + continue; + case 9: + case 11: + case 12: + case 32: + pos++; + continue; + case 47: + var nextChar = text.charCodeAt(pos + 1); + var hasTrailingNewLine = false; + if (nextChar === 47 || nextChar === 42) { + var startPos = pos; + pos += 2; + if (nextChar === 47) { + while (pos < text.length) { + if (isLineBreak(text.charCodeAt(pos))) { + hasTrailingNewLine = true; + break; + } + pos++; + } + } + else { + while (pos < text.length) { + if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) { + pos += 2; + break; + } + pos++; + } + } + if (collecting) { + if (!result) + result = []; + result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine }); + } + continue; + } + break; + default: + if (ch > 127 && (isWhiteSpace(ch) || isLineBreak(ch))) { + if (result && result.length && isLineBreak(ch)) { + result[result.length - 1].hasTrailingNewLine = true; + } + pos++; + continue; + } + break; + } + return result; + } + } + function getLeadingCommentRanges(text, pos) { + return getCommentRanges(text, pos, false); + } + ts.getLeadingCommentRanges = getLeadingCommentRanges; + function getTrailingCommentRanges(text, pos) { + return getCommentRanges(text, pos, true); + } + ts.getTrailingCommentRanges = getTrailingCommentRanges; + function isIdentifierStart(ch, languageVersion) { + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + } + ts.isIdentifierStart = isIdentifierStart; + function isIdentifierPart(ch, languageVersion) { + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + } + ts.isIdentifierPart = isIdentifierPart; + function createScanner(languageVersion, skipTrivia, text, onError) { + var pos; + var len; + var startPos; + var tokenPos; + var token; + var tokenValue; + var precedingLineBreak; + var tokenIsUnterminated; + function error(message, length) { + if (onError) { + 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))) + pos++; + if (text.charCodeAt(pos) === 46) { + pos++; + while (isDigit(text.charCodeAt(pos))) + pos++; + } + var end = pos; + if (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101) { + pos++; + if (text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) + pos++; + if (isDigit(text.charCodeAt(pos))) { + pos++; + while (isDigit(text.charCodeAt(pos))) + pos++; + end = pos; + } + else { + error(ts.Diagnostics.Digit_expected); + } + } + return +(text.substring(start, end)); + } + function scanOctalDigits() { + var start = pos; + while (isOctalDigit(text.charCodeAt(pos))) { + pos++; + } + return +(text.substring(start, pos)); + } + function scanHexDigits(count, mustMatchCount) { + var digits = 0; + var value = 0; + while (digits < count || !mustMatchCount) { + var ch = text.charCodeAt(pos); + if (ch >= 48 && ch <= 57) { + value = value * 16 + ch - 48; + } + else if (ch >= 65 && ch <= 70) { + value = value * 16 + ch - 65 + 10; + } + else if (ch >= 97 && ch <= 102) { + value = value * 16 + ch - 97 + 10; + } + else { + break; + } + pos++; + digits++; + } + if (digits < count) { + value = -1; + } + return value; + } + function scanString() { + var quote = text.charCodeAt(pos++); + var result = ""; + var start = pos; + while (true) { + if (pos >= len) { + result += text.substring(start, pos); + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_string_literal); + break; + } + var ch = text.charCodeAt(pos); + if (ch === quote) { + result += text.substring(start, pos); + pos++; + break; + } + if (ch === 92) { + result += text.substring(start, pos); + result += scanEscapeSequence(); + start = pos; + continue; + } + if (isLineBreak(ch)) { + result += text.substring(start, pos); + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_string_literal); + break; + } + pos++; + } + return result; + } + function scanTemplateAndSetTokenValue() { + var startedWithBacktick = text.charCodeAt(pos) === 96; + pos++; + var start = pos; + var contents = ""; + var resultingToken; + while (true) { + if (pos >= len) { + contents += text.substring(start, pos); + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_template_literal); + resultingToken = startedWithBacktick ? 10 : 13; + break; + } + var currChar = text.charCodeAt(pos); + if (currChar === 96) { + contents += text.substring(start, pos); + pos++; + resultingToken = startedWithBacktick ? 10 : 13; + break; + } + if (currChar === 36 && pos + 1 < len && text.charCodeAt(pos + 1) === 123) { + contents += text.substring(start, pos); + pos += 2; + resultingToken = startedWithBacktick ? 11 : 12; + break; + } + if (currChar === 92) { + contents += text.substring(start, pos); + contents += scanEscapeSequence(); + start = pos; + continue; + } + if (currChar === 13) { + contents += text.substring(start, pos); + pos++; + if (pos < len && text.charCodeAt(pos) === 10) { + pos++; + } + contents += "\n"; + start = pos; + continue; + } + pos++; + } + ts.Debug.assert(resultingToken !== undefined); + tokenValue = contents; + return resultingToken; + } + function scanEscapeSequence() { + pos++; + if (pos >= len) { + error(ts.Diagnostics.Unexpected_end_of_text); + return ""; + } + var ch = text.charCodeAt(pos++); + switch (ch) { + case 48: + return "\0"; + case 98: + return "\b"; + case 116: + return "\t"; + case 110: + return "\n"; + case 118: + return "\v"; + case 102: + return "\f"; + case 114: + return "\r"; + case 39: + return "\'"; + case 34: + return "\""; + case 120: + case 117: + var ch = scanHexDigits(ch === 120 ? 2 : 4, true); + if (ch >= 0) { + return String.fromCharCode(ch); + } + else { + error(ts.Diagnostics.Hexadecimal_digit_expected); + return ""; + } + case 13: + if (pos < len && text.charCodeAt(pos) === 10) { + pos++; + } + case 10: + case 8232: + case 8233: + return ""; + default: + return String.fromCharCode(ch); + } + } + function peekUnicodeEscape() { + if (pos + 5 < len && text.charCodeAt(pos + 1) === 117) { + var start = pos; + pos += 2; + var value = scanHexDigits(4, true); + pos = start; + return value; + } + return -1; + } + function scanIdentifierParts() { + var result = ""; + var start = pos; + while (pos < len) { + var ch = text.charCodeAt(pos); + if (isIdentifierPart(ch)) { + pos++; + } + else if (ch === 92) { + ch = peekUnicodeEscape(); + if (!(ch >= 0 && isIdentifierPart(ch))) { + break; + } + result += text.substring(start, pos); + result += String.fromCharCode(ch); + pos += 6; + start = pos; + } + else { + break; + } + } + result += text.substring(start, pos); + return result; + } + function getIdentifierToken() { + var len = tokenValue.length; + if (len >= 2 && len <= 11) { + var ch = tokenValue.charCodeAt(0); + if (ch >= 97 && ch <= 122 && hasOwnProperty.call(textToToken, tokenValue)) { + return token = textToToken[tokenValue]; + } + } + return token = 64; + } + function scanBinaryOrOctalDigits(base) { + ts.Debug.assert(base !== 2 || base !== 8, "Expected either base 2 or base 8"); + var value = 0; + var numberOfDigits = 0; + while (true) { + var ch = text.charCodeAt(pos); + var valueOfCh = ch - 48; + if (!isDigit(ch) || valueOfCh >= base) { + break; + } + value = value * base + valueOfCh; + pos++; + numberOfDigits++; + } + if (numberOfDigits === 0) { + return -1; + } + return value; + } + function scan() { + startPos = pos; + precedingLineBreak = false; + tokenIsUnterminated = false; + while (true) { + tokenPos = pos; + if (pos >= len) { + return token = 1; + } + var ch = text.charCodeAt(pos); + switch (ch) { + case 10: + case 13: + precedingLineBreak = true; + if (skipTrivia) { + pos++; + continue; + } + else { + if (ch === 13 && pos + 1 < len && text.charCodeAt(pos + 1) === 10) { + pos += 2; + } + else { + pos++; + } + return token = 4; + } + case 9: + case 11: + case 12: + case 32: + if (skipTrivia) { + pos++; + continue; + } + else { + while (pos < len && isWhiteSpace(text.charCodeAt(pos))) { + pos++; + } + return token = 5; + } + case 33: + if (text.charCodeAt(pos + 1) === 61) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 31; + } + return pos += 2, token = 29; + } + return pos++, token = 46; + case 34: + case 39: + tokenValue = scanString(); + return token = 8; + case 96: + return token = scanTemplateAndSetTokenValue(); + case 37: + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 57; + } + return pos++, token = 37; + case 38: + if (text.charCodeAt(pos + 1) === 38) { + return pos += 2, token = 48; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 61; + } + return pos++, token = 43; + case 40: + return pos++, token = 16; + case 41: + return pos++, token = 17; + case 42: + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 55; + } + return pos++, token = 35; + case 43: + if (text.charCodeAt(pos + 1) === 43) { + return pos += 2, token = 38; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 53; + } + return pos++, token = 33; + case 44: + return pos++, token = 23; + case 45: + if (text.charCodeAt(pos + 1) === 45) { + return pos += 2, token = 39; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 54; + } + return pos++, token = 34; + case 46: + if (isDigit(text.charCodeAt(pos + 1))) { + tokenValue = "" + scanNumber(); + return token = 7; + } + if (text.charCodeAt(pos + 1) === 46 && text.charCodeAt(pos + 2) === 46) { + return pos += 3, token = 21; + } + return pos++, token = 20; + case 47: + if (text.charCodeAt(pos + 1) === 47) { + pos += 2; + while (pos < len) { + if (isLineBreak(text.charCodeAt(pos))) { + break; + } + pos++; + } + if (skipTrivia) { + continue; + } + else { + return token = 2; + } + } + if (text.charCodeAt(pos + 1) === 42) { + pos += 2; + var commentClosed = false; + while (pos < len) { + var ch = text.charCodeAt(pos); + if (ch === 42 && text.charCodeAt(pos + 1) === 47) { + pos += 2; + commentClosed = true; + break; + } + if (isLineBreak(ch)) { + precedingLineBreak = true; + } + pos++; + } + if (!commentClosed) { + error(ts.Diagnostics.Asterisk_Slash_expected); + } + if (skipTrivia) { + continue; + } + else { + tokenIsUnterminated = !commentClosed; + return token = 3; + } + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 56; + } + return pos++, token = 36; + case 48: + if (pos + 2 < len && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) { + pos += 2; + var value = scanHexDigits(1, false); + if (value < 0) { + error(ts.Diagnostics.Hexadecimal_digit_expected); + value = 0; + } + tokenValue = "" + value; + return token = 7; + } + else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) { + pos += 2; + var value = scanBinaryOrOctalDigits(2); + if (value < 0) { + error(ts.Diagnostics.Binary_digit_expected); + value = 0; + } + tokenValue = "" + value; + return token = 7; + } + else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) { + pos += 2; + var value = scanBinaryOrOctalDigits(8); + if (value < 0) { + error(ts.Diagnostics.Octal_digit_expected); + value = 0; + } + tokenValue = "" + value; + return token = 7; + } + if (pos + 1 < len && isOctalDigit(text.charCodeAt(pos + 1))) { + tokenValue = "" + scanOctalDigits(); + return token = 7; + } + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: + tokenValue = "" + scanNumber(); + return token = 7; + case 58: + return pos++, token = 51; + case 59: + return pos++, token = 22; + case 60: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + if (skipTrivia) { + continue; + } + else { + return token = 6; + } + } + if (text.charCodeAt(pos + 1) === 60) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 58; + } + return pos += 2, token = 40; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 26; + } + return pos++, token = 24; + case 61: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + if (skipTrivia) { + continue; + } + else { + return token = 6; + } + } + if (text.charCodeAt(pos + 1) === 61) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 30; + } + return pos += 2, token = 28; + } + if (text.charCodeAt(pos + 1) === 62) { + return pos += 2, token = 32; + } + return pos++, token = 52; + case 62: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + if (skipTrivia) { + continue; + } + else { + return token = 6; + } + } + return pos++, token = 25; + case 63: + return pos++, token = 50; + case 91: + return pos++, token = 18; + case 93: + return pos++, token = 19; + case 94: + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 63; + } + return pos++, token = 45; + case 123: + return pos++, token = 14; + case 124: + if (text.charCodeAt(pos + 1) === 124) { + return pos += 2, token = 49; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 62; + } + return pos++, token = 44; + case 125: + return pos++, token = 15; + case 126: + return pos++, token = 47; + case 92: + var ch = peekUnicodeEscape(); + if (ch >= 0 && isIdentifierStart(ch)) { + pos += 6; + tokenValue = String.fromCharCode(ch) + scanIdentifierParts(); + return token = getIdentifierToken(); + } + error(ts.Diagnostics.Invalid_character); + return pos++, token = 0; + default: + if (isIdentifierStart(ch)) { + pos++; + while (pos < len && isIdentifierPart(ch = text.charCodeAt(pos))) + pos++; + tokenValue = text.substring(tokenPos, pos); + if (ch === 92) { + tokenValue += scanIdentifierParts(); + } + return token = getIdentifierToken(); + } + else if (isWhiteSpace(ch)) { + pos++; + continue; + } + else if (isLineBreak(ch)) { + precedingLineBreak = true; + pos++; + continue; + } + error(ts.Diagnostics.Invalid_character); + return pos++, token = 0; + } + } + } + function reScanGreaterToken() { + if (token === 25) { + if (text.charCodeAt(pos) === 62) { + if (text.charCodeAt(pos + 1) === 62) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 60; + } + return pos += 2, token = 42; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 59; + } + return pos++, token = 41; + } + if (text.charCodeAt(pos) === 61) { + return pos++, token = 27; + } + } + return token; + } + function reScanSlashToken() { + if (token === 36 || token === 56) { + var p = tokenPos + 1; + var inEscape = false; + var inCharacterClass = false; + while (true) { + if (p >= len) { + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_regular_expression_literal); + break; + } + var ch = text.charCodeAt(p); + if (isLineBreak(ch)) { + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_regular_expression_literal); + break; + } + if (inEscape) { + inEscape = false; + } + else if (ch === 47 && !inCharacterClass) { + p++; + break; + } + else if (ch === 91) { + inCharacterClass = true; + } + else if (ch === 92) { + inEscape = true; + } + else if (ch === 93) { + inCharacterClass = false; + } + p++; + } + while (p < len && isIdentifierPart(text.charCodeAt(p))) { + p++; + } + pos = p; + tokenValue = text.substring(tokenPos, pos); + token = 9; + } + return token; + } + function reScanTemplateToken() { + ts.Debug.assert(token === 15, "'reScanTemplateToken' should only be called on a '}'"); + pos = tokenPos; + return token = scanTemplateAndSetTokenValue(); + } + function speculationHelper(callback, isLookahead) { + var savePos = pos; + var saveStartPos = startPos; + var saveTokenPos = tokenPos; + var saveToken = token; + var saveTokenValue = tokenValue; + var savePrecedingLineBreak = precedingLineBreak; + var result = callback(); + if (!result || isLookahead) { + pos = savePos; + startPos = saveStartPos; + tokenPos = saveTokenPos; + token = saveToken; + tokenValue = saveTokenValue; + precedingLineBreak = savePrecedingLineBreak; + } + return result; + } + function lookAhead(callback) { + return speculationHelper(callback, true); + } + function tryScan(callback) { + return speculationHelper(callback, false); + } + function setText(newText) { + text = newText || ""; + len = text.length; + setTextPos(0); + } + function setTextPos(textPos) { + pos = textPos; + startPos = textPos; + tokenPos = textPos; + token = 0; + precedingLineBreak = false; + } + setText(text); + return { + getStartPos: function () { return startPos; }, + getTextPos: function () { return pos; }, + getToken: function () { return token; }, + getTokenPos: function () { return tokenPos; }, + getTokenText: function () { return text.substring(tokenPos, pos); }, + getTokenValue: function () { return tokenValue; }, + hasPrecedingLineBreak: function () { return precedingLineBreak; }, + isIdentifier: function () { return token === 64 || token > 100; }, + isReservedWord: function () { return token >= 65 && token <= 100; }, + isUnterminated: function () { return tokenIsUnterminated; }, + reScanGreaterToken: reScanGreaterToken, + reScanSlashToken: reScanSlashToken, + reScanTemplateToken: reScanTemplateToken, + scan: scan, + setText: setText, + setTextPos: setTextPos, + tryScan: tryScan, + lookAhead: lookAhead + }; + } + ts.createScanner = createScanner; +})(ts || (ts = {})); +var ts; +(function (ts) { + function getDeclarationOfKind(symbol, kind) { + var declarations = symbol.declarations; + for (var i = 0; i < declarations.length; i++) { + var declaration = declarations[i]; + if (declaration.kind === kind) { + return declaration; + } + } + return undefined; + } + ts.getDeclarationOfKind = getDeclarationOfKind; + var stringWriters = []; + function getSingleLineStringWriter() { + if (stringWriters.length == 0) { + var str = ""; + var writeText = function (text) { return str += text; }; + return { + string: function () { return str; }, + writeKeyword: writeText, + writeOperator: writeText, + writePunctuation: writeText, + writeSpace: writeText, + writeStringLiteral: writeText, + writeParameter: writeText, + writeSymbol: writeText, + writeLine: function () { return str += " "; }, + increaseIndent: function () { }, + decreaseIndent: function () { }, + clear: function () { return str = ""; }, + trackSymbol: function () { } + }; + } + return stringWriters.pop(); + } + ts.getSingleLineStringWriter = getSingleLineStringWriter; + function releaseStringWriter(writer) { + writer.clear(); + stringWriters.push(writer); + } + ts.releaseStringWriter = releaseStringWriter; + function getFullWidth(node) { + return node.end - node.pos; + } + ts.getFullWidth = getFullWidth; + function containsParseError(node) { + aggregateChildData(node); + return (node.parserContextFlags & 32) !== 0; + } + ts.containsParseError = containsParseError; + function aggregateChildData(node) { + if (!(node.parserContextFlags & 64)) { + var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || + ts.forEachChild(node, containsParseError); + if (thisNodeOrAnySubNodesHasError) { + node.parserContextFlags |= 32; + } + node.parserContextFlags |= 64; + } + } + function getSourceFileOfNode(node) { + while (node && node.kind !== 210) { + node = node.parent; + } + return node; + } + ts.getSourceFileOfNode = getSourceFileOfNode; + function getStartPositionOfLine(line, sourceFile) { + ts.Debug.assert(line >= 0); + return ts.getLineStarts(sourceFile)[line]; + } + ts.getStartPositionOfLine = getStartPositionOfLine; + function nodePosToString(node) { + var file = getSourceFileOfNode(node); + var loc = ts.getLineAndCharacterOfPosition(file, node.pos); + return file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + ")"; + } + ts.nodePosToString = nodePosToString; + function getStartPosOfNode(node) { + return node.pos; + } + ts.getStartPosOfNode = getStartPosOfNode; + function nodeIsMissing(node) { + if (!node) { + return true; + } + return node.pos === node.end && node.kind !== 1; + } + ts.nodeIsMissing = nodeIsMissing; + function nodeIsPresent(node) { + return !nodeIsMissing(node); + } + ts.nodeIsPresent = nodeIsPresent; + function getTokenPosOfNode(node, sourceFile) { + if (nodeIsMissing(node)) { + return node.pos; + } + return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); + } + ts.getTokenPosOfNode = getTokenPosOfNode; + function getSourceTextOfNodeFromSourceFile(sourceFile, node) { + if (nodeIsMissing(node)) { + return ""; + } + var text = sourceFile.text; + return text.substring(ts.skipTrivia(text, node.pos), node.end); + } + ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile; + function getTextOfNodeFromSourceText(sourceText, node) { + if (nodeIsMissing(node)) { + return ""; + } + return sourceText.substring(ts.skipTrivia(sourceText, node.pos), node.end); + } + ts.getTextOfNodeFromSourceText = getTextOfNodeFromSourceText; + function getTextOfNode(node) { + return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node); + } + ts.getTextOfNode = getTextOfNode; + function escapeIdentifier(identifier) { + return identifier.length >= 2 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 ? "_" + identifier : identifier; + } + ts.escapeIdentifier = escapeIdentifier; + function unescapeIdentifier(identifier) { + return identifier.length >= 3 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 && identifier.charCodeAt(2) === 95 ? identifier.substr(1) : identifier; + } + ts.unescapeIdentifier = unescapeIdentifier; + function declarationNameToString(name) { + return getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name); + } + ts.declarationNameToString = declarationNameToString; + function createDiagnosticForNode(node, message, arg0, arg1, arg2) { + node = getErrorSpanForNode(node); + var file = getSourceFileOfNode(node); + var start = getTokenPosOfNode(node, file); + var length = node.end - start; + return ts.createFileDiagnostic(file, start, length, message, arg0, arg1, arg2); + } + ts.createDiagnosticForNode = createDiagnosticForNode; + function createDiagnosticForNodeFromMessageChain(node, messageChain) { + node = getErrorSpanForNode(node); + var file = getSourceFileOfNode(node); + var start = ts.skipTrivia(file.text, node.pos); + var length = node.end - start; + return { + file: file, + start: start, + length: length, + code: messageChain.code, + category: messageChain.category, + messageText: messageChain.next ? messageChain : messageChain.messageText + }; + } + ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain; + function getErrorSpanForNode(node) { + var errorSpan; + switch (node.kind) { + case 191: + case 148: + case 194: + case 195: + case 198: + case 197: + case 209: + errorSpan = node.name; + break; + } + return errorSpan && errorSpan.pos < errorSpan.end ? errorSpan : node; + } + ts.getErrorSpanForNode = getErrorSpanForNode; + function isExternalModule(file) { + return file.externalModuleIndicator !== undefined; + } + ts.isExternalModule = isExternalModule; + function isDeclarationFile(file) { + return (file.flags & 1024) !== 0; + } + ts.isDeclarationFile = isDeclarationFile; + function isConstEnumDeclaration(node) { + return node.kind === 197 && isConst(node); + } + ts.isConstEnumDeclaration = isConstEnumDeclaration; + function walkUpBindingElementsAndPatterns(node) { + while (node && (node.kind === 148 || isBindingPattern(node))) { + node = node.parent; + } + return node; + } + function getCombinedNodeFlags(node) { + node = walkUpBindingElementsAndPatterns(node); + var flags = node.flags; + if (node.kind === 191) { + node = node.parent; + } + if (node && node.kind === 192) { + flags |= node.flags; + node = node.parent; + } + if (node && node.kind === 173) { + flags |= node.flags; + } + return flags; + } + ts.getCombinedNodeFlags = getCombinedNodeFlags; + function isConst(node) { + return !!(getCombinedNodeFlags(node) & 4096); + } + ts.isConst = isConst; + function isLet(node) { + return !!(getCombinedNodeFlags(node) & 2048); + } + ts.isLet = isLet; + function isPrologueDirective(node) { + return node.kind === 175 && node.expression.kind === 8; + } + ts.isPrologueDirective = isPrologueDirective; + function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { + sourceFileOfNode = sourceFileOfNode || getSourceFileOfNode(node); + if (node.kind === 126 || node.kind === 125) { + return ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)); + } + else { + return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos); + } + } + ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; + function getJsDocComments(node, sourceFileOfNode) { + return ts.filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), 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; + } + } + ts.getJsDocComments = getJsDocComments; + ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; + function forEachReturnStatement(body, visitor) { + return traverse(body); + function traverse(node) { + switch (node.kind) { + case 184: + return visitor(node); + case 172: + case 176: + case 177: + case 178: + case 179: + case 180: + case 181: + case 185: + case 186: + case 203: + case 204: + case 187: + case 189: + case 206: + return ts.forEachChild(node, traverse); + } + } + } + ts.forEachReturnStatement = forEachReturnStatement; + function isAnyFunction(node) { + if (node) { + switch (node.kind) { + case 131: + case 158: + case 193: + case 159: + case 130: + case 129: + case 132: + case 133: + case 134: + case 135: + case 136: + case 138: + case 139: + case 158: + case 159: + case 193: + return true; + } + } + return false; + } + ts.isAnyFunction = isAnyFunction; + function isFunctionBlock(node) { + return node && node.kind === 172 && isAnyFunction(node.parent); + } + ts.isFunctionBlock = isFunctionBlock; + function isObjectLiteralMethod(node) { + return node && node.kind === 130 && node.parent.kind === 150; + } + ts.isObjectLiteralMethod = isObjectLiteralMethod; + function getContainingFunction(node) { + while (true) { + node = node.parent; + if (!node || isAnyFunction(node)) { + return node; + } + } + } + ts.getContainingFunction = getContainingFunction; + function getThisContainer(node, includeArrowFunctions) { + while (true) { + node = node.parent; + if (!node) { + return undefined; + } + switch (node.kind) { + case 124: + if (node.parent.parent.kind === 194) { + return node; + } + node = node.parent; + break; + case 159: + if (!includeArrowFunctions) { + continue; + } + case 193: + case 158: + case 198: + case 128: + case 127: + case 130: + case 129: + case 131: + case 132: + case 133: + case 197: + case 210: + return node; + } + } + } + ts.getThisContainer = getThisContainer; + function getSuperContainer(node, includeFunctions) { + while (true) { + node = node.parent; + if (!node) + return node; + switch (node.kind) { + case 124: + if (node.parent.parent.kind === 194) { + return node; + } + node = node.parent; + break; + case 193: + case 158: + case 159: + if (!includeFunctions) { + continue; + } + case 128: + case 127: + case 130: + case 129: + case 131: + case 132: + case 133: + return node; + } + } + } + ts.getSuperContainer = getSuperContainer; + function getInvokedExpression(node) { + if (node.kind === 155) { + return node.tag; + } + return node.expression; + } + ts.getInvokedExpression = getInvokedExpression; + function isExpression(node) { + switch (node.kind) { + case 92: + case 90: + case 88: + case 94: + case 79: + case 9: + case 149: + case 150: + case 151: + case 152: + case 153: + case 154: + case 155: + case 156: + case 157: + case 158: + case 159: + case 162: + case 160: + case 161: + case 163: + case 164: + case 165: + case 166: + case 169: + case 167: + case 10: + case 170: + return true; + case 123: + while (node.parent.kind === 123) { + node = node.parent; + } + return node.parent.kind === 140; + case 64: + if (node.parent.kind === 140) { + return true; + } + case 7: + case 8: + var parent = node.parent; + switch (parent.kind) { + case 191: + case 126: + case 128: + case 127: + case 209: + case 207: + case 148: + return parent.initializer === node; + case 175: + case 176: + case 177: + case 178: + case 184: + case 185: + case 186: + case 203: + case 188: + case 186: + return parent.expression === node; + case 179: + var forStatement = parent; + return (forStatement.initializer === node && forStatement.initializer.kind !== 192) || + forStatement.condition === node || + forStatement.iterator === node; + case 180: + case 181: + var forInStatement = parent; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 192) || + forInStatement.expression === node; + case 156: + return node === parent.expression; + case 171: + return node === parent.expression; + case 124: + return node === parent.expression; + default: + if (isExpression(parent)) { + return true; + } + } + } + return false; + } + ts.isExpression = isExpression; + function isInstantiatedModule(node, preserveConstEnums) { + var moduleState = ts.getModuleInstanceState(node); + return moduleState === 1 || + (preserveConstEnums && moduleState === 2); + } + ts.isInstantiatedModule = isInstantiatedModule; + function isExternalModuleImportDeclaration(node) { + return node.kind === 200 && node.moduleReference.kind === 202; + } + ts.isExternalModuleImportDeclaration = isExternalModuleImportDeclaration; + function getExternalModuleImportDeclarationExpression(node) { + ts.Debug.assert(isExternalModuleImportDeclaration(node)); + return node.moduleReference.expression; + } + ts.getExternalModuleImportDeclarationExpression = getExternalModuleImportDeclarationExpression; + function isInternalModuleImportDeclaration(node) { + return node.kind === 200 && node.moduleReference.kind !== 202; + } + ts.isInternalModuleImportDeclaration = isInternalModuleImportDeclaration; + function hasDotDotDotToken(node) { + return node && node.kind === 126 && node.dotDotDotToken !== undefined; + } + ts.hasDotDotDotToken = hasDotDotDotToken; + function hasQuestionToken(node) { + if (node) { + switch (node.kind) { + case 126: + return node.questionToken !== undefined; + case 130: + case 129: + return node.questionToken !== undefined; + case 208: + case 207: + case 128: + case 127: + return node.questionToken !== undefined; + } + } + return false; + } + ts.hasQuestionToken = hasQuestionToken; + function hasRestParameters(s) { + return s.parameters.length > 0 && s.parameters[s.parameters.length - 1].dotDotDotToken !== undefined; + } + ts.hasRestParameters = hasRestParameters; + function isLiteralKind(kind) { + return 7 <= kind && kind <= 10; + } + ts.isLiteralKind = isLiteralKind; + function isTextualLiteralKind(kind) { + return kind === 8 || kind === 10; + } + ts.isTextualLiteralKind = isTextualLiteralKind; + function isTemplateLiteralKind(kind) { + return 10 <= kind && kind <= 13; + } + ts.isTemplateLiteralKind = isTemplateLiteralKind; + function isBindingPattern(node) { + return node.kind === 147 || node.kind === 146; + } + ts.isBindingPattern = isBindingPattern; + function isInAmbientContext(node) { + while (node) { + if (node.flags & (2 | 1024)) { + return true; + } + node = node.parent; + } + return false; + } + ts.isInAmbientContext = isInAmbientContext; + function isDeclaration(node) { + switch (node.kind) { + case 125: + case 126: + case 191: + case 148: + case 128: + case 127: + case 207: + case 208: + case 209: + case 130: + case 129: + case 193: + case 132: + case 133: + case 131: + case 194: + case 195: + case 196: + case 197: + case 198: + case 200: + return true; + } + return false; + } + ts.isDeclaration = isDeclaration; + function isStatement(n) { + switch (n.kind) { + case 183: + case 182: + case 190: + case 177: + case 175: + case 174: + case 180: + case 181: + case 179: + case 176: + case 187: + case 184: + case 186: + case 93: + case 189: + case 173: + case 178: + case 185: + case 201: + return true; + default: + return false; + } + } + ts.isStatement = isStatement; + function isDeclarationOrFunctionExpressionOrCatchVariableName(name) { + if (name.kind !== 64 && name.kind !== 8 && name.kind !== 7) { + return false; + } + var parent = name.parent; + if (isDeclaration(parent) || parent.kind === 158) { + return parent.name === name; + } + if (parent.kind === 206) { + return parent.name === name; + } + return false; + } + ts.isDeclarationOrFunctionExpressionOrCatchVariableName = isDeclarationOrFunctionExpressionOrCatchVariableName; + function getClassBaseTypeNode(node) { + var heritageClause = getHeritageClause(node.heritageClauses, 78); + return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; + } + ts.getClassBaseTypeNode = getClassBaseTypeNode; + function getClassImplementedTypeNodes(node) { + var heritageClause = getHeritageClause(node.heritageClauses, 101); + return heritageClause ? heritageClause.types : undefined; + } + ts.getClassImplementedTypeNodes = getClassImplementedTypeNodes; + function getInterfaceBaseTypeNodes(node) { + var heritageClause = getHeritageClause(node.heritageClauses, 78); + return heritageClause ? heritageClause.types : undefined; + } + ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; + function getHeritageClause(clauses, kind) { + if (clauses) { + for (var i = 0, n = clauses.length; i < n; i++) { + if (clauses[i].token === kind) { + return clauses[i]; + } + } + } + return undefined; + } + ts.getHeritageClause = getHeritageClause; + function tryResolveScriptReference(host, sourceFile, reference) { + if (!host.getCompilerOptions().noResolve) { + var referenceFileName = ts.isRootedDiskPath(reference.fileName) ? reference.fileName : ts.combinePaths(ts.getDirectoryPath(sourceFile.fileName), reference.fileName); + referenceFileName = ts.getNormalizedAbsolutePath(referenceFileName, host.getCurrentDirectory()); + return host.getSourceFile(referenceFileName); + } + } + ts.tryResolveScriptReference = tryResolveScriptReference; + function getAncestor(node, kind) { + switch (kind) { + case 194: + while (node) { + switch (node.kind) { + case 194: + return node; + case 197: + case 195: + case 196: + case 198: + case 200: + return undefined; + default: + node = node.parent; + continue; + } + } + break; + default: + while (node) { + if (node.kind === kind) { + return node; + } + node = node.parent; + } + break; + } + return undefined; + } + ts.getAncestor = getAncestor; + function getFileReferenceFromReferencePath(comment, commentRange) { + var simpleReferenceRegEx = /^\/\/\/\s*/gim; + if (simpleReferenceRegEx.exec(comment)) { + if (isNoDefaultLibRegEx.exec(comment)) { + return { + isNoDefaultLib: true + }; + } + else { + var matchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); + if (matchResult) { + var start = commentRange.pos; + var end = commentRange.end; + return { + fileReference: { + pos: start, + end: end, + fileName: matchResult[3] + }, + isNoDefaultLib: false + }; + } + else { + return { + diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, + isNoDefaultLib: false + }; + } + } + } + return undefined; + } + ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; + function isKeyword(token) { + return 65 <= token && token <= 122; + } + ts.isKeyword = isKeyword; + function isTrivia(token) { + return 2 <= token && token <= 6; + } + ts.isTrivia = isTrivia; + function hasDynamicName(declaration) { + return declaration.name && + declaration.name.kind === 124 && + !isWellKnownSymbolSyntactically(declaration.name.expression); + } + ts.hasDynamicName = hasDynamicName; + function isWellKnownSymbolSyntactically(node) { + return node.kind === 151 && isESSymbolIdentifier(node.expression); + } + ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; + function getPropertyNameForPropertyNameNode(name) { + if (name.kind === 64 || name.kind === 8 || name.kind === 7) { + return name.text; + } + if (name.kind === 124) { + var nameExpression = name.expression; + if (isWellKnownSymbolSyntactically(nameExpression)) { + var rightHandSideName = nameExpression.name.text; + return getPropertyNameForKnownSymbolName(rightHandSideName); + } + } + return undefined; + } + ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode; + function getPropertyNameForKnownSymbolName(symbolName) { + return "__@" + symbolName; + } + ts.getPropertyNameForKnownSymbolName = getPropertyNameForKnownSymbolName; + function isESSymbolIdentifier(node) { + return node.kind === 64 && node.text === "Symbol"; + } + ts.isESSymbolIdentifier = isESSymbolIdentifier; + function isModifier(token) { + switch (token) { + case 107: + case 105: + case 106: + case 108: + case 77: + case 113: + case 69: + return true; + } + return false; + } + ts.isModifier = isModifier; + function textSpanEnd(span) { + return span.start + span.length; + } + ts.textSpanEnd = textSpanEnd; + function textSpanIsEmpty(span) { + return span.length === 0; + } + ts.textSpanIsEmpty = textSpanIsEmpty; + function textSpanContainsPosition(span, position) { + return position >= span.start && position < textSpanEnd(span); + } + ts.textSpanContainsPosition = textSpanContainsPosition; + function textSpanContainsTextSpan(span, other) { + return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span); + } + ts.textSpanContainsTextSpan = textSpanContainsTextSpan; + function textSpanOverlapsWith(span, other) { + var overlapStart = Math.max(span.start, other.start); + var overlapEnd = Math.min(textSpanEnd(span), textSpanEnd(other)); + return overlapStart < overlapEnd; + } + ts.textSpanOverlapsWith = textSpanOverlapsWith; + function textSpanOverlap(span1, span2) { + var overlapStart = Math.max(span1.start, span2.start); + var overlapEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2)); + if (overlapStart < overlapEnd) { + return createTextSpanFromBounds(overlapStart, overlapEnd); + } + return undefined; + } + ts.textSpanOverlap = textSpanOverlap; + function textSpanIntersectsWithTextSpan(span, other) { + return other.start <= textSpanEnd(span) && textSpanEnd(other) >= span.start; + } + ts.textSpanIntersectsWithTextSpan = textSpanIntersectsWithTextSpan; + function textSpanIntersectsWith(span, start, length) { + var end = start + length; + return start <= textSpanEnd(span) && end >= span.start; + } + ts.textSpanIntersectsWith = textSpanIntersectsWith; + function textSpanIntersectsWithPosition(span, position) { + return position <= textSpanEnd(span) && position >= span.start; + } + ts.textSpanIntersectsWithPosition = textSpanIntersectsWithPosition; + function textSpanIntersection(span1, span2) { + var intersectStart = Math.max(span1.start, span2.start); + var intersectEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2)); + if (intersectStart <= intersectEnd) { + return createTextSpanFromBounds(intersectStart, intersectEnd); + } + return undefined; + } + ts.textSpanIntersection = textSpanIntersection; + function createTextSpan(start, length) { + if (start < 0) { + throw new Error("start < 0"); + } + if (length < 0) { + throw new Error("length < 0"); + } + return { start: start, length: length }; + } + ts.createTextSpan = createTextSpan; + function createTextSpanFromBounds(start, end) { + return createTextSpan(start, end - start); + } + ts.createTextSpanFromBounds = createTextSpanFromBounds; + function textChangeRangeNewSpan(range) { + return createTextSpan(range.span.start, range.newLength); + } + ts.textChangeRangeNewSpan = textChangeRangeNewSpan; + function textChangeRangeIsUnchanged(range) { + return textSpanIsEmpty(range.span) && range.newLength === 0; + } + ts.textChangeRangeIsUnchanged = textChangeRangeIsUnchanged; + function createTextChangeRange(span, newLength) { + if (newLength < 0) { + throw new Error("newLength < 0"); + } + return { span: span, newLength: newLength }; + } + ts.createTextChangeRange = createTextChangeRange; + ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0); + function collapseTextChangeRangesAcrossMultipleVersions(changes) { + if (changes.length === 0) { + return ts.unchangedTextChangeRange; + } + if (changes.length === 1) { + return changes[0]; + } + var change0 = changes[0]; + var oldStartN = change0.span.start; + var oldEndN = textSpanEnd(change0.span); + var newEndN = oldStartN + change0.newLength; + for (var i = 1; i < changes.length; i++) { + var nextChange = changes[i]; + var oldStart1 = oldStartN; + var oldEnd1 = oldEndN; + var newEnd1 = newEndN; + var oldStart2 = nextChange.span.start; + var oldEnd2 = textSpanEnd(nextChange.span); + var newEnd2 = oldStart2 + nextChange.newLength; + oldStartN = Math.min(oldStart1, oldStart2); + oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1)); + newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2)); + } + return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), newEndN - oldStartN); + } + ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; + function createDiagnosticCollection() { + var nonFileDiagnostics = []; + var fileDiagnostics = {}; + var diagnosticsModified = false; + var modificationCount = 0; + return { + add: add, + getGlobalDiagnostics: getGlobalDiagnostics, + getDiagnostics: getDiagnostics, + getModificationCount: getModificationCount + }; + function getModificationCount() { + return modificationCount; + } + function add(diagnostic) { + var diagnostics; + if (diagnostic.file) { + diagnostics = fileDiagnostics[diagnostic.file.fileName]; + if (!diagnostics) { + diagnostics = []; + fileDiagnostics[diagnostic.file.fileName] = diagnostics; + } + } + else { + diagnostics = nonFileDiagnostics; + } + diagnostics.push(diagnostic); + diagnosticsModified = true; + modificationCount++; + } + function getGlobalDiagnostics() { + sortAndDeduplicate(); + return nonFileDiagnostics; + } + function getDiagnostics(fileName) { + sortAndDeduplicate(); + if (fileName) { + return fileDiagnostics[fileName] || []; + } + var allDiagnostics = []; + function pushDiagnostic(d) { + allDiagnostics.push(d); + } + ts.forEach(nonFileDiagnostics, pushDiagnostic); + for (var key in fileDiagnostics) { + if (ts.hasProperty(fileDiagnostics, key)) { + ts.forEach(fileDiagnostics[key], pushDiagnostic); + } + } + return ts.sortAndDeduplicateDiagnostics(allDiagnostics); + } + function sortAndDeduplicate() { + if (!diagnosticsModified) { + return; + } + diagnosticsModified = false; + nonFileDiagnostics = ts.sortAndDeduplicateDiagnostics(nonFileDiagnostics); + for (var key in fileDiagnostics) { + if (ts.hasProperty(fileDiagnostics, key)) { + fileDiagnostics[key] = ts.sortAndDeduplicateDiagnostics(fileDiagnostics[key]); + } + } + } + } + ts.createDiagnosticCollection = createDiagnosticCollection; +})(ts || (ts = {})); +var ts; +(function (ts) { + var nodeConstructors = new Array(212); + ts.parseTime = 0; + function getNodeConstructor(kind) { + return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); + } + ts.getNodeConstructor = getNodeConstructor; + function createNode(kind) { + return new (getNodeConstructor(kind))(); + } + ts.createNode = createNode; + function visitNode(cbNode, node) { + if (node) { + return cbNode(node); + } + } + function visitNodeArray(cbNodes, nodes) { + if (nodes) { + return cbNodes(nodes); + } + } + function visitEachNode(cbNode, nodes) { + if (nodes) { + for (var i = 0, len = nodes.length; i < len; i++) { + var result = cbNode(nodes[i]); + if (result) { + return result; + } + } + } + } + function forEachChild(node, cbNode, cbNodeArray) { + if (!node) { + return; + } + var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; + var cbNodes = cbNodeArray || cbNode; + switch (node.kind) { + case 123: + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + case 125: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.expression); + case 126: + case 128: + case 127: + case 207: + case 208: + case 191: + case 148: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + case 138: + case 139: + case 134: + case 135: + case 136: + return visitNodes(cbNodes, node.modifiers) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type); + case 130: + case 129: + case 131: + case 132: + case 133: + case 158: + case 193: + case 159: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + case 137: + return visitNode(cbNode, node.typeName) || + visitNodes(cbNodes, node.typeArguments); + case 140: + return visitNode(cbNode, node.exprName); + case 141: + return visitNodes(cbNodes, node.members); + case 142: + return visitNode(cbNode, node.elementType); + case 143: + return visitNodes(cbNodes, node.elementTypes); + case 144: + return visitNodes(cbNodes, node.types); + case 145: + return visitNode(cbNode, node.type); + case 146: + case 147: + return visitNodes(cbNodes, node.elements); + case 149: + return visitNodes(cbNodes, node.elements); + case 150: + return visitNodes(cbNodes, node.properties); + case 151: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.name); + case 152: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.argumentExpression); + case 153: + case 154: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.typeArguments) || + visitNodes(cbNodes, node.arguments); + case 155: + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.template); + case 156: + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); + case 157: + return visitNode(cbNode, node.expression); + case 160: + return visitNode(cbNode, node.expression); + case 161: + return visitNode(cbNode, node.expression); + case 162: + return visitNode(cbNode, node.expression); + case 163: + return visitNode(cbNode, node.operand); + case 168: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + case 164: + return visitNode(cbNode, node.operand); + case 165: + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); + case 166: + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.whenFalse); + case 169: + return visitNode(cbNode, node.expression); + case 172: + case 199: + return visitNodes(cbNodes, node.statements); + case 210: + return visitNodes(cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); + case 173: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); + case 192: + return visitNodes(cbNodes, node.declarations); + case 175: + return visitNode(cbNode, node.expression); + case 176: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); + case 177: + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); + case 178: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 179: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.iterator) || + visitNode(cbNode, node.statement); + case 180: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 181: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 182: + case 183: + return visitNode(cbNode, node.label); + case 184: + return visitNode(cbNode, node.expression); + case 185: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 186: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.clauses); + case 203: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.statements); + case 204: + return visitNodes(cbNodes, node.statements); + case 187: + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + case 188: + return visitNode(cbNode, node.expression); + case 189: + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); + case 206: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.block); + case 194: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); + case 195: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); + case 196: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.type); + case 197: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 209: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + case 198: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + case 200: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); + case 201: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.exportName); + case 167: + return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); + case 171: + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); + case 124: + return visitNode(cbNode, node.expression); + case 205: + return visitNodes(cbNodes, node.types); + case 202: + return visitNode(cbNode, node.expression); + } + } + ts.forEachChild = forEachChild; + var ParsingContext; + (function (ParsingContext) { + ParsingContext[ParsingContext["SourceElements"] = 0] = "SourceElements"; + ParsingContext[ParsingContext["ModuleElements"] = 1] = "ModuleElements"; + ParsingContext[ParsingContext["BlockStatements"] = 2] = "BlockStatements"; + ParsingContext[ParsingContext["SwitchClauses"] = 3] = "SwitchClauses"; + ParsingContext[ParsingContext["SwitchClauseStatements"] = 4] = "SwitchClauseStatements"; + ParsingContext[ParsingContext["TypeMembers"] = 5] = "TypeMembers"; + ParsingContext[ParsingContext["ClassMembers"] = 6] = "ClassMembers"; + ParsingContext[ParsingContext["EnumMembers"] = 7] = "EnumMembers"; + ParsingContext[ParsingContext["TypeReferences"] = 8] = "TypeReferences"; + ParsingContext[ParsingContext["VariableDeclarations"] = 9] = "VariableDeclarations"; + ParsingContext[ParsingContext["ObjectBindingElements"] = 10] = "ObjectBindingElements"; + ParsingContext[ParsingContext["ArrayBindingElements"] = 11] = "ArrayBindingElements"; + ParsingContext[ParsingContext["ArgumentExpressions"] = 12] = "ArgumentExpressions"; + ParsingContext[ParsingContext["ObjectLiteralMembers"] = 13] = "ObjectLiteralMembers"; + ParsingContext[ParsingContext["ArrayLiteralMembers"] = 14] = "ArrayLiteralMembers"; + ParsingContext[ParsingContext["Parameters"] = 15] = "Parameters"; + ParsingContext[ParsingContext["TypeParameters"] = 16] = "TypeParameters"; + ParsingContext[ParsingContext["TypeArguments"] = 17] = "TypeArguments"; + ParsingContext[ParsingContext["TupleElementTypes"] = 18] = "TupleElementTypes"; + ParsingContext[ParsingContext["HeritageClauses"] = 19] = "HeritageClauses"; + ParsingContext[ParsingContext["Count"] = 20] = "Count"; + })(ParsingContext || (ParsingContext = {})); + var Tristate; + (function (Tristate) { + Tristate[Tristate["False"] = 0] = "False"; + Tristate[Tristate["True"] = 1] = "True"; + Tristate[Tristate["Unknown"] = 2] = "Unknown"; + })(Tristate || (Tristate = {})); + function parsingContextErrors(context) { + switch (context) { + case 0: return ts.Diagnostics.Declaration_or_statement_expected; + case 1: return ts.Diagnostics.Declaration_or_statement_expected; + case 2: return ts.Diagnostics.Statement_expected; + case 3: return ts.Diagnostics.case_or_default_expected; + case 4: return ts.Diagnostics.Statement_expected; + case 5: return ts.Diagnostics.Property_or_signature_expected; + case 6: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; + case 7: return ts.Diagnostics.Enum_member_expected; + case 8: return ts.Diagnostics.Type_reference_expected; + case 9: return ts.Diagnostics.Variable_declaration_expected; + case 10: return ts.Diagnostics.Property_destructuring_pattern_expected; + case 11: return ts.Diagnostics.Array_element_destructuring_pattern_expected; + case 12: return ts.Diagnostics.Argument_expression_expected; + case 13: return ts.Diagnostics.Property_assignment_expected; + case 14: return ts.Diagnostics.Expression_or_comma_expected; + case 15: return ts.Diagnostics.Parameter_declaration_expected; + case 16: return ts.Diagnostics.Type_parameter_declaration_expected; + case 17: return ts.Diagnostics.Type_argument_expected; + case 18: return ts.Diagnostics.Type_expected; + case 19: return ts.Diagnostics.Unexpected_token_expected; + } + } + ; + function modifierToFlag(token) { + switch (token) { + case 108: return 128; + case 107: return 16; + case 106: return 64; + case 105: return 32; + case 77: return 1; + case 113: return 2; + case 69: return 4096; + } + return 0; + } + ts.modifierToFlag = modifierToFlag; + function fixupParentReferences(sourceFile) { + var parent = sourceFile; + forEachChild(sourceFile, visitNode); + return; + function visitNode(n) { + if (n.parent !== parent) { + n.parent = parent; + var saveParent = parent; + parent = n; + forEachChild(n, visitNode); + parent = saveParent; + } + } + } + function shouldCheckNode(node) { + switch (node.kind) { + case 8: + case 7: + case 64: + return true; + } + return false; + } + function moveElementEntirelyPastChangeRange(element, isArray, delta, oldText, newText, aggressiveChecks) { + if (isArray) { + visitArray(element); + } + else { + visitNode(element); + } + return; + function visitNode(node) { + if (aggressiveChecks && shouldCheckNode(node)) { + var text = oldText.substring(node.pos, node.end); + } + node._children = undefined; + node.pos += delta; + node.end += delta; + if (aggressiveChecks && shouldCheckNode(node)) { + ts.Debug.assert(text === newText.substring(node.pos, node.end)); + } + forEachChild(node, visitNode, visitArray); + checkNodePositions(node, aggressiveChecks); + } + function visitArray(array) { + array._children = undefined; + array.pos += delta; + array.end += delta; + for (var i = 0, n = array.length; i < n; i++) { + visitNode(array[i]); + } + } + } + function adjustIntersectingElement(element, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta) { + ts.Debug.assert(element.end >= changeStart, "Adjusting an element that was entirely before the change range"); + ts.Debug.assert(element.pos <= changeRangeOldEnd, "Adjusting an element that was entirely after the change range"); + ts.Debug.assert(element.pos <= element.end); + element.pos = Math.min(element.pos, changeRangeNewEnd); + if (element.end >= changeRangeOldEnd) { + element.end += delta; + } + else { + element.end = Math.min(element.end, changeRangeNewEnd); + } + ts.Debug.assert(element.pos <= element.end); + if (element.parent) { + ts.Debug.assert(element.pos >= element.parent.pos); + ts.Debug.assert(element.end <= element.parent.end); + } + } + function checkNodePositions(node, aggressiveChecks) { + if (aggressiveChecks) { + var pos = node.pos; + forEachChild(node, function (child) { + ts.Debug.assert(child.pos >= pos); + pos = child.end; + }); + ts.Debug.assert(pos <= node.end); + } + } + function updateTokenPositionsAndMarkElements(sourceFile, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta, oldText, newText, aggressiveChecks) { + visitNode(sourceFile); + return; + function visitNode(child) { + ts.Debug.assert(child.pos <= child.end); + if (child.pos > changeRangeOldEnd) { + moveElementEntirelyPastChangeRange(child, false, delta, oldText, newText, aggressiveChecks); + return; + } + var fullEnd = child.end; + if (fullEnd >= changeStart) { + child.intersectsChange = true; + child._children = undefined; + adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); + forEachChild(child, visitNode, visitArray); + checkNodePositions(child, aggressiveChecks); + return; + } + ts.Debug.assert(fullEnd < changeStart); + } + function visitArray(array) { + ts.Debug.assert(array.pos <= array.end); + if (array.pos > changeRangeOldEnd) { + moveElementEntirelyPastChangeRange(array, true, delta, oldText, newText, aggressiveChecks); + return; + } + var fullEnd = array.end; + if (fullEnd >= changeStart) { + array.intersectsChange = true; + array._children = undefined; + adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); + for (var i = 0, n = array.length; i < n; i++) { + visitNode(array[i]); + } + return; + } + ts.Debug.assert(fullEnd < changeStart); + } + } + function extendToAffectedRange(sourceFile, changeRange) { + var maxLookahead = 1; + var start = changeRange.span.start; + for (var i = 0; start > 0 && i <= maxLookahead; i++) { + var nearestNode = findNearestNodeStartingBeforeOrAtPosition(sourceFile, start); + ts.Debug.assert(nearestNode.pos <= start); + var position = nearestNode.pos; + start = Math.max(0, position - 1); + } + var finalSpan = ts.createTextSpanFromBounds(start, ts.textSpanEnd(changeRange.span)); + var finalLength = changeRange.newLength + (changeRange.span.start - start); + return ts.createTextChangeRange(finalSpan, finalLength); + } + function findNearestNodeStartingBeforeOrAtPosition(sourceFile, position) { + var bestResult = sourceFile; + var lastNodeEntirelyBeforePosition; + forEachChild(sourceFile, visit); + if (lastNodeEntirelyBeforePosition) { + var lastChildOfLastEntireNodeBeforePosition = getLastChild(lastNodeEntirelyBeforePosition); + if (lastChildOfLastEntireNodeBeforePosition.pos > bestResult.pos) { + bestResult = lastChildOfLastEntireNodeBeforePosition; + } + } + return bestResult; + function getLastChild(node) { + while (true) { + var lastChild = getLastChildWorker(node); + if (lastChild) { + node = lastChild; + } + else { + return node; + } + } + } + function getLastChildWorker(node) { + var last = undefined; + forEachChild(node, function (child) { + if (ts.nodeIsPresent(child)) { + last = child; + } + }); + return last; + } + function visit(child) { + if (ts.nodeIsMissing(child)) { + return; + } + if (child.pos <= position) { + if (child.pos >= bestResult.pos) { + bestResult = child; + } + if (position < child.end) { + forEachChild(child, visit); + return true; + } + else { + ts.Debug.assert(child.end <= position); + lastNodeEntirelyBeforePosition = child; + } + } + else { + ts.Debug.assert(child.pos > position); + return true; + } + } + } + function checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks) { + var oldText = sourceFile.text; + if (textChangeRange) { + ts.Debug.assert((oldText.length - textChangeRange.span.length + textChangeRange.newLength) === newText.length); + if (aggressiveChecks || ts.Debug.shouldAssert(3)) { + var oldTextPrefix = oldText.substr(0, textChangeRange.span.start); + var newTextPrefix = newText.substr(0, textChangeRange.span.start); + ts.Debug.assert(oldTextPrefix === newTextPrefix); + var oldTextSuffix = oldText.substring(ts.textSpanEnd(textChangeRange.span), oldText.length); + var newTextSuffix = newText.substring(ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange)), newText.length); + ts.Debug.assert(oldTextSuffix === newTextSuffix); + } + } + } + function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) { + aggressiveChecks = aggressiveChecks || ts.Debug.shouldAssert(2); + checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks); + if (ts.textChangeRangeIsUnchanged(textChangeRange)) { + return sourceFile; + } + if (sourceFile.statements.length === 0) { + return parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, undefined, true); + } + var incrementalSourceFile = sourceFile; + ts.Debug.assert(!incrementalSourceFile.hasBeenIncrementallyParsed); + incrementalSourceFile.hasBeenIncrementallyParsed = true; + var oldText = sourceFile.text; + var syntaxCursor = createSyntaxCursor(sourceFile); + var changeRange = extendToAffectedRange(sourceFile, textChangeRange); + checkChangeRange(sourceFile, newText, changeRange, aggressiveChecks); + ts.Debug.assert(changeRange.span.start <= textChangeRange.span.start); + ts.Debug.assert(ts.textSpanEnd(changeRange.span) === ts.textSpanEnd(textChangeRange.span)); + ts.Debug.assert(ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)) === ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange))); + var delta = ts.textChangeRangeNewSpan(changeRange).length - changeRange.span.length; + updateTokenPositionsAndMarkElements(incrementalSourceFile, changeRange.span.start, ts.textSpanEnd(changeRange.span), ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks); + var result = parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, true); + return result; + } + ts.updateSourceFile = updateSourceFile; + function isEvalOrArgumentsIdentifier(node) { + return node.kind === 64 && + (node.text === "eval" || node.text === "arguments"); + } + ts.isEvalOrArgumentsIdentifier = isEvalOrArgumentsIdentifier; + function isUseStrictPrologueDirective(sourceFile, node) { + ts.Debug.assert(ts.isPrologueDirective(node)); + var nodeText = ts.getSourceTextOfNodeFromSourceFile(sourceFile, node.expression); + return nodeText === '"use strict"' || nodeText === "'use strict'"; + } + var InvalidPosition; + (function (InvalidPosition) { + InvalidPosition[InvalidPosition["Value"] = -1] = "Value"; + })(InvalidPosition || (InvalidPosition = {})); + function createSyntaxCursor(sourceFile) { + var currentArray = sourceFile.statements; + var currentArrayIndex = 0; + ts.Debug.assert(currentArrayIndex < currentArray.length); + var current = currentArray[currentArrayIndex]; + var lastQueriedPosition = -1; + return { + currentNode: function (position) { + if (position !== lastQueriedPosition) { + if (current && current.end === position && currentArrayIndex < (currentArray.length - 1)) { + currentArrayIndex++; + current = currentArray[currentArrayIndex]; + } + if (!current || current.pos !== position) { + findHighestListElementThatStartsAtPosition(position); + } + } + lastQueriedPosition = position; + ts.Debug.assert(!current || current.pos === position); + return current; + } + }; + function findHighestListElementThatStartsAtPosition(position) { + currentArray = undefined; + currentArrayIndex = -1; + current = undefined; + forEachChild(sourceFile, visitNode, visitArray); + return; + function visitNode(node) { + if (position >= node.pos && position < node.end) { + forEachChild(node, visitNode, visitArray); + return true; + } + return false; + } + function visitArray(array) { + if (position >= array.pos && position < array.end) { + for (var i = 0, n = array.length; i < n; i++) { + var child = array[i]; + if (child) { + if (child.pos === position) { + currentArray = array; + currentArrayIndex = i; + current = child; + return true; + } + else { + if (child.pos < position && position < child.end) { + forEachChild(child, visitNode, visitArray); + return true; + } + } + } + } + } + return false; + } + } + } + function createSourceFile(fileName, sourceText, languageVersion, setParentNodes) { + if (setParentNodes === void 0) { setParentNodes = false; } + var start = new Date().getTime(); + var result = parseSourceFile(fileName, sourceText, languageVersion, undefined, setParentNodes); + ts.parseTime += new Date().getTime() - start; + return result; + } + ts.createSourceFile = createSourceFile; + function parseSourceFile(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes) { + if (setParentNodes === void 0) { setParentNodes = false; } + var parsingContext = 0; + var identifiers = {}; + var identifierCount = 0; + var nodeCount = 0; + var token; + var sourceFile = createNode(210, 0); + sourceFile.pos = 0; + sourceFile.end = sourceText.length; + sourceFile.text = sourceText; + sourceFile.parseDiagnostics = []; + sourceFile.bindDiagnostics = []; + sourceFile.languageVersion = languageVersion; + sourceFile.fileName = ts.normalizePath(fileName); + sourceFile.flags = ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? 1024 : 0; + var contextFlags = 0; + var parseErrorBeforeNextFinishedNode = false; + var scanner = ts.createScanner(languageVersion, true, sourceText, scanError); + token = nextToken(); + processReferenceComments(sourceFile); + sourceFile.statements = parseList(0, true, parseSourceElement); + ts.Debug.assert(token === 1); + sourceFile.endOfFileToken = parseTokenNode(); + setExternalModuleIndicator(sourceFile); + sourceFile.nodeCount = nodeCount; + sourceFile.identifierCount = identifierCount; + sourceFile.identifiers = identifiers; + if (setParentNodes) { + fixupParentReferences(sourceFile); + } + syntaxCursor = undefined; + return sourceFile; + function setContextFlag(val, flag) { + if (val) { + contextFlags |= flag; + } + else { + contextFlags &= ~flag; + } + } + function setStrictModeContext(val) { + setContextFlag(val, 1); + } + function setDisallowInContext(val) { + setContextFlag(val, 2); + } + function setYieldContext(val) { + setContextFlag(val, 4); + } + function setGeneratorParameterContext(val) { + setContextFlag(val, 8); + } + function allowInAnd(func) { + if (contextFlags & 2) { + setDisallowInContext(false); + var result = func(); + setDisallowInContext(true); + return result; + } + return func(); + } + function disallowInAnd(func) { + if (contextFlags & 2) { + return func(); + } + setDisallowInContext(true); + var result = func(); + setDisallowInContext(false); + return result; + } + function doInYieldContext(func) { + if (contextFlags & 4) { + return func(); + } + setYieldContext(true); + var result = func(); + setYieldContext(false); + return result; + } + function doOutsideOfYieldContext(func) { + if (contextFlags & 4) { + setYieldContext(false); + var result = func(); + setYieldContext(true); + return result; + } + return func(); + } + function inYieldContext() { + return (contextFlags & 4) !== 0; + } + function inStrictModeContext() { + return (contextFlags & 1) !== 0; + } + function inGeneratorParameterContext() { + return (contextFlags & 8) !== 0; + } + function inDisallowInContext() { + return (contextFlags & 2) !== 0; + } + function parseErrorAtCurrentToken(message, arg0) { + var start = scanner.getTokenPos(); + var length = scanner.getTextPos() - start; + parseErrorAtPosition(start, length, message, arg0); + } + function parseErrorAtPosition(start, length, message, arg0) { + var lastError = ts.lastOrUndefined(sourceFile.parseDiagnostics); + if (!lastError || start !== lastError.start) { + sourceFile.parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, start, length, message, arg0)); + } + parseErrorBeforeNextFinishedNode = true; + } + function scanError(message, length) { + var pos = scanner.getTextPos(); + parseErrorAtPosition(pos, length || 0, message); + } + function getNodePos() { + return scanner.getStartPos(); + } + function getNodeEnd() { + return scanner.getStartPos(); + } + function nextToken() { + return token = scanner.scan(); + } + function getTokenPos(pos) { + return ts.skipTrivia(sourceText, pos); + } + function reScanGreaterToken() { + return token = scanner.reScanGreaterToken(); + } + function reScanSlashToken() { + return token = scanner.reScanSlashToken(); + } + function reScanTemplateToken() { + return token = scanner.reScanTemplateToken(); + } + function speculationHelper(callback, isLookAhead) { + var saveToken = token; + var saveParseDiagnosticsLength = sourceFile.parseDiagnostics.length; + var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; + var saveContextFlags = contextFlags; + var result = isLookAhead ? scanner.lookAhead(callback) : scanner.tryScan(callback); + ts.Debug.assert(saveContextFlags === contextFlags); + if (!result || isLookAhead) { + token = saveToken; + sourceFile.parseDiagnostics.length = saveParseDiagnosticsLength; + parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode; + } + return result; + } + function lookAhead(callback) { + return speculationHelper(callback, true); + } + function tryParse(callback) { + return speculationHelper(callback, false); + } + function isIdentifier() { + if (token === 64) { + return true; + } + if (token === 109 && inYieldContext()) { + return false; + } + return inStrictModeContext() ? token > 109 : token > 100; + } + function parseExpected(kind, diagnosticMessage) { + if (token === kind) { + nextToken(); + return true; + } + if (diagnosticMessage) { + parseErrorAtCurrentToken(diagnosticMessage); + } + else { + parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind)); + } + return false; + } + function parseOptional(t) { + if (token === t) { + nextToken(); + return true; + } + return false; + } + function parseOptionalToken(t) { + if (token === t) { + var node = createNode(t); + nextToken(); + return finishNode(node); + } + return undefined; + } + function parseTokenNode() { + var node = createNode(token); + nextToken(); + return finishNode(node); + } + function canParseSemicolon() { + if (token === 22) { + return true; + } + return token === 15 || token === 1 || scanner.hasPrecedingLineBreak(); + } + function parseSemicolon() { + if (canParseSemicolon()) { + if (token === 22) { + nextToken(); + } + return true; + } + else { + return parseExpected(22); + } + } + function createNode(kind, pos) { + nodeCount++; + var node = new (nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)))(); + if (!(pos >= 0)) { + pos = scanner.getStartPos(); + } + node.pos = pos; + node.end = pos; + return node; + } + function finishNode(node) { + node.end = scanner.getStartPos(); + if (contextFlags) { + node.parserContextFlags = contextFlags; + } + if (parseErrorBeforeNextFinishedNode) { + parseErrorBeforeNextFinishedNode = false; + node.parserContextFlags |= 16; + } + return node; + } + function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, arg0) { + if (reportAtCurrentPosition) { + parseErrorAtPosition(scanner.getStartPos(), 0, diagnosticMessage, arg0); + } + else { + parseErrorAtCurrentToken(diagnosticMessage, arg0); + } + var result = createNode(kind, scanner.getStartPos()); + result.text = ""; + return finishNode(result); + } + function internIdentifier(text) { + text = ts.escapeIdentifier(text); + return ts.hasProperty(identifiers, text) ? identifiers[text] : (identifiers[text] = text); + } + function createIdentifier(isIdentifier, diagnosticMessage) { + identifierCount++; + if (isIdentifier) { + var node = createNode(64); + node.text = internIdentifier(scanner.getTokenValue()); + nextToken(); + return finishNode(node); + } + return createMissingNode(64, false, diagnosticMessage || ts.Diagnostics.Identifier_expected); + } + function parseIdentifier(diagnosticMessage) { + return createIdentifier(isIdentifier(), diagnosticMessage); + } + function parseIdentifierName() { + return createIdentifier(isIdentifierOrKeyword()); + } + function isLiteralPropertyName() { + return isIdentifierOrKeyword() || + token === 8 || + token === 7; + } + function parsePropertyName() { + if (token === 8 || token === 7) { + return parseLiteralNode(true); + } + if (token === 18) { + return parseComputedPropertyName(); + } + return parseIdentifierName(); + } + function parseComputedPropertyName() { + var node = createNode(124); + parseExpected(18); + var yieldContext = inYieldContext(); + if (inGeneratorParameterContext()) { + setYieldContext(false); + } + node.expression = allowInAnd(parseExpression); + if (inGeneratorParameterContext()) { + setYieldContext(yieldContext); + } + parseExpected(19); + return finishNode(node); + } + function parseContextualModifier(t) { + return token === t && tryParse(nextTokenCanFollowModifier); + } + function nextTokenCanFollowModifier() { + nextToken(); + return canFollowModifier(); + } + function parseAnyContextualModifier() { + return ts.isModifier(token) && tryParse(nextTokenCanFollowContextualModifier); + } + function nextTokenCanFollowContextualModifier() { + if (token === 69) { + return nextToken() === 76; + } + nextToken(); + return canFollowModifier(); + } + function canFollowModifier() { + return token === 18 || token === 14 || token === 35 || isLiteralPropertyName(); + } + function isListElement(parsingContext, inErrorRecovery) { + var node = currentNode(parsingContext); + if (node) { + return true; + } + switch (parsingContext) { + case 0: + case 1: + return isSourceElement(inErrorRecovery); + case 2: + case 4: + return isStartOfStatement(inErrorRecovery); + case 3: + return token === 66 || token === 72; + case 5: + return isStartOfTypeMember(); + case 6: + return lookAhead(isClassMemberStart); + case 7: + return token === 18 || isLiteralPropertyName(); + case 13: + return token === 18 || token === 35 || isLiteralPropertyName(); + case 10: + return isLiteralPropertyName(); + case 8: + return isIdentifier() && !isNotHeritageClauseTypeName(); + case 9: + return isIdentifierOrPattern(); + case 11: + return token === 23 || token === 21 || isIdentifierOrPattern(); + case 16: + return isIdentifier(); + case 12: + case 14: + return token === 23 || token === 21 || isStartOfExpression(); + case 15: + return isStartOfParameter(); + case 17: + case 18: + return token === 23 || isStartOfType(); + case 19: + return isHeritageClause(); + } + ts.Debug.fail("Non-exhaustive case in 'isListElement'."); + } + function nextTokenIsIdentifier() { + nextToken(); + return isIdentifier(); + } + function isNotHeritageClauseTypeName() { + if (token === 101 || + token === 78) { + return lookAhead(nextTokenIsIdentifier); + } + return false; + } + function isListTerminator(kind) { + if (token === 1) { + return true; + } + switch (kind) { + case 1: + case 2: + case 3: + case 5: + case 6: + case 7: + case 13: + case 10: + return token === 15; + case 4: + return token === 15 || token === 66 || token === 72; + case 8: + return token === 14 || token === 78 || token === 101; + case 9: + return isVariableDeclaratorListTerminator(); + case 16: + return token === 25 || token === 16 || token === 14 || token === 78 || token === 101; + case 12: + return token === 17 || token === 22; + case 14: + case 18: + case 11: + return token === 19; + case 15: + return token === 17 || token === 19; + case 17: + return token === 25 || token === 16; + case 19: + return token === 14 || token === 15; + } + } + function isVariableDeclaratorListTerminator() { + if (canParseSemicolon()) { + return true; + } + if (isInOrOfKeyword(token)) { + return true; + } + if (token === 32) { + return true; + } + return false; + } + function isInSomeParsingContext() { + for (var kind = 0; kind < 20; kind++) { + if (parsingContext & (1 << kind)) { + if (isListElement(kind, true) || isListTerminator(kind)) { + return true; + } + } + } + return false; + } + function parseList(kind, checkForStrictMode, parseElement) { + var saveParsingContext = parsingContext; + parsingContext |= 1 << kind; + var result = []; + result.pos = getNodePos(); + var savedStrictModeContext = inStrictModeContext(); + while (!isListTerminator(kind)) { + if (isListElement(kind, false)) { + var element = parseListElement(kind, parseElement); + result.push(element); + if (checkForStrictMode && !inStrictModeContext()) { + if (ts.isPrologueDirective(element)) { + if (isUseStrictPrologueDirective(sourceFile, element)) { + setStrictModeContext(true); + checkForStrictMode = false; + } + } + else { + checkForStrictMode = false; + } + } + continue; + } + if (abortParsingListOrMoveToNextToken(kind)) { + break; + } + } + setStrictModeContext(savedStrictModeContext); + result.end = getNodeEnd(); + parsingContext = saveParsingContext; + return result; + } + function parseListElement(parsingContext, parseElement) { + var node = currentNode(parsingContext); + if (node) { + return consumeNode(node); + } + return parseElement(); + } + function currentNode(parsingContext) { + if (parseErrorBeforeNextFinishedNode) { + return undefined; + } + if (!syntaxCursor) { + return undefined; + } + var node = syntaxCursor.currentNode(scanner.getStartPos()); + if (ts.nodeIsMissing(node)) { + return undefined; + } + if (node.intersectsChange) { + return undefined; + } + if (ts.containsParseError(node)) { + return undefined; + } + var nodeContextFlags = node.parserContextFlags & 31; + if (nodeContextFlags !== contextFlags) { + return undefined; + } + if (!canReuseNode(node, parsingContext)) { + return undefined; + } + return node; + } + function consumeNode(node) { + scanner.setTextPos(node.end); + nextToken(); + return node; + } + function canReuseNode(node, parsingContext) { + switch (parsingContext) { + case 1: + return isReusableModuleElement(node); + case 6: + return isReusableClassMember(node); + case 3: + return isReusableSwitchClause(node); + case 2: + case 4: + return isReusableStatement(node); + case 7: + return isReusableEnumMember(node); + case 5: + return isReusableTypeMember(node); + case 9: + return isReusableVariableDeclaration(node); + case 15: + return isReusableParameter(node); + case 19: + case 8: + case 16: + case 18: + case 17: + case 12: + case 13: + } + return false; + } + function isReusableModuleElement(node) { + if (node) { + switch (node.kind) { + case 200: + case 201: + case 194: + case 195: + case 198: + case 197: + return true; + } + return isReusableStatement(node); + } + return false; + } + function isReusableClassMember(node) { + if (node) { + switch (node.kind) { + case 131: + case 136: + case 130: + case 132: + case 133: + case 128: + return true; + } + } + return false; + } + function isReusableSwitchClause(node) { + if (node) { + switch (node.kind) { + case 203: + case 204: + return true; + } + } + return false; + } + function isReusableStatement(node) { + if (node) { + switch (node.kind) { + case 193: + case 173: + case 172: + case 176: + case 175: + case 188: + case 184: + case 186: + case 183: + case 182: + case 180: + case 181: + case 179: + case 178: + case 185: + case 174: + case 189: + case 187: + case 177: + case 190: + return true; + } + } + return false; + } + function isReusableEnumMember(node) { + return node.kind === 209; + } + function isReusableTypeMember(node) { + if (node) { + switch (node.kind) { + case 135: + case 129: + case 136: + case 127: + case 134: + return true; + } + } + return false; + } + function isReusableVariableDeclaration(node) { + if (node.kind !== 191) { + return false; + } + var variableDeclarator = node; + return variableDeclarator.initializer === undefined; + } + function isReusableParameter(node) { + if (node.kind !== 126) { + return false; + } + var parameter = node; + return parameter.initializer === undefined; + } + function abortParsingListOrMoveToNextToken(kind) { + parseErrorAtCurrentToken(parsingContextErrors(kind)); + if (isInSomeParsingContext()) { + return true; + } + nextToken(); + return false; + } + function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimeter) { + var saveParsingContext = parsingContext; + parsingContext |= 1 << kind; + var result = []; + result.pos = getNodePos(); + var commaStart = -1; + while (true) { + if (isListElement(kind, false)) { + result.push(parseListElement(kind, parseElement)); + commaStart = scanner.getTokenPos(); + if (parseOptional(23)) { + continue; + } + commaStart = -1; + if (isListTerminator(kind)) { + break; + } + parseExpected(23); + if (considerSemicolonAsDelimeter && token === 22 && !scanner.hasPrecedingLineBreak()) { + nextToken(); + } + continue; + } + if (isListTerminator(kind)) { + break; + } + if (abortParsingListOrMoveToNextToken(kind)) { + break; + } + } + if (commaStart >= 0) { + result.hasTrailingComma = true; + } + result.end = getNodeEnd(); + parsingContext = saveParsingContext; + return result; + } + function createMissingList() { + var pos = getNodePos(); + var result = []; + result.pos = pos; + result.end = pos; + return result; + } + function parseBracketedList(kind, parseElement, open, close) { + if (parseExpected(open)) { + var result = parseDelimitedList(kind, parseElement); + parseExpected(close); + return result; + } + return createMissingList(); + } + function parseEntityName(allowReservedWords, diagnosticMessage) { + var entity = parseIdentifier(diagnosticMessage); + while (parseOptional(20)) { + var node = createNode(123, entity.pos); + node.left = entity; + node.right = parseRightSideOfDot(allowReservedWords); + entity = finishNode(node); + } + return entity; + } + function parseRightSideOfDot(allowIdentifierNames) { + if (scanner.hasPrecedingLineBreak() && scanner.isReservedWord()) { + var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); + if (matchesPattern) { + return createMissingNode(64, true, ts.Diagnostics.Identifier_expected); + } + } + return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); + } + function parseTemplateExpression() { + var template = createNode(167); + template.head = parseLiteralNode(); + ts.Debug.assert(template.head.kind === 11, "Template head has wrong token kind"); + var templateSpans = []; + templateSpans.pos = getNodePos(); + do { + templateSpans.push(parseTemplateSpan()); + } while (templateSpans[templateSpans.length - 1].literal.kind === 12); + templateSpans.end = getNodeEnd(); + template.templateSpans = templateSpans; + return finishNode(template); + } + function parseTemplateSpan() { + var span = createNode(171); + span.expression = allowInAnd(parseExpression); + var literal; + if (token === 15) { + reScanTemplateToken(); + literal = parseLiteralNode(); + } + else { + literal = createMissingNode(13, false, ts.Diagnostics._0_expected, ts.tokenToString(15)); + } + span.literal = literal; + return finishNode(span); + } + function parseLiteralNode(internName) { + var node = createNode(token); + var text = scanner.getTokenValue(); + node.text = internName ? internIdentifier(text) : text; + if (scanner.isUnterminated()) { + node.isUnterminated = true; + } + var tokenPos = scanner.getTokenPos(); + nextToken(); + finishNode(node); + if (node.kind === 7 && sourceText.charCodeAt(tokenPos) === 48 && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { + node.flags |= 8192; + } + return node; + } + function parseTypeReference() { + var node = createNode(137); + node.typeName = parseEntityName(false, ts.Diagnostics.Type_expected); + if (!scanner.hasPrecedingLineBreak() && token === 24) { + node.typeArguments = parseBracketedList(17, parseType, 24, 25); + } + return finishNode(node); + } + function parseTypeQuery() { + var node = createNode(140); + parseExpected(96); + node.exprName = parseEntityName(true); + return finishNode(node); + } + function parseTypeParameter() { + var node = createNode(125); + node.name = parseIdentifier(); + if (parseOptional(78)) { + if (isStartOfType() || !isStartOfExpression()) { + node.constraint = parseType(); + } + else { + node.expression = parseUnaryExpressionOrHigher(); + } + } + return finishNode(node); + } + function parseTypeParameters() { + if (token === 24) { + return parseBracketedList(16, parseTypeParameter, 24, 25); + } + } + function parseParameterType() { + if (parseOptional(51)) { + return token === 8 ? parseLiteralNode(true) : parseType(); + } + return undefined; + } + function isStartOfParameter() { + return token === 21 || isIdentifierOrPattern() || ts.isModifier(token); + } + function setModifiers(node, modifiers) { + if (modifiers) { + node.flags |= modifiers.flags; + node.modifiers = modifiers; + } + } + function parseParameter() { + var node = createNode(126); + setModifiers(node, parseModifiers()); + node.dotDotDotToken = parseOptionalToken(21); + node.name = inGeneratorParameterContext() ? doInYieldContext(parseIdentifierOrPattern) : parseIdentifierOrPattern(); + if (ts.getFullWidth(node.name) === 0 && node.flags === 0 && ts.isModifier(token)) { + nextToken(); + } + node.questionToken = parseOptionalToken(50); + node.type = parseParameterType(); + node.initializer = inGeneratorParameterContext() ? doOutsideOfYieldContext(parseParameterInitializer) : parseParameterInitializer(); + return finishNode(node); + } + function parseParameterInitializer() { + return parseInitializer(true); + } + function fillSignature(returnToken, yieldAndGeneratorParameterContext, requireCompleteParameterList, signature) { + var returnTokenRequired = returnToken === 32; + signature.typeParameters = parseTypeParameters(); + signature.parameters = parseParameterList(yieldAndGeneratorParameterContext, requireCompleteParameterList); + if (returnTokenRequired) { + parseExpected(returnToken); + signature.type = parseType(); + } + else if (parseOptional(returnToken)) { + signature.type = parseType(); + } + } + function parseParameterList(yieldAndGeneratorParameterContext, requireCompleteParameterList) { + if (parseExpected(16)) { + var savedYieldContext = inYieldContext(); + var savedGeneratorParameterContext = inGeneratorParameterContext(); + setYieldContext(yieldAndGeneratorParameterContext); + setGeneratorParameterContext(yieldAndGeneratorParameterContext); + var result = parseDelimitedList(15, parseParameter); + setYieldContext(savedYieldContext); + setGeneratorParameterContext(savedGeneratorParameterContext); + if (!parseExpected(17) && requireCompleteParameterList) { + return undefined; + } + return result; + } + return requireCompleteParameterList ? undefined : createMissingList(); + } + function parseTypeMemberSemicolon() { + if (parseSemicolon()) { + return; + } + parseOptional(23); + } + function parseSignatureMember(kind) { + var node = createNode(kind); + if (kind === 135) { + parseExpected(87); + } + fillSignature(51, false, false, node); + parseTypeMemberSemicolon(); + return finishNode(node); + } + function isIndexSignature() { + if (token !== 18) { + return false; + } + return lookAhead(isUnambiguouslyIndexSignature); + } + function isUnambiguouslyIndexSignature() { + nextToken(); + if (token === 21 || token === 19) { + return true; + } + if (ts.isModifier(token)) { + nextToken(); + if (isIdentifier()) { + return true; + } + } + else if (!isIdentifier()) { + return false; + } + else { + nextToken(); + } + if (token === 51 || token === 23) { + return true; + } + if (token !== 50) { + return false; + } + nextToken(); + return token === 51 || token === 23 || token === 19; + } + function parseIndexSignatureDeclaration(modifiers) { + var fullStart = modifiers ? modifiers.pos : scanner.getStartPos(); + var node = createNode(136, fullStart); + setModifiers(node, modifiers); + node.parameters = parseBracketedList(15, parseParameter, 18, 19); + node.type = parseTypeAnnotation(); + parseTypeMemberSemicolon(); + return finishNode(node); + } + function parsePropertyOrMethodSignature() { + var fullStart = scanner.getStartPos(); + var name = parsePropertyName(); + var questionToken = parseOptionalToken(50); + if (token === 16 || token === 24) { + var method = createNode(129, fullStart); + method.name = name; + method.questionToken = questionToken; + fillSignature(51, false, false, method); + parseTypeMemberSemicolon(); + return finishNode(method); + } + else { + var property = createNode(127, fullStart); + property.name = name; + property.questionToken = questionToken; + property.type = parseTypeAnnotation(); + parseTypeMemberSemicolon(); + return finishNode(property); + } + } + function isStartOfTypeMember() { + switch (token) { + case 16: + case 24: + case 18: + return true; + default: + if (ts.isModifier(token)) { + var result = lookAhead(isStartOfIndexSignatureDeclaration); + if (result) { + return result; + } + } + return isLiteralPropertyName() && lookAhead(isTypeMemberWithLiteralPropertyName); + } + } + function isStartOfIndexSignatureDeclaration() { + while (ts.isModifier(token)) { + nextToken(); + } + return isIndexSignature(); + } + function isTypeMemberWithLiteralPropertyName() { + nextToken(); + return token === 16 || + token === 24 || + token === 50 || + token === 51 || + canParseSemicolon(); + } + function parseTypeMember() { + switch (token) { + case 16: + case 24: + return parseSignatureMember(134); + case 18: + return isIndexSignature() ? parseIndexSignatureDeclaration(undefined) : parsePropertyOrMethodSignature(); + case 87: + if (lookAhead(isStartOfConstructSignature)) { + return parseSignatureMember(135); + } + case 8: + case 7: + return parsePropertyOrMethodSignature(); + default: + if (ts.isModifier(token)) { + var result = tryParse(parseIndexSignatureWithModifiers); + if (result) { + return result; + } + } + if (isIdentifierOrKeyword()) { + return parsePropertyOrMethodSignature(); + } + } + } + function parseIndexSignatureWithModifiers() { + var modifiers = parseModifiers(); + return isIndexSignature() ? parseIndexSignatureDeclaration(modifiers) : undefined; + } + function isStartOfConstructSignature() { + nextToken(); + return token === 16 || token === 24; + } + function parseTypeLiteral() { + var node = createNode(141); + node.members = parseObjectTypeMembers(); + return finishNode(node); + } + function parseObjectTypeMembers() { + var members; + if (parseExpected(14)) { + members = parseList(5, false, parseTypeMember); + parseExpected(15); + } + else { + members = createMissingList(); + } + return members; + } + function parseTupleType() { + var node = createNode(143); + node.elementTypes = parseBracketedList(18, parseType, 18, 19); + return finishNode(node); + } + function parseParenthesizedType() { + var node = createNode(145); + parseExpected(16); + node.type = parseType(); + parseExpected(17); + return finishNode(node); + } + function parseFunctionOrConstructorType(kind) { + var node = createNode(kind); + if (kind === 139) { + parseExpected(87); + } + fillSignature(32, false, false, node); + return finishNode(node); + } + function parseKeywordAndNoDot() { + var node = parseTokenNode(); + return token === 20 ? undefined : node; + } + function parseNonArrayType() { + switch (token) { + case 110: + case 119: + case 117: + case 111: + case 120: + var node = tryParse(parseKeywordAndNoDot); + return node || parseTypeReference(); + case 98: + return parseTokenNode(); + case 96: + return parseTypeQuery(); + case 14: + return parseTypeLiteral(); + case 18: + return parseTupleType(); + case 16: + return parseParenthesizedType(); + default: + return parseTypeReference(); + } + } + function isStartOfType() { + switch (token) { + case 110: + case 119: + case 117: + case 111: + case 120: + case 98: + case 96: + case 14: + case 18: + case 24: + case 87: + return true; + case 16: + return lookAhead(isStartOfParenthesizedOrFunctionType); + default: + return isIdentifier(); + } + } + function isStartOfParenthesizedOrFunctionType() { + nextToken(); + return token === 17 || isStartOfParameter() || isStartOfType(); + } + function parseArrayTypeOrHigher() { + var type = parseNonArrayType(); + while (!scanner.hasPrecedingLineBreak() && parseOptional(18)) { + parseExpected(19); + var node = createNode(142, type.pos); + node.elementType = type; + type = finishNode(node); + } + return type; + } + function parseUnionTypeOrHigher() { + var type = parseArrayTypeOrHigher(); + if (token === 44) { + var types = [type]; + types.pos = type.pos; + while (parseOptional(44)) { + types.push(parseArrayTypeOrHigher()); + } + types.end = getNodeEnd(); + var node = createNode(144, type.pos); + node.types = types; + type = finishNode(node); + } + return type; + } + function isStartOfFunctionType() { + if (token === 24) { + return true; + } + return token === 16 && lookAhead(isUnambiguouslyStartOfFunctionType); + } + function isUnambiguouslyStartOfFunctionType() { + nextToken(); + if (token === 17 || token === 21) { + return true; + } + if (isIdentifier() || ts.isModifier(token)) { + nextToken(); + if (token === 51 || token === 23 || + token === 50 || token === 52 || + isIdentifier() || ts.isModifier(token)) { + return true; + } + if (token === 17) { + nextToken(); + if (token === 32) { + return true; + } + } + } + return false; + } + function parseType() { + var savedYieldContext = inYieldContext(); + var savedGeneratorParameterContext = inGeneratorParameterContext(); + setYieldContext(false); + setGeneratorParameterContext(false); + var result = parseTypeWorker(); + setYieldContext(savedYieldContext); + setGeneratorParameterContext(savedGeneratorParameterContext); + return result; + } + function parseTypeWorker() { + if (isStartOfFunctionType()) { + return parseFunctionOrConstructorType(138); + } + if (token === 87) { + return parseFunctionOrConstructorType(139); + } + return parseUnionTypeOrHigher(); + } + function parseTypeAnnotation() { + return parseOptional(51) ? parseType() : undefined; + } + function isStartOfExpression() { + switch (token) { + case 92: + case 90: + case 88: + case 94: + case 79: + case 7: + case 8: + case 10: + case 11: + case 16: + case 18: + case 14: + case 82: + case 87: + case 36: + case 56: + case 33: + case 34: + case 47: + case 46: + case 73: + case 96: + case 98: + case 38: + case 39: + case 24: + case 64: + case 109: + return true; + default: + if (isBinaryOperator()) { + return true; + } + return isIdentifier(); + } + } + function isStartOfExpressionStatement() { + return token !== 14 && token !== 82 && isStartOfExpression(); + } + function parseExpression() { + var expr = parseAssignmentExpressionOrHigher(); + var operatorToken; + while ((operatorToken = parseOptionalToken(23))) { + expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher()); + } + return expr; + } + function parseInitializer(inParameter) { + if (token !== 52) { + if (scanner.hasPrecedingLineBreak() || (inParameter && token === 14) || !isStartOfExpression()) { + return undefined; + } + } + parseExpected(52); + return parseAssignmentExpressionOrHigher(); + } + function parseAssignmentExpressionOrHigher() { + if (isYieldExpression()) { + return parseYieldExpression(); + } + var arrowExpression = tryParseParenthesizedArrowFunctionExpression(); + if (arrowExpression) { + return arrowExpression; + } + var expr = parseBinaryExpressionOrHigher(0); + if (expr.kind === 64 && token === 32) { + return parseSimpleArrowFunctionExpression(expr); + } + if (isLeftHandSideExpression(expr) && isAssignmentOperator(reScanGreaterToken())) { + return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher()); + } + return parseConditionalExpressionRest(expr); + } + function isYieldExpression() { + if (token === 109) { + if (inYieldContext()) { + return true; + } + if (inStrictModeContext()) { + return true; + } + return lookAhead(nextTokenIsIdentifierOnSameLine); + } + return false; + } + function nextTokenIsIdentifierOnSameLine() { + nextToken(); + return !scanner.hasPrecedingLineBreak() && isIdentifier(); + } + function parseYieldExpression() { + var node = createNode(168); + nextToken(); + if (!scanner.hasPrecedingLineBreak() && + (token === 35 || isStartOfExpression())) { + node.asteriskToken = parseOptionalToken(35); + node.expression = parseAssignmentExpressionOrHigher(); + return finishNode(node); + } + else { + return finishNode(node); + } + } + function parseSimpleArrowFunctionExpression(identifier) { + ts.Debug.assert(token === 32, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); + var node = createNode(159, identifier.pos); + var parameter = createNode(126, identifier.pos); + parameter.name = identifier; + finishNode(parameter); + node.parameters = [parameter]; + node.parameters.pos = parameter.pos; + node.parameters.end = parameter.end; + parseExpected(32); + node.body = parseArrowFunctionExpressionBody(); + return finishNode(node); + } + function tryParseParenthesizedArrowFunctionExpression() { + var triState = isParenthesizedArrowFunctionExpression(); + if (triState === 0) { + return undefined; + } + var arrowFunction = triState === 1 ? parseParenthesizedArrowFunctionExpressionHead(true) : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); + if (!arrowFunction) { + return undefined; + } + if (parseExpected(32) || token === 14) { + arrowFunction.body = parseArrowFunctionExpressionBody(); + } + else { + arrowFunction.body = parseIdentifier(); + } + return finishNode(arrowFunction); + } + function isParenthesizedArrowFunctionExpression() { + if (token === 16 || token === 24) { + return lookAhead(isParenthesizedArrowFunctionExpressionWorker); + } + if (token === 32) { + return 1; + } + return 0; + } + function isParenthesizedArrowFunctionExpressionWorker() { + var first = token; + var second = nextToken(); + if (first === 16) { + if (second === 17) { + var third = nextToken(); + switch (third) { + case 32: + case 51: + case 14: + return 1; + default: + return 0; + } + } + if (second === 21) { + return 1; + } + if (!isIdentifier()) { + return 0; + } + if (nextToken() === 51) { + return 1; + } + return 2; + } + else { + ts.Debug.assert(first === 24); + if (!isIdentifier()) { + return 0; + } + return 2; + } + } + function parsePossibleParenthesizedArrowFunctionExpressionHead() { + return parseParenthesizedArrowFunctionExpressionHead(false); + } + function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { + var node = createNode(159); + fillSignature(51, false, !allowAmbiguity, node); + if (!node.parameters) { + return undefined; + } + if (!allowAmbiguity && token !== 32 && token !== 14) { + return undefined; + } + return node; + } + function parseArrowFunctionExpressionBody() { + if (token === 14) { + return parseFunctionBlock(false, false); + } + if (isStartOfStatement(true) && !isStartOfExpressionStatement() && token !== 82) { + return parseFunctionBlock(false, true); + } + return parseAssignmentExpressionOrHigher(); + } + function parseConditionalExpressionRest(leftOperand) { + if (!parseOptional(50)) { + return leftOperand; + } + var node = createNode(166, leftOperand.pos); + node.condition = leftOperand; + node.whenTrue = allowInAnd(parseAssignmentExpressionOrHigher); + parseExpected(51); + node.whenFalse = parseAssignmentExpressionOrHigher(); + return finishNode(node); + } + function parseBinaryExpressionOrHigher(precedence) { + var leftOperand = parseUnaryExpressionOrHigher(); + return parseBinaryExpressionRest(precedence, leftOperand); + } + function isInOrOfKeyword(t) { + return t === 85 || t === 122; + } + function parseBinaryExpressionRest(precedence, leftOperand) { + while (true) { + reScanGreaterToken(); + var newPrecedence = getBinaryOperatorPrecedence(); + if (newPrecedence <= precedence) { + break; + } + if (token === 85 && inDisallowInContext()) { + break; + } + leftOperand = makeBinaryExpression(leftOperand, parseTokenNode(), parseBinaryExpressionOrHigher(newPrecedence)); + } + return leftOperand; + } + function isBinaryOperator() { + if (inDisallowInContext() && token === 85) { + return false; + } + return getBinaryOperatorPrecedence() > 0; + } + function getBinaryOperatorPrecedence() { + switch (token) { + case 49: + return 1; + case 48: + return 2; + case 44: + return 3; + case 45: + return 4; + case 43: + return 5; + case 28: + case 29: + case 30: + case 31: + return 6; + case 24: + case 25: + case 26: + case 27: + case 86: + case 85: + return 7; + case 40: + case 41: + case 42: + return 8; + case 33: + case 34: + return 9; + case 35: + case 36: + case 37: + return 10; + } + return -1; + } + function makeBinaryExpression(left, operatorToken, right) { + var node = createNode(165, left.pos); + node.left = left; + node.operatorToken = operatorToken; + node.right = right; + return finishNode(node); + } + function parsePrefixUnaryExpression() { + var node = createNode(163); + node.operator = token; + nextToken(); + node.operand = parseUnaryExpressionOrHigher(); + return finishNode(node); + } + function parseDeleteExpression() { + var node = createNode(160); + nextToken(); + node.expression = parseUnaryExpressionOrHigher(); + return finishNode(node); + } + function parseTypeOfExpression() { + var node = createNode(161); + nextToken(); + node.expression = parseUnaryExpressionOrHigher(); + return finishNode(node); + } + function parseVoidExpression() { + var node = createNode(162); + nextToken(); + node.expression = parseUnaryExpressionOrHigher(); + return finishNode(node); + } + function parseUnaryExpressionOrHigher() { + switch (token) { + case 33: + case 34: + case 47: + case 46: + case 38: + case 39: + return parsePrefixUnaryExpression(); + case 73: + return parseDeleteExpression(); + case 96: + return parseTypeOfExpression(); + case 98: + return parseVoidExpression(); + case 24: + return parseTypeAssertion(); + default: + return parsePostfixExpressionOrHigher(); + } + } + function parsePostfixExpressionOrHigher() { + var expression = parseLeftHandSideExpressionOrHigher(); + ts.Debug.assert(isLeftHandSideExpression(expression)); + if ((token === 38 || token === 39) && !scanner.hasPrecedingLineBreak()) { + var node = createNode(164, expression.pos); + node.operand = expression; + node.operator = token; + nextToken(); + return finishNode(node); + } + return expression; + } + function parseLeftHandSideExpressionOrHigher() { + var expression = token === 90 ? parseSuperExpression() : parseMemberExpressionOrHigher(); + return parseCallExpressionRest(expression); + } + function parseMemberExpressionOrHigher() { + var expression = parsePrimaryExpression(); + return parseMemberExpressionRest(expression); + } + function parseSuperExpression() { + var expression = parseTokenNode(); + if (token === 16 || token === 20) { + return expression; + } + var node = createNode(151, expression.pos); + node.expression = expression; + parseExpected(20, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); + node.name = parseRightSideOfDot(true); + return finishNode(node); + } + function parseTypeAssertion() { + var node = createNode(156); + parseExpected(24); + node.type = parseType(); + parseExpected(25); + node.expression = parseUnaryExpressionOrHigher(); + return finishNode(node); + } + function parseMemberExpressionRest(expression) { + while (true) { + var dotOrBracketStart = scanner.getTokenPos(); + if (parseOptional(20)) { + var propertyAccess = createNode(151, expression.pos); + propertyAccess.expression = expression; + propertyAccess.name = parseRightSideOfDot(true); + expression = finishNode(propertyAccess); + continue; + } + if (parseOptional(18)) { + var indexedAccess = createNode(152, expression.pos); + indexedAccess.expression = expression; + if (token !== 19) { + indexedAccess.argumentExpression = allowInAnd(parseExpression); + if (indexedAccess.argumentExpression.kind === 8 || indexedAccess.argumentExpression.kind === 7) { + var literal = indexedAccess.argumentExpression; + literal.text = internIdentifier(literal.text); + } + } + parseExpected(19); + expression = finishNode(indexedAccess); + continue; + } + if (token === 10 || token === 11) { + var tagExpression = createNode(155, expression.pos); + tagExpression.tag = expression; + tagExpression.template = token === 10 ? parseLiteralNode() : parseTemplateExpression(); + expression = finishNode(tagExpression); + continue; + } + return expression; + } + } + function parseCallExpressionRest(expression) { + while (true) { + expression = parseMemberExpressionRest(expression); + if (token === 24) { + var typeArguments = tryParse(parseTypeArgumentsInExpression); + if (!typeArguments) { + return expression; + } + var callExpr = createNode(153, expression.pos); + callExpr.expression = expression; + callExpr.typeArguments = typeArguments; + callExpr.arguments = parseArgumentList(); + expression = finishNode(callExpr); + continue; + } + else if (token === 16) { + var callExpr = createNode(153, expression.pos); + callExpr.expression = expression; + callExpr.arguments = parseArgumentList(); + expression = finishNode(callExpr); + continue; + } + return expression; + } + } + function parseArgumentList() { + parseExpected(16); + var result = parseDelimitedList(12, parseArgumentExpression); + parseExpected(17); + return result; + } + function parseTypeArgumentsInExpression() { + if (!parseOptional(24)) { + return undefined; + } + var typeArguments = parseDelimitedList(17, parseType); + if (!parseExpected(25)) { + return undefined; + } + return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined; + } + function canFollowTypeArgumentsInExpression() { + switch (token) { + case 16: + case 20: + case 17: + case 19: + case 51: + case 22: + case 23: + case 50: + case 28: + case 30: + case 29: + case 31: + case 48: + case 49: + case 45: + case 43: + case 44: + case 15: + case 1: + return true; + default: + return false; + } + } + function parsePrimaryExpression() { + switch (token) { + case 7: + case 8: + case 10: + return parseLiteralNode(); + case 92: + case 90: + case 88: + case 94: + case 79: + return parseTokenNode(); + case 16: + return parseParenthesizedExpression(); + case 18: + return parseArrayLiteralExpression(); + case 14: + return parseObjectLiteralExpression(); + case 82: + return parseFunctionExpression(); + case 87: + return parseNewExpression(); + case 36: + case 56: + if (reScanSlashToken() === 9) { + return parseLiteralNode(); + } + break; + case 11: + return parseTemplateExpression(); + } + return parseIdentifier(ts.Diagnostics.Expression_expected); + } + function parseParenthesizedExpression() { + var node = createNode(157); + parseExpected(16); + node.expression = allowInAnd(parseExpression); + parseExpected(17); + return finishNode(node); + } + function parseSpreadElement() { + var node = createNode(169); + parseExpected(21); + node.expression = parseAssignmentExpressionOrHigher(); + return finishNode(node); + } + function parseArgumentOrArrayLiteralElement() { + return token === 21 ? parseSpreadElement() : token === 23 ? createNode(170) : parseAssignmentExpressionOrHigher(); + } + function parseArgumentExpression() { + return allowInAnd(parseArgumentOrArrayLiteralElement); + } + function parseArrayLiteralExpression() { + var node = createNode(149); + parseExpected(18); + if (scanner.hasPrecedingLineBreak()) + node.flags |= 256; + node.elements = parseDelimitedList(14, parseArgumentOrArrayLiteralElement); + parseExpected(19); + return finishNode(node); + } + function tryParseAccessorDeclaration(fullStart, modifiers) { + if (parseContextualModifier(114)) { + return parseAccessorDeclaration(132, fullStart, modifiers); + } + else if (parseContextualModifier(118)) { + return parseAccessorDeclaration(133, fullStart, modifiers); + } + return undefined; + } + function parseObjectLiteralElement() { + var fullStart = scanner.getStartPos(); + var modifiers = parseModifiers(); + var accessor = tryParseAccessorDeclaration(fullStart, modifiers); + if (accessor) { + return accessor; + } + var asteriskToken = parseOptionalToken(35); + var tokenIsIdentifier = isIdentifier(); + var nameToken = token; + var propertyName = parsePropertyName(); + var questionToken = parseOptionalToken(50); + if (asteriskToken || token === 16 || token === 24) { + return parseMethodDeclaration(fullStart, modifiers, asteriskToken, propertyName, questionToken); + } + if ((token === 23 || token === 15) && tokenIsIdentifier) { + var shorthandDeclaration = createNode(208, fullStart); + shorthandDeclaration.name = propertyName; + shorthandDeclaration.questionToken = questionToken; + return finishNode(shorthandDeclaration); + } + else { + var propertyAssignment = createNode(207, fullStart); + propertyAssignment.name = propertyName; + propertyAssignment.questionToken = questionToken; + parseExpected(51); + propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher); + return finishNode(propertyAssignment); + } + } + function parseObjectLiteralExpression() { + var node = createNode(150); + parseExpected(14); + if (scanner.hasPrecedingLineBreak()) { + node.flags |= 256; + } + node.properties = parseDelimitedList(13, parseObjectLiteralElement, true); + parseExpected(15); + return finishNode(node); + } + function parseFunctionExpression() { + var node = createNode(158); + parseExpected(82); + node.asteriskToken = parseOptionalToken(35); + node.name = node.asteriskToken ? doInYieldContext(parseOptionalIdentifier) : parseOptionalIdentifier(); + fillSignature(51, !!node.asteriskToken, false, node); + node.body = parseFunctionBlock(!!node.asteriskToken, false); + return finishNode(node); + } + function parseOptionalIdentifier() { + return isIdentifier() ? parseIdentifier() : undefined; + } + function parseNewExpression() { + var node = createNode(154); + parseExpected(87); + node.expression = parseMemberExpressionOrHigher(); + node.typeArguments = tryParse(parseTypeArgumentsInExpression); + if (node.typeArguments || token === 16) { + node.arguments = parseArgumentList(); + } + return finishNode(node); + } + function parseBlock(ignoreMissingOpenBrace, checkForStrictMode, diagnosticMessage) { + var node = createNode(172); + if (parseExpected(14, diagnosticMessage) || ignoreMissingOpenBrace) { + node.statements = parseList(2, checkForStrictMode, parseStatement); + parseExpected(15); + } + else { + node.statements = createMissingList(); + } + return finishNode(node); + } + function parseFunctionBlock(allowYield, ignoreMissingOpenBrace, diagnosticMessage) { + var savedYieldContext = inYieldContext(); + setYieldContext(allowYield); + var block = parseBlock(ignoreMissingOpenBrace, true, diagnosticMessage); + setYieldContext(savedYieldContext); + return block; + } + function parseEmptyStatement() { + var node = createNode(174); + parseExpected(22); + return finishNode(node); + } + function parseIfStatement() { + var node = createNode(176); + parseExpected(83); + parseExpected(16); + node.expression = allowInAnd(parseExpression); + parseExpected(17); + node.thenStatement = parseStatement(); + node.elseStatement = parseOptional(75) ? parseStatement() : undefined; + return finishNode(node); + } + function parseDoStatement() { + var node = createNode(177); + parseExpected(74); + node.statement = parseStatement(); + parseExpected(99); + parseExpected(16); + node.expression = allowInAnd(parseExpression); + parseExpected(17); + parseOptional(22); + return finishNode(node); + } + function parseWhileStatement() { + var node = createNode(178); + parseExpected(99); + parseExpected(16); + node.expression = allowInAnd(parseExpression); + parseExpected(17); + node.statement = parseStatement(); + return finishNode(node); + } + function parseForOrForInOrForOfStatement() { + var pos = getNodePos(); + parseExpected(81); + parseExpected(16); + var initializer = undefined; + if (token !== 22) { + if (token === 97 || token === 103 || token === 69) { + initializer = parseVariableDeclarationList(true); + } + else { + initializer = disallowInAnd(parseExpression); + } + } + var forOrForInOrForOfStatement; + if (parseOptional(85)) { + var forInStatement = createNode(180, pos); + forInStatement.initializer = initializer; + forInStatement.expression = allowInAnd(parseExpression); + parseExpected(17); + forOrForInOrForOfStatement = forInStatement; + } + else if (parseOptional(122)) { + var forOfStatement = createNode(181, pos); + forOfStatement.initializer = initializer; + forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); + parseExpected(17); + forOrForInOrForOfStatement = forOfStatement; + } + else { + var forStatement = createNode(179, pos); + forStatement.initializer = initializer; + parseExpected(22); + if (token !== 22 && token !== 17) { + forStatement.condition = allowInAnd(parseExpression); + } + parseExpected(22); + if (token !== 17) { + forStatement.iterator = allowInAnd(parseExpression); + } + parseExpected(17); + forOrForInOrForOfStatement = forStatement; + } + forOrForInOrForOfStatement.statement = parseStatement(); + return finishNode(forOrForInOrForOfStatement); + } + function parseBreakOrContinueStatement(kind) { + var node = createNode(kind); + parseExpected(kind === 183 ? 65 : 70); + if (!canParseSemicolon()) { + node.label = parseIdentifier(); + } + parseSemicolon(); + return finishNode(node); + } + function parseReturnStatement() { + var node = createNode(184); + parseExpected(89); + if (!canParseSemicolon()) { + node.expression = allowInAnd(parseExpression); + } + parseSemicolon(); + return finishNode(node); + } + function parseWithStatement() { + var node = createNode(185); + parseExpected(100); + parseExpected(16); + node.expression = allowInAnd(parseExpression); + parseExpected(17); + node.statement = parseStatement(); + return finishNode(node); + } + function parseCaseClause() { + var node = createNode(203); + parseExpected(66); + node.expression = allowInAnd(parseExpression); + parseExpected(51); + node.statements = parseList(4, false, parseStatement); + return finishNode(node); + } + function parseDefaultClause() { + var node = createNode(204); + parseExpected(72); + parseExpected(51); + node.statements = parseList(4, false, parseStatement); + return finishNode(node); + } + function parseCaseOrDefaultClause() { + return token === 66 ? parseCaseClause() : parseDefaultClause(); + } + function parseSwitchStatement() { + var node = createNode(186); + parseExpected(91); + parseExpected(16); + node.expression = allowInAnd(parseExpression); + parseExpected(17); + parseExpected(14); + node.clauses = parseList(3, false, parseCaseOrDefaultClause); + parseExpected(15); + return finishNode(node); + } + function parseThrowStatement() { + var node = createNode(188); + parseExpected(93); + node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); + parseSemicolon(); + return finishNode(node); + } + function parseTryStatement() { + var node = createNode(189); + parseExpected(95); + node.tryBlock = parseBlock(false, false); + node.catchClause = token === 67 ? parseCatchClause() : undefined; + if (!node.catchClause || token === 80) { + parseExpected(80); + node.finallyBlock = parseBlock(false, false); + } + return finishNode(node); + } + function parseCatchClause() { + var result = createNode(206); + parseExpected(67); + parseExpected(16); + result.name = parseIdentifier(); + result.type = parseTypeAnnotation(); + parseExpected(17); + result.block = parseBlock(false, false); + return finishNode(result); + } + function parseDebuggerStatement() { + var node = createNode(190); + parseExpected(71); + parseSemicolon(); + return finishNode(node); + } + function parseExpressionOrLabeledStatement() { + var fullStart = scanner.getStartPos(); + var expression = allowInAnd(parseExpression); + if (expression.kind === 64 && parseOptional(51)) { + var labeledStatement = createNode(187, fullStart); + labeledStatement.label = expression; + labeledStatement.statement = parseStatement(); + return finishNode(labeledStatement); + } + else { + var expressionStatement = createNode(175, fullStart); + expressionStatement.expression = expression; + parseSemicolon(); + return finishNode(expressionStatement); + } + } + function isStartOfStatement(inErrorRecovery) { + if (ts.isModifier(token)) { + var result = lookAhead(parseVariableStatementOrFunctionDeclarationWithModifiers); + if (result) { + return true; + } + } + switch (token) { + case 22: + return !inErrorRecovery; + case 14: + case 97: + case 103: + case 82: + case 83: + case 74: + case 99: + case 81: + case 70: + case 65: + case 89: + case 100: + case 91: + case 93: + case 95: + case 71: + case 67: + case 80: + return true; + case 69: + var isConstEnum = lookAhead(nextTokenIsEnumKeyword); + return !isConstEnum; + case 102: + case 68: + case 115: + case 76: + case 121: + if (isDeclarationStart()) { + return false; + } + case 107: + case 105: + case 106: + case 108: + if (lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine)) { + return false; + } + default: + return isStartOfExpression(); + } + } + function nextTokenIsEnumKeyword() { + nextToken(); + return token === 76; + } + function nextTokenIsIdentifierOrKeywordOnSameLine() { + nextToken(); + return isIdentifierOrKeyword() && !scanner.hasPrecedingLineBreak(); + } + function parseStatement() { + switch (token) { + case 14: + return parseBlock(false, false); + case 97: + case 69: + return parseVariableStatement(scanner.getStartPos(), undefined); + case 82: + return parseFunctionDeclaration(scanner.getStartPos(), undefined); + case 22: + return parseEmptyStatement(); + case 83: + return parseIfStatement(); + case 74: + return parseDoStatement(); + case 99: + return parseWhileStatement(); + case 81: + return parseForOrForInOrForOfStatement(); + case 70: + return parseBreakOrContinueStatement(182); + case 65: + return parseBreakOrContinueStatement(183); + case 89: + return parseReturnStatement(); + case 100: + return parseWithStatement(); + case 91: + return parseSwitchStatement(); + case 93: + return parseThrowStatement(); + case 95: + case 67: + case 80: + return parseTryStatement(); + case 71: + return parseDebuggerStatement(); + case 103: + if (isLetDeclaration()) { + return parseVariableStatement(scanner.getStartPos(), undefined); + } + default: + if (ts.isModifier(token)) { + var result = tryParse(parseVariableStatementOrFunctionDeclarationWithModifiers); + if (result) { + return result; + } + } + return parseExpressionOrLabeledStatement(); + } + } + function parseVariableStatementOrFunctionDeclarationWithModifiers() { + var start = scanner.getStartPos(); + var modifiers = parseModifiers(); + switch (token) { + case 69: + var nextTokenIsEnum = lookAhead(nextTokenIsEnumKeyword); + if (nextTokenIsEnum) { + return undefined; + } + return parseVariableStatement(start, modifiers); + case 103: + if (!isLetDeclaration()) { + return undefined; + } + return parseVariableStatement(start, modifiers); + case 97: + return parseVariableStatement(start, modifiers); + case 82: + return parseFunctionDeclaration(start, modifiers); + } + return undefined; + } + function parseFunctionBlockOrSemicolon(isGenerator, diagnosticMessage) { + if (token !== 14 && canParseSemicolon()) { + parseSemicolon(); + return; + } + return parseFunctionBlock(isGenerator, false, diagnosticMessage); + } + function parseArrayBindingElement() { + if (token === 23) { + return createNode(170); + } + var node = createNode(148); + node.dotDotDotToken = parseOptionalToken(21); + node.name = parseIdentifierOrPattern(); + node.initializer = parseInitializer(false); + return finishNode(node); + } + function parseObjectBindingElement() { + var node = createNode(148); + var id = parsePropertyName(); + if (id.kind === 64 && token !== 51) { + node.name = id; + } + else { + parseExpected(51); + node.propertyName = id; + node.name = parseIdentifierOrPattern(); + } + node.initializer = parseInitializer(false); + return finishNode(node); + } + function parseObjectBindingPattern() { + var node = createNode(146); + parseExpected(14); + node.elements = parseDelimitedList(10, parseObjectBindingElement); + parseExpected(15); + return finishNode(node); + } + function parseArrayBindingPattern() { + var node = createNode(147); + parseExpected(18); + node.elements = parseDelimitedList(11, parseArrayBindingElement); + parseExpected(19); + return finishNode(node); + } + function isIdentifierOrPattern() { + return token === 14 || token === 18 || isIdentifier(); + } + function parseIdentifierOrPattern() { + if (token === 18) { + return parseArrayBindingPattern(); + } + if (token === 14) { + return parseObjectBindingPattern(); + } + return parseIdentifier(); + } + function parseVariableDeclaration() { + var node = createNode(191); + node.name = parseIdentifierOrPattern(); + node.type = parseTypeAnnotation(); + if (!isInOrOfKeyword(token)) { + node.initializer = parseInitializer(false); + } + return finishNode(node); + } + function parseVariableDeclarationList(inForStatementInitializer) { + var node = createNode(192); + switch (token) { + case 97: + break; + case 103: + node.flags |= 2048; + break; + case 69: + node.flags |= 4096; + break; + default: + ts.Debug.fail(); + } + nextToken(); + if (token === 122 && lookAhead(canFollowContextualOfKeyword)) { + node.declarations = createMissingList(); + } + else { + var savedDisallowIn = inDisallowInContext(); + setDisallowInContext(inForStatementInitializer); + node.declarations = parseDelimitedList(9, parseVariableDeclaration); + setDisallowInContext(savedDisallowIn); + } + return finishNode(node); + } + function canFollowContextualOfKeyword() { + return nextTokenIsIdentifier() && nextToken() === 17; + } + function parseVariableStatement(fullStart, modifiers) { + var node = createNode(173, fullStart); + setModifiers(node, modifiers); + node.declarationList = parseVariableDeclarationList(false); + parseSemicolon(); + return finishNode(node); + } + function parseFunctionDeclaration(fullStart, modifiers) { + var node = createNode(193, fullStart); + setModifiers(node, modifiers); + parseExpected(82); + node.asteriskToken = parseOptionalToken(35); + node.name = parseIdentifier(); + fillSignature(51, !!node.asteriskToken, false, node); + node.body = parseFunctionBlockOrSemicolon(!!node.asteriskToken, ts.Diagnostics.or_expected); + return finishNode(node); + } + function parseConstructorDeclaration(pos, modifiers) { + var node = createNode(131, pos); + setModifiers(node, modifiers); + parseExpected(112); + fillSignature(51, false, false, node); + node.body = parseFunctionBlockOrSemicolon(false, ts.Diagnostics.or_expected); + return finishNode(node); + } + function parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { + var method = createNode(130, fullStart); + setModifiers(method, modifiers); + method.asteriskToken = asteriskToken; + method.name = name; + method.questionToken = questionToken; + fillSignature(51, !!asteriskToken, false, method); + method.body = parseFunctionBlockOrSemicolon(!!asteriskToken, diagnosticMessage); + return finishNode(method); + } + function parsePropertyOrMethodDeclaration(fullStart, modifiers) { + var asteriskToken = parseOptionalToken(35); + var name = parsePropertyName(); + var questionToken = parseOptionalToken(50); + if (asteriskToken || token === 16 || token === 24) { + return parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); + } + else { + var property = createNode(128, fullStart); + setModifiers(property, modifiers); + property.name = name; + property.questionToken = questionToken; + property.type = parseTypeAnnotation(); + property.initializer = allowInAnd(parseNonParameterInitializer); + parseSemicolon(); + return finishNode(property); + } + } + function parseNonParameterInitializer() { + return parseInitializer(false); + } + function parseAccessorDeclaration(kind, fullStart, modifiers) { + var node = createNode(kind, fullStart); + setModifiers(node, modifiers); + node.name = parsePropertyName(); + fillSignature(51, false, false, node); + node.body = parseFunctionBlockOrSemicolon(false); + return finishNode(node); + } + function isClassMemberStart() { + var idToken; + while (ts.isModifier(token)) { + idToken = token; + nextToken(); + } + if (token === 35) { + return true; + } + if (isLiteralPropertyName()) { + idToken = token; + nextToken(); + } + if (token === 18) { + return true; + } + if (idToken !== undefined) { + if (!ts.isKeyword(idToken) || idToken === 118 || idToken === 114) { + return true; + } + switch (token) { + case 16: + case 24: + case 51: + case 52: + case 50: + return true; + default: + return canParseSemicolon(); + } + } + return false; + } + function parseModifiers() { + var flags = 0; + var modifiers; + while (true) { + var modifierStart = scanner.getStartPos(); + var modifierKind = token; + if (!parseAnyContextualModifier()) { + break; + } + if (!modifiers) { + modifiers = []; + modifiers.pos = modifierStart; + } + flags |= modifierToFlag(modifierKind); + modifiers.push(finishNode(createNode(modifierKind, modifierStart))); + } + if (modifiers) { + modifiers.flags = flags; + modifiers.end = scanner.getStartPos(); + } + return modifiers; + } + function parseClassElement() { + var fullStart = getNodePos(); + var modifiers = parseModifiers(); + var accessor = tryParseAccessorDeclaration(fullStart, modifiers); + if (accessor) { + return accessor; + } + if (token === 112) { + return parseConstructorDeclaration(fullStart, modifiers); + } + if (isIndexSignature()) { + return parseIndexSignatureDeclaration(modifiers); + } + if (isIdentifierOrKeyword() || + token === 8 || + token === 7 || + token === 35 || + token === 18) { + return parsePropertyOrMethodDeclaration(fullStart, modifiers); + } + ts.Debug.fail("Should not have attempted to parse class member declaration."); + } + function parseClassDeclaration(fullStart, modifiers) { + var node = createNode(194, fullStart); + setModifiers(node, modifiers); + parseExpected(68); + node.name = parseIdentifier(); + node.typeParameters = parseTypeParameters(); + node.heritageClauses = parseHeritageClauses(true); + if (parseExpected(14)) { + node.members = inGeneratorParameterContext() ? doOutsideOfYieldContext(parseClassMembers) : parseClassMembers(); + parseExpected(15); + } + else { + node.members = createMissingList(); + } + return finishNode(node); + } + function parseHeritageClauses(isClassHeritageClause) { + if (isHeritageClause()) { + return isClassHeritageClause && inGeneratorParameterContext() ? doOutsideOfYieldContext(parseHeritageClausesWorker) : parseHeritageClausesWorker(); + } + return undefined; + } + function parseHeritageClausesWorker() { + return parseList(19, false, parseHeritageClause); + } + function parseHeritageClause() { + if (token === 78 || token === 101) { + var node = createNode(205); + node.token = token; + nextToken(); + node.types = parseDelimitedList(8, parseTypeReference); + return finishNode(node); + } + return undefined; + } + function isHeritageClause() { + return token === 78 || token === 101; + } + function parseClassMembers() { + return parseList(6, false, parseClassElement); + } + function parseInterfaceDeclaration(fullStart, modifiers) { + var node = createNode(195, fullStart); + setModifiers(node, modifiers); + parseExpected(102); + node.name = parseIdentifier(); + node.typeParameters = parseTypeParameters(); + node.heritageClauses = parseHeritageClauses(false); + node.members = parseObjectTypeMembers(); + return finishNode(node); + } + function parseTypeAliasDeclaration(fullStart, modifiers) { + var node = createNode(196, fullStart); + setModifiers(node, modifiers); + parseExpected(121); + node.name = parseIdentifier(); + parseExpected(52); + node.type = parseType(); + parseSemicolon(); + return finishNode(node); + } + function parseEnumMember() { + var node = createNode(209, scanner.getStartPos()); + node.name = parsePropertyName(); + node.initializer = allowInAnd(parseNonParameterInitializer); + return finishNode(node); + } + function parseEnumDeclaration(fullStart, modifiers) { + var node = createNode(197, fullStart); + setModifiers(node, modifiers); + parseExpected(76); + node.name = parseIdentifier(); + if (parseExpected(14)) { + node.members = parseDelimitedList(7, parseEnumMember); + parseExpected(15); + } + else { + node.members = createMissingList(); + } + return finishNode(node); + } + function parseModuleBlock() { + var node = createNode(199, scanner.getStartPos()); + if (parseExpected(14)) { + node.statements = parseList(1, false, parseModuleElement); + parseExpected(15); + } + else { + node.statements = createMissingList(); + } + return finishNode(node); + } + function parseInternalModuleTail(fullStart, modifiers, flags) { + var node = createNode(198, fullStart); + setModifiers(node, modifiers); + node.flags |= flags; + node.name = parseIdentifier(); + node.body = parseOptional(20) ? parseInternalModuleTail(getNodePos(), undefined, 1) : parseModuleBlock(); + return finishNode(node); + } + function parseAmbientExternalModuleDeclaration(fullStart, modifiers) { + var node = createNode(198, fullStart); + setModifiers(node, modifiers); + node.name = parseLiteralNode(true); + node.body = parseModuleBlock(); + return finishNode(node); + } + function parseModuleDeclaration(fullStart, modifiers) { + parseExpected(115); + return token === 8 ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); + } + function isExternalModuleReference() { + return token === 116 && + lookAhead(nextTokenIsOpenParen); + } + function nextTokenIsOpenParen() { + return nextToken() === 16; + } + function parseImportDeclaration(fullStart, modifiers) { + var node = createNode(200, fullStart); + setModifiers(node, modifiers); + parseExpected(84); + node.name = parseIdentifier(); + parseExpected(52); + node.moduleReference = parseModuleReference(); + parseSemicolon(); + return finishNode(node); + } + function parseModuleReference() { + return isExternalModuleReference() ? parseExternalModuleReference() : parseEntityName(false); + } + function parseExternalModuleReference() { + var node = createNode(202); + parseExpected(116); + parseExpected(16); + node.expression = parseExpression(); + if (node.expression.kind === 8) { + internIdentifier(node.expression.text); + } + parseExpected(17); + return finishNode(node); + } + function parseExportAssignmentTail(fullStart, modifiers) { + var node = createNode(201, fullStart); + setModifiers(node, modifiers); + node.exportName = parseIdentifier(); + parseSemicolon(); + return finishNode(node); + } + function isLetDeclaration() { + return inStrictModeContext() || lookAhead(nextTokenIsIdentifierOnSameLine); + } + function isDeclarationStart() { + switch (token) { + case 97: + case 69: + case 82: + return true; + case 103: + return isLetDeclaration(); + case 68: + case 102: + case 76: + case 84: + case 121: + return lookAhead(nextTokenIsIdentifierOrKeyword); + case 115: + return lookAhead(nextTokenIsIdentifierOrKeywordOrStringLiteral); + case 77: + return lookAhead(nextTokenIsEqualsTokenOrDeclarationStart); + case 113: + case 107: + case 105: + case 106: + case 108: + return lookAhead(nextTokenIsDeclarationStart); + } + } + function isIdentifierOrKeyword() { + return token >= 64; + } + function nextTokenIsIdentifierOrKeyword() { + nextToken(); + return isIdentifierOrKeyword(); + } + function nextTokenIsIdentifierOrKeywordOrStringLiteral() { + nextToken(); + return isIdentifierOrKeyword() || token === 8; + } + function nextTokenIsEqualsTokenOrDeclarationStart() { + nextToken(); + return token === 52 || isDeclarationStart(); + } + function nextTokenIsDeclarationStart() { + nextToken(); + return isDeclarationStart(); + } + function parseDeclaration() { + var fullStart = getNodePos(); + var modifiers = parseModifiers(); + if (token === 77) { + nextToken(); + if (parseOptional(52)) { + return parseExportAssignmentTail(fullStart, modifiers); + } + } + switch (token) { + case 97: + case 103: + case 69: + return parseVariableStatement(fullStart, modifiers); + case 82: + return parseFunctionDeclaration(fullStart, modifiers); + case 68: + return parseClassDeclaration(fullStart, modifiers); + case 102: + return parseInterfaceDeclaration(fullStart, modifiers); + case 121: + return parseTypeAliasDeclaration(fullStart, modifiers); + case 76: + return parseEnumDeclaration(fullStart, modifiers); + case 115: + return parseModuleDeclaration(fullStart, modifiers); + case 84: + return parseImportDeclaration(fullStart, modifiers); + default: + ts.Debug.fail("Mismatch between isDeclarationStart and parseDeclaration"); + } + } + function isSourceElement(inErrorRecovery) { + return isDeclarationStart() || isStartOfStatement(inErrorRecovery); + } + function parseSourceElement() { + return parseSourceElementOrModuleElement(); + } + function parseModuleElement() { + return parseSourceElementOrModuleElement(); + } + function parseSourceElementOrModuleElement() { + return isDeclarationStart() ? parseDeclaration() : parseStatement(); + } + function processReferenceComments(sourceFile) { + var triviaScanner = ts.createScanner(sourceFile.languageVersion, false, sourceText); + var referencedFiles = []; + var amdDependencies = []; + var amdModuleName; + while (true) { + var kind = triviaScanner.scan(); + if (kind === 5 || kind === 4 || kind === 3) { + continue; + } + if (kind !== 2) { + break; + } + var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos() }; + var comment = sourceText.substring(range.pos, range.end); + var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range); + if (referencePathMatchResult) { + var fileReference = referencePathMatchResult.fileReference; + sourceFile.hasNoDefaultLib = referencePathMatchResult.isNoDefaultLib; + var diagnosticMessage = referencePathMatchResult.diagnosticMessage; + if (fileReference) { + referencedFiles.push(fileReference); + } + if (diagnosticMessage) { + sourceFile.parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, diagnosticMessage)); + } + } + else { + var amdModuleNameRegEx = /^\/\/\/\s*= 52 && token <= 63; + } + ts.isAssignmentOperator = isAssignmentOperator; +})(ts || (ts = {})); +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; + function getModuleInstanceState(node) { + if (node.kind === 195 || node.kind === 196) { + return 0; + } + else if (ts.isConstEnumDeclaration(node)) { + return 2; + } + else if (node.kind === 200 && !(node.flags & 1)) { + return 0; + } + else if (node.kind === 199) { + 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 === 198) { + return getModuleInstanceState(node.body); + } + else { + return 1; + } + } + ts.getModuleInstanceState = getModuleInstanceState; + function bindSourceFile(file) { + var start = new Date().getTime(); + bindSourceFileWorker(file); + ts.bindTime += new Date().getTime() - start; + } + ts.bindSourceFile = bindSourceFile; + function bindSourceFileWorker(file) { + var parent; + var container; + var blockScopeContainer; + var lastContainer; + var symbolCount = 0; + var Symbol = ts.objectAllocator.getSymbolConstructor(); + if (!file.locals) { + file.locals = {}; + container = blockScopeContainer = file; + bind(file); + file.symbolCount = symbolCount; + } + function createSymbol(flags, name) { + symbolCount++; + return new Symbol(flags, name); + } + function addDeclarationToSymbol(symbol, node, symbolKind) { + symbol.flags |= symbolKind; + if (!symbol.declarations) + symbol.declarations = []; + symbol.declarations.push(node); + if (symbolKind & 1952 && !symbol.exports) + symbol.exports = {}; + if (symbolKind & 6240 && !symbol.members) + symbol.members = {}; + node.symbol = symbol; + if (symbolKind & 107455 && !symbol.valueDeclaration) + symbol.valueDeclaration = node; + } + function getDeclarationName(node) { + if (node.name) { + if (node.kind === 198 && node.name.kind === 8) { + return '"' + node.name.text + '"'; + } + if (node.name.kind === 124) { + 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 139: + case 131: + return "__constructor"; + case 138: + case 134: + return "__call"; + case 135: + return "__new"; + case 136: + return "__index"; + } + } + function getDisplayName(node) { + return node.name ? ts.declarationNameToString(node.name) : getDeclarationName(node); + } + function declareSymbol(symbols, parent, node, includes, excludes) { + ts.Debug.assert(!ts.hasDynamicName(node)); + var name = getDeclarationName(node); + if (name !== undefined) { + var symbol = ts.hasProperty(symbols, name) ? symbols[name] : (symbols[name] = createSymbol(0, 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) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name, message, getDisplayName(declaration))); + }); + file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name, message, getDisplayName(node))); + symbol = createSymbol(0, name); + } + } + else { + symbol = createSymbol(0, "__missing"); + } + addDeclarationToSymbol(symbol, node, includes); + symbol.parent = parent; + if (node.kind === 194 && symbol.exports) { + 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; + } + return symbol; + } + function isAmbientContext(node) { + while (node) { + if (node.flags & 2) + return true; + node = node.parent; + } + return false; + } + function declareModuleMember(node, symbolKind, symbolExcludes) { + var exportKind = 0; + if (symbolKind & 107455) { + exportKind |= 1048576; + } + if (symbolKind & 793056) { + exportKind |= 2097152; + } + if (symbolKind & 1536) { + exportKind |= 4194304; + } + if (ts.getCombinedNodeFlags(node) & 1 || (node.kind !== 200 && isAmbientContext(container))) { + if (exportKind) { + var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); + local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); + node.localSymbol = local; + } + else { + declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); + } + } + else { + declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); + } + } + function bindChildren(node, symbolKind, isBlockScopeContainer) { + if (symbolKind & 255504) { + node.locals = {}; + } + var saveParent = parent; + var saveContainer = container; + var savedBlockScopeContainer = blockScopeContainer; + parent = node; + if (symbolKind & 262128) { + container = node; + if (lastContainer) { + lastContainer.nextContainer = container; + } + lastContainer = container; + } + if (isBlockScopeContainer) { + blockScopeContainer = node; + } + ts.forEachChild(node, bind); + container = saveContainer; + parent = saveParent; + blockScopeContainer = savedBlockScopeContainer; + } + function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { + switch (container.kind) { + case 198: + declareModuleMember(node, symbolKind, symbolExcludes); + break; + case 210: + if (ts.isExternalModule(container)) { + declareModuleMember(node, symbolKind, symbolExcludes); + break; + } + case 138: + case 139: + case 134: + case 135: + case 136: + case 130: + case 129: + case 131: + case 132: + case 133: + case 193: + case 158: + case 159: + declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); + break; + case 194: + if (node.flags & 128) { + declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); + break; + } + case 141: + case 150: + case 195: + declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); + break; + case 197: + declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); + break; + } + bindChildren(node, symbolKind, isBlockScopeContainer); + } + function bindModuleDeclaration(node) { + if (node.name.kind === 8) { + bindDeclaration(node, 512, 106639, true); + } + else { + var state = getModuleInstanceState(node); + if (state === 0) { + bindDeclaration(node, 1024, 0, true); + } + else { + bindDeclaration(node, 512, 106639, true); + if (state === 2) { + node.symbol.constEnumOnlyModule = true; + } + else if (node.symbol.constEnumOnlyModule) { + node.symbol.constEnumOnlyModule = false; + } + } + } + } + function bindFunctionOrConstructorType(node) { + var symbol = createSymbol(131072, getDeclarationName(node)); + addDeclarationToSymbol(symbol, node, 131072); + bindChildren(node, 131072, false); + var typeLiteralSymbol = createSymbol(2048, "__type"); + addDeclarationToSymbol(typeLiteralSymbol, node, 2048); + typeLiteralSymbol.members = {}; + typeLiteralSymbol.members[node.kind === 138 ? "__call" : "__new"] = symbol; + } + function bindAnonymousDeclaration(node, symbolKind, name, isBlockScopeContainer) { + var symbol = createSymbol(symbolKind, name); + addDeclarationToSymbol(symbol, node, symbolKind); + bindChildren(node, symbolKind, isBlockScopeContainer); + } + function bindCatchVariableDeclaration(node) { + var symbol = createSymbol(1, node.name.text || "__missing"); + addDeclarationToSymbol(symbol, node, 1); + var saveParent = parent; + var savedBlockScopeContainer = blockScopeContainer; + parent = blockScopeContainer = node; + ts.forEachChild(node, bind); + parent = saveParent; + blockScopeContainer = savedBlockScopeContainer; + } + function bindBlockScopedVariableDeclaration(node) { + switch (blockScopeContainer.kind) { + case 198: + declareModuleMember(node, 2, 107455); + break; + case 210: + if (ts.isExternalModule(container)) { + declareModuleMember(node, 2, 107455); + break; + } + default: + if (!blockScopeContainer.locals) { + blockScopeContainer.locals = {}; + } + declareSymbol(blockScopeContainer.locals, undefined, node, 2, 107455); + } + bindChildren(node, 2, false); + } + function getDestructuringParameterName(node) { + return "__" + ts.indexOf(node.parent.parameters, node); + } + function bind(node) { + node.parent = parent; + switch (node.kind) { + case 125: + bindDeclaration(node, 262144, 530912, false); + break; + case 126: + bindParameter(node); + break; + case 191: + case 148: + if (ts.isBindingPattern(node.name)) { + bindChildren(node, 0, false); + } + else if (ts.getCombinedNodeFlags(node) & 6144) { + bindBlockScopedVariableDeclaration(node); + } + else { + bindDeclaration(node, 1, 107454, false); + } + break; + case 128: + case 127: + bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455, false); + break; + case 207: + case 208: + bindPropertyOrMethodOrAccessor(node, 4, 107455, false); + break; + case 209: + bindPropertyOrMethodOrAccessor(node, 8, 107455, false); + break; + case 134: + case 135: + case 136: + bindDeclaration(node, 131072, 0, false); + break; + case 130: + case 129: + bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263, true); + break; + case 193: + bindDeclaration(node, 16, 106927, true); + break; + case 131: + bindDeclaration(node, 16384, 0, true); + break; + case 132: + bindPropertyOrMethodOrAccessor(node, 32768, 41919, true); + break; + case 133: + bindPropertyOrMethodOrAccessor(node, 65536, 74687, true); + break; + case 138: + case 139: + bindFunctionOrConstructorType(node); + break; + case 141: + bindAnonymousDeclaration(node, 2048, "__type", false); + break; + case 150: + bindAnonymousDeclaration(node, 4096, "__object", false); + break; + case 158: + case 159: + bindAnonymousDeclaration(node, 16, "__function", true); + break; + case 206: + bindCatchVariableDeclaration(node); + break; + case 194: + bindDeclaration(node, 32, 899583, false); + break; + case 195: + bindDeclaration(node, 64, 792992, false); + break; + case 196: + bindDeclaration(node, 524288, 793056, false); + break; + case 197: + if (ts.isConst(node)) { + bindDeclaration(node, 128, 899967, false); + } + else { + bindDeclaration(node, 256, 899327, false); + } + break; + case 198: + bindModuleDeclaration(node); + break; + case 200: + bindDeclaration(node, 8388608, 8388608, false); + break; + case 210: + if (ts.isExternalModule(node)) { + bindAnonymousDeclaration(node, 512, '"' + ts.removeFileExtension(node.fileName) + '"', true); + break; + } + case 172: + bindChildren(node, 0, !ts.isAnyFunction(node.parent)); + break; + case 206: + case 179: + case 180: + case 181: + case 186: + bindChildren(node, 0, true); + break; + default: + var saveParent = parent; + parent = node; + ts.forEachChild(node, bind); + parent = saveParent; + } + } + function bindParameter(node) { + if (ts.isBindingPattern(node.name)) { + bindAnonymousDeclaration(node, 1, getDestructuringParameterName(node), false); + } + else { + bindDeclaration(node, 1, 107455, false); + } + if (node.flags & 112 && + node.parent.kind === 131 && + node.parent.parent.kind === 194) { + var classDeclaration = node.parent.parent; + declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); + } + } + function bindPropertyOrMethodOrAccessor(node, symbolKind, symbolExcludes, isBlockScopeContainer) { + if (ts.hasDynamicName(node)) { + bindAnonymousDeclaration(node, symbolKind, "__computed", isBlockScopeContainer); + } + else { + bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer); + } + } + } +})(ts || (ts = {})); +var ts; +(function (ts) { + var nextSymbolId = 1; + var nextNodeId = 1; + var nextMergeId = 1; + ts.checkTime = 0; + function createTypeChecker(host, produceDiagnostics) { + var Symbol = ts.objectAllocator.getSymbolConstructor(); + var Type = ts.objectAllocator.getTypeConstructor(); + var Signature = ts.objectAllocator.getSignatureConstructor(); + var typeCount = 0; + var emptyArray = []; + var emptySymbols = {}; + var compilerOptions = host.getCompilerOptions(); + var languageVersion = compilerOptions.target || 0; + var emitResolver = createResolver(); + 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"); }, + getTypeCount: function () { return typeCount; }, + isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, + isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, + getDiagnostics: getDiagnostics, + getGlobalDiagnostics: getGlobalDiagnostics, + getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, + getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, + getPropertiesOfType: getPropertiesOfType, + getPropertyOfType: getPropertyOfType, + getSignaturesOfType: getSignaturesOfType, + getIndexTypeOfType: getIndexTypeOfType, + getReturnTypeOfSignature: getReturnTypeOfSignature, + getSymbolsInScope: getSymbolsInScope, + getSymbolAtLocation: getSymbolAtLocation, + getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol, + getTypeAtLocation: getTypeAtLocation, + typeToString: typeToString, + getSymbolDisplayBuilder: getSymbolDisplayBuilder, + symbolToString: symbolToString, + getAugmentedPropertiesOfType: getAugmentedPropertiesOfType, + getRootSymbols: getRootSymbols, + getContextualType: getContextualType, + getFullyQualifiedName: getFullyQualifiedName, + getResolvedSignature: getResolvedSignature, + getConstantValue: getConstantValue, + isValidPropertyAccess: isValidPropertyAccess, + getSignatureFromDeclaration: getSignatureFromDeclaration, + isImplementationOfOverload: isImplementationOfOverload, + getAliasedSymbol: resolveImport, + getEmitResolver: getEmitResolver + }; + var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); + var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); + var unknownSymbol = createSymbol(4 | 67108864, "unknown"); + var resolvingSymbol = createSymbol(67108864, "__resolving__"); + var anyType = createIntrinsicType(1, "any"); + var stringType = createIntrinsicType(2, "string"); + var numberType = createIntrinsicType(4, "number"); + var booleanType = createIntrinsicType(8, "boolean"); + var esSymbolType = createIntrinsicType(1048576, "symbol"); + var voidType = createIntrinsicType(16, "void"); + var undefinedType = createIntrinsicType(32 | 262144, "undefined"); + var nullType = createIntrinsicType(64 | 262144, "null"); + var unknownType = createIntrinsicType(1, "unknown"); + var resolvingType = createIntrinsicType(1, "__resolving__"); + var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var inferenceFailureType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var anySignature = createSignature(undefined, undefined, emptyArray, anyType, 0, false, false); + var unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, 0, false, false); + var globals = {}; + var globalArraySymbol; + var globalESSymbolConstructorSymbol; + var globalObjectType; + var globalFunctionType; + var globalArrayType; + var globalStringType; + var globalNumberType; + var globalBooleanType; + var globalRegExpType; + var globalTemplateStringsArrayType; + var globalESSymbolType; + var anyArrayType; + var tupleTypes = {}; + var unionTypes = {}; + var stringLiteralTypes = {}; + var emitExtends = false; + var mergedSymbols = []; + var symbolLinks = []; + var nodeLinks = []; + var potentialThisCollisions = []; + var diagnostics = ts.createDiagnosticCollection(); + var primitiveTypeInfo = { + "string": { + type: stringType, + flags: 258 + }, + "number": { + type: numberType, + flags: 132 + }, + "boolean": { + type: booleanType, + flags: 8 + }, + "symbol": { + type: esSymbolType, + flags: 1048576 + } + }; + function getEmitResolver(sourceFile) { + getDiagnostics(sourceFile); + return emitResolver; + } + function error(location, message, arg0, arg1, arg2) { + var diagnostic = location ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); + diagnostics.add(diagnostic); + } + function createSymbol(flags, name) { + return new Symbol(flags, name); + } + function getExcludedSymbolFlags(flags) { + var result = 0; + if (flags & 2) + result |= 107455; + if (flags & 1) + result |= 107454; + if (flags & 4) + result |= 107455; + if (flags & 8) + result |= 107455; + if (flags & 16) + result |= 106927; + if (flags & 32) + result |= 899583; + if (flags & 64) + result |= 792992; + if (flags & 256) + result |= 899327; + if (flags & 128) + result |= 899967; + if (flags & 512) + result |= 106639; + if (flags & 8192) + result |= 99263; + if (flags & 32768) + result |= 41919; + if (flags & 65536) + result |= 74687; + if (flags & 262144) + result |= 530912; + if (flags & 524288) + result |= 793056; + if (flags & 8388608) + result |= 8388608; + return result; + } + function recordMergedSymbol(target, source) { + if (!source.mergeId) + source.mergeId = nextMergeId++; + mergedSymbols[source.mergeId] = target; + } + function cloneSymbol(symbol) { + var result = createSymbol(symbol.flags | 33554432, symbol.name); + result.declarations = symbol.declarations.slice(0); + result.parent = symbol.parent; + if (symbol.valueDeclaration) + result.valueDeclaration = symbol.valueDeclaration; + if (symbol.constEnumOnlyModule) + result.constEnumOnlyModule = true; + if (symbol.members) + result.members = cloneSymbolTable(symbol.members); + if (symbol.exports) + result.exports = cloneSymbolTable(symbol.exports); + recordMergedSymbol(result, symbol); + return result; + } + function extendSymbol(target, source) { + if (!(target.flags & getExcludedSymbolFlags(source.flags))) { + if (source.flags & 512 && target.flags & 512 && target.constEnumOnlyModule && !source.constEnumOnlyModule) { + target.constEnumOnlyModule = false; + } + target.flags |= source.flags; + if (!target.valueDeclaration && source.valueDeclaration) + target.valueDeclaration = source.valueDeclaration; + ts.forEach(source.declarations, function (node) { + target.declarations.push(node); + }); + if (source.members) { + if (!target.members) + target.members = {}; + extendSymbolTable(target.members, source.members); + } + if (source.exports) { + if (!target.exports) + target.exports = {}; + extendSymbolTable(target.exports, source.exports); + } + recordMergedSymbol(target, source); + } + else { + var message = target.flags & 2 || source.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + ts.forEach(source.declarations, function (node) { + error(node.name ? node.name : node, message, symbolToString(source)); + }); + ts.forEach(target.declarations, function (node) { + error(node.name ? node.name : node, message, symbolToString(source)); + }); + } + } + function cloneSymbolTable(symbolTable) { + var result = {}; + for (var id in symbolTable) { + if (ts.hasProperty(symbolTable, id)) { + result[id] = symbolTable[id]; + } + } + return result; + } + function extendSymbolTable(target, source) { + for (var id in source) { + if (ts.hasProperty(source, id)) { + if (!ts.hasProperty(target, id)) { + target[id] = source[id]; + } + else { + var symbol = target[id]; + if (!(symbol.flags & 33554432)) { + target[id] = symbol = cloneSymbol(symbol); + } + extendSymbol(symbol, source[id]); + } + } + } + } + function getSymbolLinks(symbol) { + if (symbol.flags & 67108864) + return symbol; + if (!symbol.id) + symbol.id = nextSymbolId++; + return symbolLinks[symbol.id] || (symbolLinks[symbol.id] = {}); + } + function getNodeLinks(node) { + if (!node.id) + node.id = nextNodeId++; + return nodeLinks[node.id] || (nodeLinks[node.id] = {}); + } + function getSourceFile(node) { + return ts.getAncestor(node, 210); + } + function isGlobalSourceFile(node) { + return node.kind === 210 && !ts.isExternalModule(node); + } + function getSymbol(symbols, name, meaning) { + if (meaning && ts.hasProperty(symbols, name)) { + var symbol = symbols[name]; + ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); + if (symbol.flags & meaning) { + return symbol; + } + if (symbol.flags & 8388608) { + var target = resolveImport(symbol); + if (target === unknownSymbol || target.flags & meaning) { + return symbol; + } + } + } + } + function isDefinedBefore(node1, node2) { + var file1 = ts.getSourceFileOfNode(node1); + var file2 = ts.getSourceFileOfNode(node2); + if (file1 === file2) { + return node1.pos <= node2.pos; + } + if (!compilerOptions.out) { + return true; + } + var sourceFiles = host.getSourceFiles(); + return sourceFiles.indexOf(file1) <= sourceFiles.indexOf(file2); + } + function resolveName(location, name, meaning, nameNotFoundMessage, nameArg) { + var result; + var lastLocation; + var propertyWithInvalidInitializer; + var errorLocation = location; + loop: while (location) { + if (location.locals && !isGlobalSourceFile(location)) { + if (result = getSymbol(location.locals, name, meaning)) { + break loop; + } + } + switch (location.kind) { + case 210: + if (!ts.isExternalModule(location)) + break; + case 198: + if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931)) { + break loop; + } + break; + case 197: + if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { + break loop; + } + break; + case 128: + case 127: + if (location.parent.kind === 194 && !(location.flags & 128)) { + var ctor = findConstructorDeclaration(location.parent); + if (ctor && ctor.locals) { + if (getSymbol(ctor.locals, name, meaning & 107455)) { + propertyWithInvalidInitializer = location; + } + } + } + break; + case 194: + case 195: + 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); + return undefined; + } + break loop; + } + break; + case 124: + var grandparent = location.parent.parent; + if (grandparent.kind === 194 || grandparent.kind === 195) { + 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 130: + case 129: + case 131: + case 132: + case 133: + case 193: + case 159: + if (name === "arguments") { + result = argumentsSymbol; + break loop; + } + break; + case 158: + if (name === "arguments") { + result = argumentsSymbol; + break loop; + } + var id = location.name; + if (id && name === id.text) { + result = location.symbol; + break loop; + } + break; + case 206: + var id = location.name; + if (name === id.text) { + result = location.symbol; + break loop; + } + break; + } + lastLocation = location; + location = location.parent; + } + if (!result) { + result = getSymbol(globals, name, meaning); + } + if (!result) { + if (nameNotFoundMessage) { + error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + } + return undefined; + } + if (nameNotFoundMessage) { + if (propertyWithInvalidInitializer) { + var propertyName = propertyWithInvalidInitializer.name; + 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 (result.flags & 2) { + var declaration = ts.forEach(result.declarations, function (d) { return ts.getCombinedNodeFlags(d) & 6144 ? d : undefined; }); + ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); + if (!isDefinedBefore(declaration, errorLocation)) { + error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } + } + } + return result; + } + function resolveImport(symbol) { + ts.Debug.assert((symbol.flags & 8388608) !== 0, "Should only get Imports here."); + var links = getSymbolLinks(symbol); + if (!links.target) { + links.target = resolvingSymbol; + var node = ts.getDeclarationOfKind(symbol, 200); + if (node.moduleReference.kind === 202) { + if (node.moduleReference.expression.kind !== 8) { + grammarErrorOnNode(node.moduleReference.expression, ts.Diagnostics.String_literal_expected); + } + } + var target = node.moduleReference.kind === 202 ? resolveExternalModuleName(node, ts.getExternalModuleImportDeclarationExpression(node)) : getSymbolOfPartOfRightHandSideOfImport(node.moduleReference, node); + if (links.target === resolvingSymbol) { + links.target = target || unknownSymbol; + } + else { + error(node, ts.Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol)); + } + } + else if (links.target === resolvingSymbol) { + links.target = unknownSymbol; + } + return links.target; + } + function getSymbolOfPartOfRightHandSideOfImport(entityName, importDeclaration) { + if (!importDeclaration) { + importDeclaration = ts.getAncestor(entityName, 200); + ts.Debug.assert(importDeclaration !== undefined); + } + if (entityName.kind === 64 && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + entityName = entityName.parent; + } + if (entityName.kind === 64 || entityName.parent.kind === 123) { + return resolveEntityName(importDeclaration, entityName, 1536); + } + else { + ts.Debug.assert(entityName.parent.kind === 200); + return resolveEntityName(importDeclaration, entityName, 107455 | 793056 | 1536); + } + } + function getFullyQualifiedName(symbol) { + return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); + } + function resolveEntityName(location, name, meaning) { + if (ts.getFullWidth(name) === 0) { + return undefined; + } + if (name.kind === 64) { + var symbol = resolveName(location, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); + if (!symbol) { + return; + } + } + else if (name.kind === 123) { + var namespace = resolveEntityName(location, name.left, 1536); + if (!namespace || namespace === unknownSymbol || ts.getFullWidth(name.right) === 0) + return; + var symbol = getSymbol(namespace.exports, name.right.text, meaning); + if (!symbol) { + error(location, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(name.right)); + return; + } + } + ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); + return symbol.flags & meaning ? symbol : resolveImport(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 !== 8) { + return; + } + var moduleReferenceLiteral = moduleReferenceExpression; + var searchPath = ts.getDirectoryPath(getSourceFile(location).fileName); + var moduleName = ts.escapeIdentifier(moduleReferenceLiteral.text); + if (!moduleName) + return; + var isRelative = isExternalModuleNameRelative(moduleName); + if (!isRelative) { + var symbol = getSymbol(globals, '"' + moduleName + '"', 512); + if (symbol) { + return getResolvedExportSymbol(symbol); + } + } + while (true) { + var fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); + var sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); + if (sourceFile || isRelative) + break; + var parentPath = ts.getDirectoryPath(searchPath); + if (parentPath === searchPath) + break; + searchPath = parentPath; + } + if (sourceFile) { + if (sourceFile.symbol) { + return getResolvedExportSymbol(sourceFile.symbol); + } + error(moduleReferenceLiteral, ts.Diagnostics.File_0_is_not_an_external_module, sourceFile.fileName); + return; + } + error(moduleReferenceLiteral, ts.Diagnostics.Cannot_find_external_module_0, moduleName); + } + function getResolvedExportSymbol(moduleSymbol) { + var symbol = getExportAssignmentSymbol(moduleSymbol); + if (symbol) { + if (symbol.flags & (107455 | 793056 | 1536)) { + return symbol; + } + if (symbol.flags & 8388608) { + return resolveImport(symbol); + } + } + return moduleSymbol; + } + function getExportAssignmentSymbol(symbol) { + checkTypeOfExportAssignmentSymbol(symbol); + var symbolLinks = getSymbolLinks(symbol); + return symbolLinks.exportAssignSymbol === unknownSymbol ? undefined : symbolLinks.exportAssignSymbol; + } + function checkTypeOfExportAssignmentSymbol(containerSymbol) { + var symbolLinks = getSymbolLinks(containerSymbol); + if (!symbolLinks.exportAssignSymbol) { + var exportInformation = collectExportInformationForSourceFileOrModule(containerSymbol); + if (exportInformation.exportAssignments.length) { + if (exportInformation.exportAssignments.length > 1) { + ts.forEach(exportInformation.exportAssignments, function (node) { return error(node, ts.Diagnostics.A_module_cannot_have_more_than_one_export_assignment); }); + } + var node = exportInformation.exportAssignments[0]; + if (exportInformation.hasExportedMember) { + error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); + } + if (node.exportName.text) { + var meaning = 107455 | 793056 | 1536; + var exportSymbol = resolveName(node, node.exportName.text, meaning, ts.Diagnostics.Cannot_find_name_0, node.exportName); + } + } + symbolLinks.exportAssignSymbol = exportSymbol || unknownSymbol; + } + } + function collectExportInformationForSourceFileOrModule(symbol) { + var seenExportedMember = false; + var result = []; + ts.forEach(symbol.declarations, function (declaration) { + var block = (declaration.kind === 210 ? declaration : declaration.body); + ts.forEach(block.statements, function (node) { + if (node.kind === 201) { + result.push(node); + } + else { + seenExportedMember = seenExportedMember || (node.flags & 1) !== 0; + } + }); + }); + return { + hasExportedMember: seenExportedMember, + exportAssignments: result + }; + } + function getMergedSymbol(symbol) { + var merged; + return symbol && symbol.mergeId && (merged = mergedSymbols[symbol.mergeId]) ? merged : symbol; + } + function getSymbolOfNode(node) { + return getMergedSymbol(node.symbol); + } + function getParentOfSymbol(symbol) { + return getMergedSymbol(symbol.parent); + } + function getExportSymbolOfValueSymbolIfExported(symbol) { + return symbol && (symbol.flags & 1048576) !== 0 ? getMergedSymbol(symbol.exportSymbol) : symbol; + } + function symbolIsValue(symbol) { + if (symbol.flags & 16777216) { + return symbolIsValue(getSymbolLinks(symbol).target); + } + if (symbol.flags & 107455) { + return true; + } + if (symbol.flags & 8388608) { + return (resolveImport(symbol).flags & 107455) !== 0; + } + return false; + } + function findConstructorDeclaration(node) { + var members = node.members; + for (var i = 0; i < members.length; i++) { + var member = members[i]; + if (member.kind === 131 && ts.nodeIsPresent(member.body)) { + return member; + } + } + } + function createType(flags) { + var result = new Type(checker, flags); + result.id = typeCount++; + return result; + } + function createIntrinsicType(kind, intrinsicName) { + var type = createType(kind); + type.intrinsicName = intrinsicName; + return type; + } + function createObjectType(kind, symbol) { + var type = createType(kind); + type.symbol = symbol; + return type; + } + function isReservedMemberName(name) { + return name.charCodeAt(0) === 95 && + name.charCodeAt(1) === 95 && + name.charCodeAt(2) !== 95 && + name.charCodeAt(2) !== 64; + } + function getNamedMembers(members) { + var result; + for (var id in members) { + if (ts.hasProperty(members, id)) { + if (!isReservedMemberName(id)) { + if (!result) + result = []; + var symbol = members[id]; + if (symbolIsValue(symbol)) { + result.push(symbol); + } + } + } + } + return result || emptyArray; + } + function setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType) { + type.members = members; + type.properties = getNamedMembers(members); + type.callSignatures = callSignatures; + type.constructSignatures = constructSignatures; + if (stringIndexType) + type.stringIndexType = stringIndexType; + if (numberIndexType) + type.numberIndexType = numberIndexType; + return type; + } + function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexType, numberIndexType) { + return setObjectTypeMembers(createObjectType(32768, symbol), members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + } + function forEachSymbolTableInScope(enclosingDeclaration, callback) { + var result; + for (var location = enclosingDeclaration; location; location = location.parent) { + if (location.locals && !isGlobalSourceFile(location)) { + if (result = callback(location.locals)) { + return result; + } + } + switch (location.kind) { + case 210: + if (!ts.isExternalModule(location)) { + break; + } + case 198: + if (result = callback(getSymbolOfNode(location).exports)) { + return result; + } + break; + case 194: + case 195: + if (result = callback(getSymbolOfNode(location).members)) { + return result; + } + break; + } + } + return callback(globals); + } + function getQualifiedLeftMeaning(rightMeaning) { + return rightMeaning === 107455 ? 107455 : 1536; + } + function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing) { + function getAccessibleSymbolChainFromSymbolTable(symbols) { + function canQualifySymbol(symbolFromSymbolTable, meaning) { + if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) { + return true; + } + var accessibleParent = getAccessibleSymbolChain(symbolFromSymbolTable.parent, enclosingDeclaration, getQualifiedLeftMeaning(meaning), useOnlyExternalAliasing); + return !!accessibleParent; + } + function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) { + if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) { + return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && + canQualifySymbol(symbolFromSymbolTable, meaning); + } + } + if (isAccessible(ts.lookUp(symbols, symbol.name))) { + return [symbol]; + } + return ts.forEachValue(symbols, function (symbolFromSymbolTable) { + if (symbolFromSymbolTable.flags & 8388608) { + if (!useOnlyExternalAliasing || + ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportDeclaration)) { + var resolvedImportedSymbol = resolveImport(symbolFromSymbolTable); + if (isAccessible(symbolFromSymbolTable, resolveImport(symbolFromSymbolTable))) { + return [symbolFromSymbolTable]; + } + var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; + if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + } + } + } + }); + } + if (symbol) { + return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + } + } + function needsQualification(symbol, enclosingDeclaration, meaning) { + var qualify = false; + forEachSymbolTableInScope(enclosingDeclaration, function (symbolTable) { + if (!ts.hasProperty(symbolTable, symbol.name)) { + return false; + } + var symbolFromSymbolTable = symbolTable[symbol.name]; + if (symbolFromSymbolTable === symbol) { + return true; + } + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608) ? resolveImport(symbolFromSymbolTable) : symbolFromSymbolTable; + if (symbolFromSymbolTable.flags & meaning) { + qualify = true; + return true; + } + return false; + }); + return qualify; + } + function isSymbolAccessible(symbol, enclosingDeclaration, meaning) { + if (symbol && enclosingDeclaration && !(symbol.flags & 262144)) { + var initialSymbol = symbol; + var meaningToLook = meaning; + while (symbol) { + var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, false); + if (accessibleSymbolChain) { + var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0]); + if (!hasAccessibleDeclarations) { + return { + accessibility: 1, + errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning), + errorModuleName: symbol !== initialSymbol ? symbolToString(symbol, enclosingDeclaration, 1536) : undefined + }; + } + return hasAccessibleDeclarations; + } + meaningToLook = getQualifiedLeftMeaning(meaning); + symbol = getParentOfSymbol(symbol); + } + var symbolExternalModule = ts.forEach(initialSymbol.declarations, getExternalModuleContainer); + if (symbolExternalModule) { + var enclosingExternalModule = getExternalModuleContainer(enclosingDeclaration); + if (symbolExternalModule !== enclosingExternalModule) { + return { + accessibility: 2, + errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning), + errorModuleName: symbolToString(symbolExternalModule) + }; + } + } + return { + accessibility: 1, + errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning) + }; + } + return { accessibility: 0 }; + function getExternalModuleContainer(declaration) { + for (; declaration; declaration = declaration.parent) { + if (hasExternalModuleSymbol(declaration)) { + return getSymbolOfNode(declaration); + } + } + } + } + function hasExternalModuleSymbol(declaration) { + return (declaration.kind === 198 && declaration.name.kind === 8) || + (declaration.kind === 210 && ts.isExternalModule(declaration)); + } + function hasVisibleDeclarations(symbol) { + var aliasesToMakeVisible; + if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) { + return undefined; + } + return { accessibility: 0, aliasesToMakeVisible: aliasesToMakeVisible }; + function getIsDeclarationVisible(declaration) { + if (!isDeclarationVisible(declaration)) { + if (declaration.kind === 200 && + !(declaration.flags & 1) && + isDeclarationVisible(declaration.parent)) { + getNodeLinks(declaration).isVisible = true; + if (aliasesToMakeVisible) { + if (!ts.contains(aliasesToMakeVisible, declaration)) { + aliasesToMakeVisible.push(declaration); + } + } + else { + aliasesToMakeVisible = [declaration]; + } + return true; + } + return false; + } + return true; + } + } + function isEntityNameVisible(entityName, enclosingDeclaration) { + var meaning; + if (entityName.parent.kind === 140) { + meaning = 107455 | 1048576; + } + else if (entityName.kind === 123 || + entityName.parent.kind === 200) { + meaning = 1536; + } + else { + meaning = 793056; + } + var firstIdentifier = getFirstIdentifier(entityName); + var symbol = resolveName(enclosingDeclaration, firstIdentifier.text, meaning, undefined, undefined); + return (symbol && hasVisibleDeclarations(symbol)) || { + accessibility: 1, + errorSymbolName: ts.getTextOfNode(firstIdentifier), + errorNode: firstIdentifier + }; + } + function writeKeyword(writer, kind) { + writer.writeKeyword(ts.tokenToString(kind)); + } + function writePunctuation(writer, kind) { + writer.writePunctuation(ts.tokenToString(kind)); + } + function writeSpace(writer) { + writer.writeSpace(" "); + } + function symbolToString(symbol, enclosingDeclaration, meaning) { + var writer = ts.getSingleLineStringWriter(); + getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning); + var result = writer.string(); + ts.releaseStringWriter(writer); + return result; + } + function typeToString(type, enclosingDeclaration, flags) { + var writer = ts.getSingleLineStringWriter(); + getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); + var result = writer.string(); + ts.releaseStringWriter(writer); + var maxLength = compilerOptions.noErrorTruncation || flags & 4 ? undefined : 100; + if (maxLength && result.length >= maxLength) { + result = result.substr(0, maxLength - "...".length) + "..."; + } + return result; + } + function getTypeAliasForTypeLiteral(type) { + if (type.symbol && type.symbol.flags & 2048) { + var node = type.symbol.declarations[0].parent; + while (node.kind === 145) { + node = node.parent; + } + if (node.kind === 196) { + return getSymbolOfNode(node); + } + } + return undefined; + } + var _displayBuilder; + function getSymbolDisplayBuilder() { + function appendSymbolNameOnly(symbol, writer) { + if (symbol.declarations && symbol.declarations.length > 0) { + var declaration = symbol.declarations[0]; + if (declaration.name) { + writer.writeSymbol(ts.declarationNameToString(declaration.name), symbol); + return; + } + } + writer.writeSymbol(symbol.name, symbol); + } + function buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags, typeFlags) { + var parentSymbol; + function appendParentTypeArgumentsAndSymbolName(symbol) { + if (parentSymbol) { + if (flags & 1) { + if (symbol.flags & 16777216) { + buildDisplayForTypeArgumentsAndDelimiters(getTypeParametersOfClassOrInterface(parentSymbol), symbol.mapper, writer, enclosingDeclaration); + } + else { + buildTypeParameterDisplayFromSymbol(parentSymbol, writer, enclosingDeclaration); + } + } + writePunctuation(writer, 20); + } + parentSymbol = symbol; + appendSymbolNameOnly(symbol, writer); + } + writer.trackSymbol(symbol, enclosingDeclaration, meaning); + function walkSymbol(symbol, meaning) { + if (symbol) { + var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); + if (!accessibleSymbolChain || + needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); + } + if (accessibleSymbolChain) { + for (var i = 0, n = accessibleSymbolChain.length; i < n; i++) { + appendParentTypeArgumentsAndSymbolName(accessibleSymbolChain[i]); + } + } + else { + if (!parentSymbol && ts.forEach(symbol.declarations, hasExternalModuleSymbol)) { + return; + } + if (symbol.flags & 2048 || symbol.flags & 4096) { + return; + } + appendParentTypeArgumentsAndSymbolName(symbol); + } + } + } + var isTypeParameter = symbol.flags & 262144; + var typeFormatFlag = 128 & typeFlags; + if (!isTypeParameter && (enclosingDeclaration || typeFormatFlag)) { + walkSymbol(symbol, meaning); + return; + } + return appendParentTypeArgumentsAndSymbolName(symbol); + } + function buildTypeDisplay(type, writer, enclosingDeclaration, globalFlags, typeStack) { + var globalFlagsToPass = globalFlags & 16; + return writeType(type, globalFlags); + function writeType(type, flags) { + if (type.flags & 1048703) { + writer.writeKeyword(!(globalFlags & 16) && + (type.flags & 1) ? "any" : type.intrinsicName); + } + else if (type.flags & 4096) { + writeTypeReference(type, flags); + } + else if (type.flags & (1024 | 2048 | 128 | 512)) { + buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 793056, 0, flags); + } + else if (type.flags & 8192) { + writeTupleType(type); + } + else if (type.flags & 16384) { + writeUnionType(type, flags); + } + else if (type.flags & 32768) { + writeAnonymousType(type, flags); + } + else if (type.flags & 256) { + writer.writeStringLiteral(type.text); + } + else { + writePunctuation(writer, 14); + writeSpace(writer); + writePunctuation(writer, 21); + writeSpace(writer); + writePunctuation(writer, 15); + } + } + function writeTypeList(types, union) { + for (var i = 0; i < types.length; i++) { + if (i > 0) { + if (union) { + writeSpace(writer); + } + writePunctuation(writer, union ? 44 : 23); + writeSpace(writer); + } + writeType(types[i], union ? 64 : 0); + } + } + function writeTypeReference(type, flags) { + if (type.target === globalArrayType && !(flags & 1)) { + writeType(type.typeArguments[0], 64); + writePunctuation(writer, 18); + writePunctuation(writer, 19); + } + else { + buildSymbolDisplay(type.target.symbol, writer, enclosingDeclaration, 793056); + writePunctuation(writer, 24); + writeTypeList(type.typeArguments, false); + writePunctuation(writer, 25); + } + } + function writeTupleType(type) { + writePunctuation(writer, 18); + writeTypeList(type.elementTypes, false); + writePunctuation(writer, 19); + } + function writeUnionType(type, flags) { + if (flags & 64) { + writePunctuation(writer, 16); + } + writeTypeList(type.types, true); + if (flags & 64) { + writePunctuation(writer, 17); + } + } + function writeAnonymousType(type, flags) { + if (type.symbol && type.symbol.flags & (32 | 384 | 512)) { + writeTypeofSymbol(type, flags); + } + else if (shouldWriteTypeOfFunctionSymbol()) { + writeTypeofSymbol(type, flags); + } + else if (typeStack && ts.contains(typeStack, type)) { + var typeAlias = getTypeAliasForTypeLiteral(type); + if (typeAlias) { + buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, 793056, 0, flags); + } + else { + writeKeyword(writer, 110); + } + } + else { + if (!typeStack) { + typeStack = []; + } + typeStack.push(type); + writeLiteralType(type, flags); + typeStack.pop(); + } + function shouldWriteTypeOfFunctionSymbol() { + if (type.symbol) { + var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && + ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128; })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && + (type.symbol.parent || + ts.forEach(type.symbol.declarations, function (declaration) { + return declaration.parent.kind === 210 || declaration.parent.kind === 199; + })); + if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { + return !!(flags & 2) || + (typeStack && ts.contains(typeStack, type)); + } + } + } + } + function writeTypeofSymbol(type, typeFormatFlags) { + writeKeyword(writer, 96); + writeSpace(writer); + buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455, 0, typeFormatFlags); + } + function getIndexerParameterName(type, indexKind, fallbackName) { + var declaration = getIndexDeclarationOfSymbol(type.symbol, indexKind); + if (!declaration) { + return fallbackName; + } + ts.Debug.assert(declaration.parameters.length !== 0); + return ts.declarationNameToString(declaration.parameters[0].name); + } + function writeLiteralType(type, flags) { + var resolved = resolveObjectOrUnionTypeMembers(type); + if (!resolved.properties.length && !resolved.stringIndexType && !resolved.numberIndexType) { + if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { + writePunctuation(writer, 14); + writePunctuation(writer, 15); + return; + } + if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { + if (flags & 64) { + writePunctuation(writer, 16); + } + buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, typeStack); + if (flags & 64) { + writePunctuation(writer, 17); + } + return; + } + if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { + if (flags & 64) { + writePunctuation(writer, 16); + } + writeKeyword(writer, 87); + writeSpace(writer); + buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, typeStack); + if (flags & 64) { + writePunctuation(writer, 17); + } + return; + } + } + writePunctuation(writer, 14); + writer.writeLine(); + writer.increaseIndent(); + for (var i = 0; i < resolved.callSignatures.length; i++) { + buildSignatureDisplay(resolved.callSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + writePunctuation(writer, 22); + writer.writeLine(); + } + for (var i = 0; i < resolved.constructSignatures.length; i++) { + writeKeyword(writer, 87); + writeSpace(writer); + buildSignatureDisplay(resolved.constructSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + writePunctuation(writer, 22); + writer.writeLine(); + } + if (resolved.stringIndexType) { + writePunctuation(writer, 18); + writer.writeParameter(getIndexerParameterName(resolved, 0, "x")); + writePunctuation(writer, 51); + writeSpace(writer); + writeKeyword(writer, 119); + writePunctuation(writer, 19); + writePunctuation(writer, 51); + writeSpace(writer); + writeType(resolved.stringIndexType, 0); + writePunctuation(writer, 22); + writer.writeLine(); + } + if (resolved.numberIndexType) { + writePunctuation(writer, 18); + writer.writeParameter(getIndexerParameterName(resolved, 1, "x")); + writePunctuation(writer, 51); + writeSpace(writer); + writeKeyword(writer, 117); + writePunctuation(writer, 19); + writePunctuation(writer, 51); + writeSpace(writer); + writeType(resolved.numberIndexType, 0); + writePunctuation(writer, 22); + writer.writeLine(); + } + for (var i = 0; i < resolved.properties.length; i++) { + var p = resolved.properties[i]; + var t = getTypeOfSymbol(p); + if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { + var signatures = getSignaturesOfType(t, 0); + for (var j = 0; j < signatures.length; j++) { + buildSymbolDisplay(p, writer); + if (p.flags & 536870912) { + writePunctuation(writer, 50); + } + buildSignatureDisplay(signatures[j], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + writePunctuation(writer, 22); + writer.writeLine(); + } + } + else { + buildSymbolDisplay(p, writer); + if (p.flags & 536870912) { + writePunctuation(writer, 50); + } + writePunctuation(writer, 51); + writeSpace(writer); + writeType(t, 0); + writePunctuation(writer, 22); + writer.writeLine(); + } + } + writer.decreaseIndent(); + writePunctuation(writer, 15); + } + } + function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaraiton, flags) { + var targetSymbol = getTargetSymbol(symbol); + if (targetSymbol.flags & 32 || targetSymbol.flags & 64) { + buildDisplayForTypeParametersAndDelimiters(getTypeParametersOfClassOrInterface(symbol), writer, enclosingDeclaraiton, flags); + } + } + function buildTypeParameterDisplay(tp, writer, enclosingDeclaration, flags, typeStack) { + appendSymbolNameOnly(tp.symbol, writer); + var constraint = getConstraintOfTypeParameter(tp); + if (constraint) { + writeSpace(writer); + writeKeyword(writer, 78); + writeSpace(writer); + buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, typeStack); + } + } + function buildParameterDisplay(p, writer, enclosingDeclaration, flags, typeStack) { + if (ts.hasDotDotDotToken(p.valueDeclaration)) { + writePunctuation(writer, 21); + } + appendSymbolNameOnly(p, writer); + if (ts.hasQuestionToken(p.valueDeclaration) || p.valueDeclaration.initializer) { + writePunctuation(writer, 50); + } + writePunctuation(writer, 51); + writeSpace(writer); + buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, typeStack); + } + function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, typeStack) { + if (typeParameters && typeParameters.length) { + writePunctuation(writer, 24); + for (var i = 0; i < typeParameters.length; i++) { + if (i > 0) { + writePunctuation(writer, 23); + writeSpace(writer); + } + buildTypeParameterDisplay(typeParameters[i], writer, enclosingDeclaration, flags, typeStack); + } + writePunctuation(writer, 25); + } + } + function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, typeStack) { + if (typeParameters && typeParameters.length) { + writePunctuation(writer, 24); + for (var i = 0; i < typeParameters.length; i++) { + if (i > 0) { + writePunctuation(writer, 23); + writeSpace(writer); + } + buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, 0); + } + writePunctuation(writer, 25); + } + } + function buildDisplayForParametersAndDelimiters(parameters, writer, enclosingDeclaration, flags, typeStack) { + writePunctuation(writer, 16); + for (var i = 0; i < parameters.length; i++) { + if (i > 0) { + writePunctuation(writer, 23); + writeSpace(writer); + } + buildParameterDisplay(parameters[i], writer, enclosingDeclaration, flags, typeStack); + } + writePunctuation(writer, 17); + } + function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, typeStack) { + if (flags & 8) { + writeSpace(writer); + writePunctuation(writer, 32); + } + else { + writePunctuation(writer, 51); + } + writeSpace(writer); + buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags, typeStack); + } + function buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, typeStack) { + if (signature.target && (flags & 32)) { + buildDisplayForTypeArgumentsAndDelimiters(signature.target.typeParameters, signature.mapper, writer, enclosingDeclaration); + } + else { + buildDisplayForTypeParametersAndDelimiters(signature.typeParameters, writer, enclosingDeclaration, flags, typeStack); + } + buildDisplayForParametersAndDelimiters(signature.parameters, writer, enclosingDeclaration, flags, typeStack); + buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, typeStack); + } + return _displayBuilder || (_displayBuilder = { + symbolToString: symbolToString, + typeToString: typeToString, + buildSymbolDisplay: buildSymbolDisplay, + buildTypeDisplay: buildTypeDisplay, + buildTypeParameterDisplay: buildTypeParameterDisplay, + buildParameterDisplay: buildParameterDisplay, + buildDisplayForParametersAndDelimiters: buildDisplayForParametersAndDelimiters, + buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters, + buildDisplayForTypeArgumentsAndDelimiters: buildDisplayForTypeArgumentsAndDelimiters, + buildTypeParameterDisplayFromSymbol: buildTypeParameterDisplayFromSymbol, + buildSignatureDisplay: buildSignatureDisplay, + buildReturnTypeDisplay: buildReturnTypeDisplay + }); + } + function isDeclarationVisible(node) { + function getContainingExternalModule(node) { + for (; node; node = node.parent) { + if (node.kind === 198) { + if (node.name.kind === 8) { + return node; + } + } + else if (node.kind === 210) { + return ts.isExternalModule(node) ? node : undefined; + } + } + ts.Debug.fail("getContainingModule cant reach here"); + } + function isUsedInExportAssignment(node) { + var externalModule = getContainingExternalModule(node); + if (externalModule) { + var externalModuleSymbol = getSymbolOfNode(externalModule); + var exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol); + var resolvedExportSymbol; + var symbolOfNode = getSymbolOfNode(node); + if (isSymbolUsedInExportAssignment(symbolOfNode)) { + return true; + } + if (symbolOfNode.flags & 8388608) { + return isSymbolUsedInExportAssignment(resolveImport(symbolOfNode)); + } + } + function isSymbolUsedInExportAssignment(symbol) { + if (exportAssignmentSymbol === symbol) { + return true; + } + if (exportAssignmentSymbol && !!(exportAssignmentSymbol.flags & 8388608)) { + resolvedExportSymbol = resolvedExportSymbol || resolveImport(exportAssignmentSymbol); + if (resolvedExportSymbol === symbol) { + return true; + } + return ts.forEach(resolvedExportSymbol.declarations, function (current) { + while (current) { + if (current === node) { + return true; + } + current = current.parent; + } + }); + } + } + } + function determineIfDeclarationIsVisible() { + switch (node.kind) { + case 191: + case 148: + case 198: + case 194: + case 195: + case 196: + case 193: + case 197: + case 200: + var parent = getDeclarationContainer(node); + if (!(ts.getCombinedNodeFlags(node) & 1) && + !(node.kind !== 200 && parent.kind !== 210 && ts.isInAmbientContext(parent))) { + return isGlobalSourceFile(parent) || isUsedInExportAssignment(node); + } + return isDeclarationVisible(parent); + case 128: + case 127: + case 132: + case 133: + case 130: + case 129: + if (node.flags & (32 | 64)) { + return false; + } + case 131: + case 135: + case 134: + case 136: + case 126: + case 199: + case 138: + case 139: + case 141: + case 137: + case 142: + case 143: + case 144: + case 145: + return isDeclarationVisible(node.parent); + case 125: + case 210: + return true; + default: + ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); + } + } + if (node) { + var links = getNodeLinks(node); + if (links.isVisible === undefined) { + links.isVisible = !!determineIfDeclarationIsVisible(); + } + return links.isVisible; + } + } + function getRootDeclaration(node) { + while (node.kind === 148) { + node = node.parent.parent; + } + return node; + } + function getDeclarationContainer(node) { + node = getRootDeclaration(node); + return node.kind === 191 ? node.parent.parent.parent : node.parent; + } + function getTypeOfPrototypeProperty(prototype) { + var classType = getDeclaredTypeOfSymbol(prototype.parent); + return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; + } + function getTypeOfPropertyOfType(type, name) { + var prop = getPropertyOfType(type, name); + return prop ? getTypeOfSymbol(prop) : undefined; + } + function getTypeForBindingElement(declaration) { + var pattern = declaration.parent; + var parentType = getTypeForVariableLikeDeclaration(pattern.parent); + if (parentType === unknownType) { + return unknownType; + } + if (!parentType || parentType === anyType) { + if (declaration.initializer) { + return checkExpressionCached(declaration.initializer); + } + return parentType; + } + if (pattern.kind === 146) { + var name = declaration.propertyName || declaration.name; + var type = getTypeOfPropertyOfType(parentType, name.text) || + isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, 1) || + getIndexTypeOfType(parentType, 0); + if (!type) { + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); + return unknownType; + } + } + else { + if (!isArrayLikeType(parentType)) { + error(pattern, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(parentType)); + return unknownType; + } + if (!declaration.dotDotDotToken) { + var propName = "" + ts.indexOf(pattern.elements, declaration); + var type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) : getIndexTypeOfType(parentType, 1); + if (!type) { + error(declaration, ts.Diagnostics.Type_0_has_no_property_1, typeToString(parentType), propName); + return unknownType; + } + } + else { + var type = createArrayType(getIndexTypeOfType(parentType, 1)); + } + } + return type; + } + function getTypeForVariableLikeDeclaration(declaration) { + if (declaration.parent.parent.kind === 180) { + return anyType; + } + if (ts.isBindingPattern(declaration.parent)) { + return getTypeForBindingElement(declaration); + } + if (declaration.type) { + return getTypeFromTypeNode(declaration.type); + } + if (declaration.kind === 126) { + var func = declaration.parent; + if (func.kind === 133 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 132); + if (getter) { + return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); + } + } + var type = getContextuallyTypedParameterType(declaration); + if (type) { + return type; + } + } + if (declaration.initializer) { + return checkExpressionCached(declaration.initializer); + } + if (declaration.kind === 208) { + return checkIdentifier(declaration.name); + } + return undefined; + } + function getTypeFromBindingElement(element) { + if (element.initializer) { + return getWidenedType(checkExpressionCached(element.initializer)); + } + if (ts.isBindingPattern(element.name)) { + return getTypeFromBindingPattern(element.name); + } + return anyType; + } + function getTypeFromObjectBindingPattern(pattern) { + var members = {}; + 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); + symbol.type = getTypeFromBindingElement(e); + members[symbol.name] = symbol; + }); + return createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + } + function getTypeFromArrayBindingPattern(pattern) { + var hasSpreadElement = false; + var elementTypes = []; + ts.forEach(pattern.elements, function (e) { + elementTypes.push(e.kind === 170 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); + if (e.dotDotDotToken) { + hasSpreadElement = true; + } + }); + return !elementTypes.length ? anyArrayType : hasSpreadElement ? createArrayType(getUnionType(elementTypes)) : createTupleType(elementTypes); + } + function getTypeFromBindingPattern(pattern) { + return pattern.kind === 146 ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); + } + function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) { + var type = getTypeForVariableLikeDeclaration(declaration); + if (type) { + if (reportErrors) { + reportErrorsFromWidening(declaration, type); + } + return declaration.kind !== 207 ? getWidenedType(type) : type; + } + if (ts.isBindingPattern(declaration.name)) { + return getTypeFromBindingPattern(declaration.name); + } + type = declaration.dotDotDotToken ? anyArrayType : anyType; + if (reportErrors && compilerOptions.noImplicitAny) { + var root = getRootDeclaration(declaration); + if (!isPrivateWithinAmbient(root) && !(root.kind === 126 && isPrivateWithinAmbient(root.parent))) { + reportImplicitAnyError(declaration, type); + } + } + return type; + } + function getTypeOfVariableOrParameterOrProperty(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + if (symbol.flags & 134217728) { + return links.type = getTypeOfPrototypeProperty(symbol); + } + var declaration = symbol.valueDeclaration; + if (declaration.kind === 206) { + return links.type = anyType; + } + links.type = resolvingType; + var type = getWidenedTypeForVariableLikeDeclaration(declaration, true); + if (links.type === resolvingType) { + links.type = type; + } + } + else if (links.type === resolvingType) { + links.type = anyType; + if (compilerOptions.noImplicitAny) { + var diagnostic = symbol.valueDeclaration.type ? ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; + error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); + } + } + return links.type; + } + function getSetAccessorTypeAnnotationNode(accessor) { + return accessor && accessor.parameters.length > 0 && accessor.parameters[0].type; + } + function getAnnotatedAccessorType(accessor) { + if (accessor) { + if (accessor.kind === 132) { + return accessor.type && getTypeFromTypeNode(accessor.type); + } + else { + var setterTypeAnnotation = getSetAccessorTypeAnnotationNode(accessor); + return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation); + } + } + return undefined; + } + function getTypeOfAccessors(symbol) { + var links = getSymbolLinks(symbol); + checkAndStoreTypeOfAccessors(symbol, links); + return links.type; + } + function checkAndStoreTypeOfAccessors(symbol, links) { + links = links || getSymbolLinks(symbol); + if (!links.type) { + links.type = resolvingType; + var getter = ts.getDeclarationOfKind(symbol, 132); + var setter = ts.getDeclarationOfKind(symbol, 133); + var type; + var getterReturnType = getAnnotatedAccessorType(getter); + if (getterReturnType) { + type = getterReturnType; + } + else { + var setterParameterType = getAnnotatedAccessorType(setter); + if (setterParameterType) { + type = setterParameterType; + } + else { + if (getter && getter.body) { + type = getReturnTypeFromBody(getter); + } + else { + if (compilerOptions.noImplicitAny) { + error(setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation, symbolToString(symbol)); + } + type = anyType; + } + } + } + if (links.type === resolvingType) { + links.type = type; + } + } + else if (links.type === resolvingType) { + links.type = anyType; + if (compilerOptions.noImplicitAny) { + var getter = ts.getDeclarationOfKind(symbol, 132); + error(getter, 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)); + } + } + } + function getTypeOfFuncClassEnumModule(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + links.type = createObjectType(32768, symbol); + } + return links.type; + } + function getTypeOfEnumMember(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + links.type = getDeclaredTypeOfEnum(getParentOfSymbol(symbol)); + } + return links.type; + } + function getTypeOfImport(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + links.type = getTypeOfSymbol(resolveImport(symbol)); + } + return links.type; + } + function getTypeOfInstantiatedSymbol(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + } + return links.type; + } + function getTypeOfSymbol(symbol) { + if (symbol.flags & 16777216) { + return getTypeOfInstantiatedSymbol(symbol); + } + if (symbol.flags & (3 | 4)) { + return getTypeOfVariableOrParameterOrProperty(symbol); + } + if (symbol.flags & (16 | 8192 | 32 | 384 | 512)) { + return getTypeOfFuncClassEnumModule(symbol); + } + if (symbol.flags & 8) { + return getTypeOfEnumMember(symbol); + } + if (symbol.flags & 98304) { + return getTypeOfAccessors(symbol); + } + if (symbol.flags & 8388608) { + return getTypeOfImport(symbol); + } + return unknownType; + } + function getTargetType(type) { + return type.flags & 4096 ? type.target : type; + } + function hasBaseType(type, checkBase) { + return check(type); + function check(type) { + var target = getTargetType(type); + return target === checkBase || ts.forEach(target.baseTypes, check); + } + } + function getTypeParametersOfClassOrInterface(symbol) { + var result; + ts.forEach(symbol.declarations, function (node) { + if (node.kind === 195 || node.kind === 194) { + var declaration = node; + if (declaration.typeParameters && declaration.typeParameters.length) { + ts.forEach(declaration.typeParameters, function (node) { + var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); + if (!result) { + result = [tp]; + } + else if (!ts.contains(result, tp)) { + result.push(tp); + } + }); + } + } + }); + return result; + } + function getDeclaredTypeOfClass(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + var type = links.declaredType = createObjectType(1024, symbol); + var typeParameters = getTypeParametersOfClassOrInterface(symbol); + if (typeParameters) { + type.flags |= 4096; + type.typeParameters = typeParameters; + type.instantiations = {}; + type.instantiations[getTypeListId(type.typeParameters)] = type; + type.target = type; + type.typeArguments = type.typeParameters; + } + type.baseTypes = []; + var declaration = ts.getDeclarationOfKind(symbol, 194); + var baseTypeNode = ts.getClassBaseTypeNode(declaration); + if (baseTypeNode) { + var baseType = getTypeFromTypeReferenceNode(baseTypeNode); + if (baseType !== unknownType) { + if (getTargetType(baseType).flags & 1024) { + if (type !== baseType && !hasBaseType(baseType, type)) { + type.baseTypes.push(baseType); + } + else { + error(declaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1)); + } + } + else { + error(baseTypeNode, ts.Diagnostics.A_class_may_only_extend_another_class); + } + } + } + type.declaredProperties = getNamedMembers(symbol.members); + type.declaredCallSignatures = emptyArray; + type.declaredConstructSignatures = emptyArray; + type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0); + type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1); + } + return links.declaredType; + } + function getDeclaredTypeOfInterface(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + var type = links.declaredType = createObjectType(2048, symbol); + var typeParameters = getTypeParametersOfClassOrInterface(symbol); + if (typeParameters) { + type.flags |= 4096; + type.typeParameters = typeParameters; + type.instantiations = {}; + type.instantiations[getTypeListId(type.typeParameters)] = type; + type.target = type; + type.typeArguments = type.typeParameters; + } + type.baseTypes = []; + ts.forEach(symbol.declarations, function (declaration) { + if (declaration.kind === 195 && ts.getInterfaceBaseTypeNodes(declaration)) { + ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), function (node) { + var baseType = getTypeFromTypeReferenceNode(node); + if (baseType !== unknownType) { + if (getTargetType(baseType).flags & (1024 | 2048)) { + if (type !== baseType && !hasBaseType(baseType, type)) { + type.baseTypes.push(baseType); + } + else { + error(declaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1)); + } + } + else { + error(node, ts.Diagnostics.An_interface_may_only_extend_a_class_or_another_interface); + } + } + }); + } + }); + type.declaredProperties = getNamedMembers(symbol.members); + type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); + type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); + type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0); + type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1); + } + return links.declaredType; + } + function getDeclaredTypeOfTypeAlias(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + links.declaredType = resolvingType; + var declaration = ts.getDeclarationOfKind(symbol, 196); + var type = getTypeFromTypeNode(declaration.type); + if (links.declaredType === resolvingType) { + links.declaredType = type; + } + } + else if (links.declaredType === resolvingType) { + links.declaredType = unknownType; + var declaration = ts.getDeclarationOfKind(symbol, 196); + error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + } + return links.declaredType; + } + function getDeclaredTypeOfEnum(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + var type = createType(128); + type.symbol = symbol; + links.declaredType = type; + } + return links.declaredType; + } + function getDeclaredTypeOfTypeParameter(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + var type = createType(512); + type.symbol = symbol; + if (!ts.getDeclarationOfKind(symbol, 125).constraint) { + type.constraint = noConstraintType; + } + links.declaredType = type; + } + return links.declaredType; + } + function getDeclaredTypeOfImport(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + links.declaredType = getDeclaredTypeOfSymbol(resolveImport(symbol)); + } + return links.declaredType; + } + function getDeclaredTypeOfSymbol(symbol) { + ts.Debug.assert((symbol.flags & 16777216) === 0); + if (symbol.flags & 32) { + return getDeclaredTypeOfClass(symbol); + } + if (symbol.flags & 64) { + return getDeclaredTypeOfInterface(symbol); + } + if (symbol.flags & 524288) { + return getDeclaredTypeOfTypeAlias(symbol); + } + if (symbol.flags & 384) { + return getDeclaredTypeOfEnum(symbol); + } + if (symbol.flags & 262144) { + return getDeclaredTypeOfTypeParameter(symbol); + } + if (symbol.flags & 8388608) { + return getDeclaredTypeOfImport(symbol); + } + return unknownType; + } + function createSymbolTable(symbols) { + var result = {}; + for (var i = 0; i < symbols.length; i++) { + var symbol = symbols[i]; + result[symbol.name] = symbol; + } + return result; + } + function createInstantiatedSymbolTable(symbols, mapper) { + var result = {}; + for (var i = 0; i < symbols.length; i++) { + var symbol = symbols[i]; + result[symbol.name] = instantiateSymbol(symbol, mapper); + } + return result; + } + function addInheritedMembers(symbols, baseSymbols) { + for (var i = 0; i < baseSymbols.length; i++) { + var s = baseSymbols[i]; + if (!ts.hasProperty(symbols, s.name)) { + symbols[s.name] = s; + } + } + } + function addInheritedSignatures(signatures, baseSignatures) { + if (baseSignatures) { + for (var i = 0; i < baseSignatures.length; i++) { + signatures.push(baseSignatures[i]); + } + } + } + function resolveClassOrInterfaceMembers(type) { + var members = type.symbol.members; + var callSignatures = type.declaredCallSignatures; + var constructSignatures = type.declaredConstructSignatures; + var stringIndexType = type.declaredStringIndexType; + var numberIndexType = type.declaredNumberIndexType; + if (type.baseTypes.length) { + members = createSymbolTable(type.declaredProperties); + ts.forEach(type.baseTypes, function (baseType) { + 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); + }); + } + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + } + function resolveTypeReferenceMembers(type) { + var target = 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(target.baseTypes, 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); + } + function createSignature(declaration, typeParameters, parameters, resolvedReturnType, minArgumentCount, hasRestParameter, hasStringLiterals) { + var sig = new Signature(checker); + sig.declaration = declaration; + sig.typeParameters = typeParameters; + sig.parameters = parameters; + sig.resolvedReturnType = resolvedReturnType; + sig.minArgumentCount = minArgumentCount; + sig.hasRestParameter = hasRestParameter; + sig.hasStringLiterals = hasStringLiterals; + return sig; + } + function cloneSignature(sig) { + return createSignature(sig.declaration, sig.typeParameters, sig.parameters, sig.resolvedReturnType, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); + } + function getDefaultConstructSignatures(classType) { + if (classType.baseTypes.length) { + var baseType = classType.baseTypes[0]; + var baseSignatures = getSignaturesOfType(getTypeOfSymbol(baseType.symbol), 1); + return ts.map(baseSignatures, function (baseSignature) { + var signature = baseType.flags & 4096 ? getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); + signature.typeParameters = classType.typeParameters; + signature.resolvedReturnType = classType; + return signature; + }); + } + return [createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false)]; + } + function createTupleTypeMemberSymbols(memberTypes) { + var members = {}; + for (var i = 0; i < memberTypes.length; i++) { + var symbol = createSymbol(4 | 67108864, "" + i); + symbol.type = memberTypes[i]; + members[i] = symbol; + } + return members; + } + function resolveTupleTypeMembers(type) { + var arrayType = resolveObjectOrUnionTypeMembers(createArrayType(getUnionType(type.elementTypes))); + var members = createTupleTypeMemberSymbols(type.elementTypes); + addInheritedMembers(members, arrayType.properties); + setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); + } + function signatureListsIdentical(s, t) { + if (s.length !== t.length) { + return false; + } + for (var i = 0; i < s.length; i++) { + if (!compareSignatures(s[i], t[i], false, compareTypes)) { + return false; + } + } + return true; + } + function getUnionSignatures(types, kind) { + var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); + var signatures = signatureLists[0]; + for (var i = 0; i < signatures.length; i++) { + if (signatures[i].typeParameters) { + return emptyArray; + } + } + for (var i = 1; i < signatureLists.length; i++) { + if (!signatureListsIdentical(signatures, signatureLists[i])) { + return emptyArray; + } + } + var result = ts.map(signatures, cloneSignature); + for (var i = 0; i < result.length; i++) { + var s = result[i]; + s.resolvedReturnType = undefined; + s.unionSignatures = ts.map(signatureLists, function (signatures) { return signatures[i]; }); + } + return result; + } + function getUnionIndexType(types, kind) { + var indexTypes = []; + for (var i = 0; i < types.length; i++) { + var indexType = getIndexTypeOfType(types[i], kind); + if (!indexType) { + return undefined; + } + indexTypes.push(indexType); + } + return getUnionType(indexTypes); + } + function resolveUnionTypeMembers(type) { + var callSignatures = getUnionSignatures(type.types, 0); + var constructSignatures = getUnionSignatures(type.types, 1); + var stringIndexType = getUnionIndexType(type.types, 0); + var numberIndexType = getUnionIndexType(type.types, 1); + setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexType, numberIndexType); + } + function resolveAnonymousTypeMembers(type) { + var symbol = type.symbol; + if (symbol.flags & 2048) { + var members = symbol.members; + var callSignatures = getSignaturesOfSymbol(members["__call"]); + var constructSignatures = getSignaturesOfSymbol(members["__new"]); + var stringIndexType = getIndexTypeOfSymbol(symbol, 0); + var numberIndexType = getIndexTypeOfSymbol(symbol, 1); + } + else { + var members = emptySymbols; + var callSignatures = emptyArray; + var constructSignatures = emptyArray; + if (symbol.flags & 1952) { + members = symbol.exports; + } + if (symbol.flags & (16 | 8192)) { + callSignatures = getSignaturesOfSymbol(symbol); + } + if (symbol.flags & 32) { + var classType = getDeclaredTypeOfClass(symbol); + constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); + if (!constructSignatures.length) { + constructSignatures = getDefaultConstructSignatures(classType); + } + if (classType.baseTypes.length) { + members = createSymbolTable(getNamedMembers(members)); + addInheritedMembers(members, getPropertiesOfObjectType(getTypeOfSymbol(classType.baseTypes[0].symbol))); + } + } + var stringIndexType = undefined; + var numberIndexType = (symbol.flags & 384) ? stringType : undefined; + } + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + } + function resolveObjectOrUnionTypeMembers(type) { + if (!type.members) { + if (type.flags & (1024 | 2048)) { + resolveClassOrInterfaceMembers(type); + } + else if (type.flags & 32768) { + resolveAnonymousTypeMembers(type); + } + else if (type.flags & 8192) { + resolveTupleTypeMembers(type); + } + else if (type.flags & 16384) { + resolveUnionTypeMembers(type); + } + else { + resolveTypeReferenceMembers(type); + } + } + return type; + } + function getPropertiesOfObjectType(type) { + if (type.flags & 48128) { + return resolveObjectOrUnionTypeMembers(type).properties; + } + return emptyArray; + } + function getPropertyOfObjectType(type, name) { + if (type.flags & 48128) { + var resolved = resolveObjectOrUnionTypeMembers(type); + if (ts.hasProperty(resolved.members, name)) { + var symbol = resolved.members[name]; + if (symbolIsValue(symbol)) { + return symbol; + } + } + } + } + function getPropertiesOfUnionType(type) { + var result = []; + ts.forEach(getPropertiesOfType(type.types[0]), function (prop) { + var unionProp = getPropertyOfUnionType(type, prop.name); + if (unionProp) { + result.push(unionProp); + } + }); + return result; + } + function getPropertiesOfType(type) { + if (type.flags & 16384) { + return getPropertiesOfUnionType(type); + } + return getPropertiesOfObjectType(getApparentType(type)); + } + function getApparentType(type) { + if (type.flags & 512) { + do { + type = getConstraintOfTypeParameter(type); + } while (type && type.flags & 512); + if (!type) { + type = emptyObjectType; + } + } + if (type.flags & 258) { + type = globalStringType; + } + else if (type.flags & 132) { + type = globalNumberType; + } + else if (type.flags & 8) { + type = globalBooleanType; + } + else if (type.flags & 1048576) { + type = globalESSymbolType; + } + return type; + } + function createUnionProperty(unionType, name) { + var types = unionType.types; + var props; + for (var i = 0; i < types.length; i++) { + var type = getApparentType(types[i]); + if (type !== unknownType) { + var prop = getPropertyOfType(type, name); + if (!prop) { + return undefined; + } + if (!props) { + props = [prop]; + } + else { + props.push(prop); + } + } + } + var propTypes = []; + var declarations = []; + for (var i = 0; i < props.length; i++) { + var prop = props[i]; + if (prop.declarations) { + declarations.push.apply(declarations, prop.declarations); + } + propTypes.push(getTypeOfSymbol(prop)); + } + var result = createSymbol(4 | 67108864 | 268435456, name); + result.unionType = unionType; + result.declarations = declarations; + result.type = getUnionType(propTypes); + return result; + } + function getPropertyOfUnionType(type, name) { + var properties = type.resolvedProperties || (type.resolvedProperties = {}); + if (ts.hasProperty(properties, name)) { + return properties[name]; + } + var property = createUnionProperty(type, name); + if (property) { + properties[name] = property; + } + return property; + } + function getPropertyOfType(type, name) { + if (type.flags & 16384) { + return getPropertyOfUnionType(type, name); + } + if (!(type.flags & 48128)) { + type = getApparentType(type); + if (!(type.flags & 48128)) { + return undefined; + } + } + var resolved = resolveObjectOrUnionTypeMembers(type); + if (ts.hasProperty(resolved.members, name)) { + var symbol = resolved.members[name]; + if (symbolIsValue(symbol)) { + return symbol; + } + } + if (resolved === anyFunctionType || resolved.callSignatures.length || resolved.constructSignatures.length) { + var symbol = getPropertyOfObjectType(globalFunctionType, name); + if (symbol) + return symbol; + } + return getPropertyOfObjectType(globalObjectType, name); + } + function getSignaturesOfObjectOrUnionType(type, kind) { + if (type.flags & (48128 | 16384)) { + var resolved = resolveObjectOrUnionTypeMembers(type); + return kind === 0 ? resolved.callSignatures : resolved.constructSignatures; + } + return emptyArray; + } + function getSignaturesOfType(type, kind) { + return getSignaturesOfObjectOrUnionType(getApparentType(type), kind); + } + function getIndexTypeOfObjectOrUnionType(type, kind) { + if (type.flags & (48128 | 16384)) { + var resolved = resolveObjectOrUnionTypeMembers(type); + return kind === 0 ? resolved.stringIndexType : resolved.numberIndexType; + } + } + function getIndexTypeOfType(type, kind) { + return getIndexTypeOfObjectOrUnionType(getApparentType(type), kind); + } + function getTypeParametersFromDeclaration(typeParameterDeclarations) { + var result = []; + ts.forEach(typeParameterDeclarations, function (node) { + var tp = getDeclaredTypeOfTypeParameter(node.symbol); + if (!ts.contains(result, tp)) { + result.push(tp); + } + }); + return result; + } + function getSignatureFromDeclaration(declaration) { + var links = getNodeLinks(declaration); + if (!links.resolvedSignature) { + var classType = declaration.kind === 131 ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; + var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; + var parameters = []; + var hasStringLiterals = false; + var minArgumentCount = -1; + for (var i = 0, n = declaration.parameters.length; i < n; i++) { + var param = declaration.parameters[i]; + parameters.push(param.symbol); + if (param.type && param.type.kind === 8) { + hasStringLiterals = true; + } + if (minArgumentCount < 0) { + if (param.initializer || param.questionToken || param.dotDotDotToken) { + minArgumentCount = i; + } + } + } + if (minArgumentCount < 0) { + minArgumentCount = declaration.parameters.length; + } + var returnType; + if (classType) { + returnType = classType; + } + else if (declaration.type) { + returnType = getTypeFromTypeNode(declaration.type); + } + else { + if (declaration.kind === 132 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 133); + returnType = getAnnotatedAccessorType(setter); + } + if (!returnType && ts.nodeIsMissing(declaration.body)) { + returnType = anyType; + } + } + links.resolvedSignature = createSignature(declaration, typeParameters, parameters, returnType, minArgumentCount, ts.hasRestParameters(declaration), hasStringLiterals); + } + return links.resolvedSignature; + } + function getSignaturesOfSymbol(symbol) { + if (!symbol) + return emptyArray; + var result = []; + for (var i = 0, len = symbol.declarations.length; i < len; i++) { + var node = symbol.declarations[i]; + switch (node.kind) { + case 138: + case 139: + case 193: + case 130: + case 129: + case 131: + case 134: + case 135: + case 136: + case 132: + case 133: + case 158: + case 159: + if (i > 0 && node.body) { + var previous = symbol.declarations[i - 1]; + if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { + break; + } + } + result.push(getSignatureFromDeclaration(node)); + } + } + return result; + } + function getReturnTypeOfSignature(signature) { + if (!signature.resolvedReturnType) { + signature.resolvedReturnType = resolvingType; + if (signature.target) { + var type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); + } + else if (signature.unionSignatures) { + var type = getUnionType(ts.map(signature.unionSignatures, getReturnTypeOfSignature)); + } + else { + var type = getReturnTypeFromBody(signature.declaration); + } + if (signature.resolvedReturnType === resolvingType) { + signature.resolvedReturnType = type; + } + } + else if (signature.resolvedReturnType === resolvingType) { + signature.resolvedReturnType = anyType; + if (compilerOptions.noImplicitAny) { + var declaration = signature.declaration; + if (declaration.name) { + error(declaration.name, 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, ts.declarationNameToString(declaration.name)); + } + else { + error(declaration, ts.Diagnostics.Function_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); + } + } + } + return signature.resolvedReturnType; + } + function getRestTypeOfSignature(signature) { + if (signature.hasRestParameter) { + var type = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]); + if (type.flags & 4096 && type.target === globalArrayType) { + return type.typeArguments[0]; + } + } + return anyType; + } + function getSignatureInstantiation(signature, typeArguments) { + return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), true); + } + function getErasedSignature(signature) { + if (!signature.typeParameters) + return signature; + if (!signature.erasedSignatureCache) { + if (signature.target) { + signature.erasedSignatureCache = instantiateSignature(getErasedSignature(signature.target), signature.mapper); + } + else { + signature.erasedSignatureCache = instantiateSignature(signature, createTypeEraser(signature.typeParameters), true); + } + } + return signature.erasedSignatureCache; + } + function getOrCreateTypeFromSignature(signature) { + if (!signature.isolatedSignatureType) { + var isConstructor = signature.declaration.kind === 131 || signature.declaration.kind === 135; + var type = createObjectType(32768 | 65536); + type.members = emptySymbols; + type.properties = emptyArray; + type.callSignatures = !isConstructor ? [signature] : emptyArray; + type.constructSignatures = isConstructor ? [signature] : emptyArray; + signature.isolatedSignatureType = type; + } + return signature.isolatedSignatureType; + } + function getIndexSymbol(symbol) { + return symbol.members["__index"]; + } + function getIndexDeclarationOfSymbol(symbol, kind) { + var syntaxKind = kind === 1 ? 117 : 119; + var indexSymbol = getIndexSymbol(symbol); + if (indexSymbol) { + var len = indexSymbol.declarations.length; + for (var i = 0; i < len; i++) { + var node = indexSymbol.declarations[i]; + if (node.parameters.length === 1) { + var parameter = node.parameters[0]; + if (parameter && parameter.type && parameter.type.kind === syntaxKind) { + return node; + } + } + } + } + return undefined; + } + function getIndexTypeOfSymbol(symbol, kind) { + var declaration = getIndexDeclarationOfSymbol(symbol, kind); + return declaration ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType : undefined; + } + function getConstraintOfTypeParameter(type) { + if (!type.constraint) { + if (type.target) { + var targetConstraint = getConstraintOfTypeParameter(type.target); + type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; + } + else { + type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 125).constraint); + } + } + return type.constraint === noConstraintType ? undefined : type.constraint; + } + 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 += ","; + result += types[i].id; + } + return result; + } + } + function getWideningFlagsOfTypes(types) { + var result = 0; + for (var i = 0; i < types.length; i++) { + result |= types[i].flags; + } + return result & 786432; + } + function createTypeReference(target, typeArguments) { + var id = getTypeListId(typeArguments); + var type = target.instantiations[id]; + if (!type) { + var flags = 4096 | getWideningFlagsOfTypes(typeArguments); + type = target.instantiations[id] = createObjectType(flags, target.symbol); + type.target = target; + type.typeArguments = typeArguments; + } + return type; + } + function isTypeParameterReferenceIllegalInConstraint(typeReferenceNode, typeParameterSymbol) { + var links = getNodeLinks(typeReferenceNode); + if (links.isIllegalTypeReferenceInConstraint !== undefined) { + return links.isIllegalTypeReferenceInConstraint; + } + var currentNode = typeReferenceNode; + while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { + currentNode = currentNode.parent; + } + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 125; + return links.isIllegalTypeReferenceInConstraint; + } + function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { + var typeParameterSymbol; + function check(n) { + if (n.kind === 137 && n.typeName.kind === 64) { + var links = getNodeLinks(n); + if (links.isIllegalTypeReferenceInConstraint === undefined) { + var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); + if (symbol && (symbol.flags & 262144)) { + links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { return d.parent == typeParameter.parent; }); + } + } + if (links.isIllegalTypeReferenceInConstraint) { + error(typeParameter, ts.Diagnostics.Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list); + } + } + ts.forEachChild(n, check); + } + if (typeParameter.constraint) { + typeParameterSymbol = getSymbolOfNode(typeParameter); + check(typeParameter.constraint); + } + } + function getTypeFromTypeReferenceNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var symbol = resolveEntityName(node, node.typeName, 793056); + if (symbol) { + var type; + if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { + type = unknownType; + } + else { + type = getDeclaredTypeOfSymbol(symbol); + if (type.flags & (1024 | 2048) && type.flags & 4096) { + var typeParameters = type.typeParameters; + if (node.typeArguments && node.typeArguments.length === typeParameters.length) { + type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNode)); + } + else { + error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); + type = undefined; + } + } + else { + if (node.typeArguments) { + error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); + type = undefined; + } + } + } + } + links.resolvedType = type || unknownType; + } + return links.resolvedType; + } + function getTypeFromTypeQueryNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getWidenedType(checkExpressionOrQualifiedName(node.exprName)); + } + return links.resolvedType; + } + function getTypeOfGlobalSymbol(symbol, arity) { + function getTypeDeclaration(symbol) { + var declarations = symbol.declarations; + for (var i = 0; i < declarations.length; i++) { + var declaration = declarations[i]; + switch (declaration.kind) { + case 194: + case 195: + case 197: + return declaration; + } + } + } + if (!symbol) { + return emptyObjectType; + } + var type = getDeclaredTypeOfSymbol(symbol); + if (!(type.flags & 48128)) { + error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbol.name); + return emptyObjectType; + } + if ((type.typeParameters ? type.typeParameters.length : 0) !== arity) { + error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbol.name, arity); + return emptyObjectType; + } + return type; + } + function getGlobalValueSymbol(name) { + return getGlobalSymbol(name, 107455, ts.Diagnostics.Cannot_find_global_value_0); + } + function getGlobalTypeSymbol(name) { + return getGlobalSymbol(name, 793056, ts.Diagnostics.Cannot_find_global_type_0); + } + function getGlobalSymbol(name, meaning, diagnostic) { + return resolveName(undefined, name, meaning, diagnostic, name); + } + function getGlobalType(name) { + return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), 0); + } + function getGlobalESSymbolConstructorSymbol() { + return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); + } + function createArrayType(elementType) { + var arrayType = globalArrayType || getDeclaredTypeOfSymbol(globalArraySymbol); + return arrayType !== emptyObjectType ? createTypeReference(arrayType, [elementType]) : emptyObjectType; + } + function getTypeFromArrayTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = createArrayType(getTypeFromTypeNode(node.elementType)); + } + return links.resolvedType; + } + function createTupleType(elementTypes) { + var id = getTypeListId(elementTypes); + var type = tupleTypes[id]; + if (!type) { + type = tupleTypes[id] = createObjectType(8192); + type.elementTypes = elementTypes; + } + return type; + } + function getTypeFromTupleTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNode)); + } + return links.resolvedType; + } + function addTypeToSortedSet(sortedSet, type) { + if (type.flags & 16384) { + addTypesToSortedSet(sortedSet, type.types); + } + else { + var i = 0; + var id = type.id; + while (i < sortedSet.length && sortedSet[i].id < id) { + i++; + } + if (i === sortedSet.length || sortedSet[i].id !== id) { + sortedSet.splice(i, 0, type); + } + } + } + function addTypesToSortedSet(sortedTypes, types) { + for (var i = 0, len = types.length; i < len; i++) { + addTypeToSortedSet(sortedTypes, types[i]); + } + } + function isSubtypeOfAny(candidate, types) { + for (var i = 0, len = types.length; i < len; i++) { + if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { + return true; + } + } + return false; + } + function removeSubtypes(types) { + var i = types.length; + while (i > 0) { + i--; + if (isSubtypeOfAny(types[i], types)) { + types.splice(i, 1); + } + } + } + function containsAnyType(types) { + for (var i = 0; i < types.length; i++) { + if (types[i].flags & 1) { + return true; + } + } + return false; + } + function removeAllButLast(types, typeToRemove) { + var i = types.length; + while (i > 0 && types.length > 1) { + i--; + if (types[i] === typeToRemove) { + types.splice(i, 1); + } + } + } + function getUnionType(types, noSubtypeReduction) { + if (types.length === 0) { + return emptyObjectType; + } + var sortedTypes = []; + addTypesToSortedSet(sortedTypes, types); + if (noSubtypeReduction) { + if (containsAnyType(sortedTypes)) { + return anyType; + } + removeAllButLast(sortedTypes, undefinedType); + removeAllButLast(sortedTypes, nullType); + } + else { + removeSubtypes(sortedTypes); + } + if (sortedTypes.length === 1) { + return sortedTypes[0]; + } + var id = getTypeListId(sortedTypes); + var type = unionTypes[id]; + if (!type) { + type = unionTypes[id] = createObjectType(16384 | getWideningFlagsOfTypes(sortedTypes)); + type.types = sortedTypes; + } + return type; + } + function getTypeFromUnionTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), true); + } + return links.resolvedType; + } + function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = createObjectType(32768, node.symbol); + } + return links.resolvedType; + } + function getStringLiteralType(node) { + if (ts.hasProperty(stringLiteralTypes, node.text)) { + return stringLiteralTypes[node.text]; + } + var type = stringLiteralTypes[node.text] = createType(256); + type.text = ts.getTextOfNode(node); + return type; + } + function getTypeFromStringLiteral(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getStringLiteralType(node); + } + return links.resolvedType; + } + function getTypeFromTypeNode(node) { + switch (node.kind) { + case 110: + return anyType; + case 119: + return stringType; + case 117: + return numberType; + case 111: + return booleanType; + case 120: + return esSymbolType; + case 98: + return voidType; + case 8: + return getTypeFromStringLiteral(node); + case 137: + return getTypeFromTypeReferenceNode(node); + case 140: + return getTypeFromTypeQueryNode(node); + case 142: + return getTypeFromArrayTypeNode(node); + case 143: + return getTypeFromTupleTypeNode(node); + case 144: + return getTypeFromUnionTypeNode(node); + case 145: + return getTypeFromTypeNode(node.type); + case 138: + case 139: + case 141: + return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); + case 64: + case 123: + var symbol = getSymbolInfo(node); + return symbol && getDeclaredTypeOfSymbol(symbol); + default: + return unknownType; + } + } + function instantiateList(items, mapper, instantiator) { + if (items && items.length) { + var result = []; + for (var i = 0; i < items.length; i++) { + result.push(instantiator(items[i], mapper)); + } + return result; + } + return items; + } + function createUnaryTypeMapper(source, target) { + return function (t) { return t === source ? target : t; }; + } + function createBinaryTypeMapper(source1, target1, source2, target2) { + return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; + } + function createTypeMapper(sources, targets) { + switch (sources.length) { + case 1: return createUnaryTypeMapper(sources[0], targets[0]); + case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); + } + return function (t) { + for (var i = 0; i < sources.length; i++) { + if (t === sources[i]) + return targets[i]; + } + return t; + }; + } + function createUnaryTypeEraser(source) { + return function (t) { return t === source ? anyType : t; }; + } + function createBinaryTypeEraser(source1, source2) { + return function (t) { return t === source1 || t === source2 ? anyType : t; }; + } + function createTypeEraser(sources) { + switch (sources.length) { + case 1: return createUnaryTypeEraser(sources[0]); + case 2: return createBinaryTypeEraser(sources[0], sources[1]); + } + return function (t) { + for (var i = 0; i < sources.length; i++) { + if (t === sources[i]) + return anyType; + } + return t; + }; + } + function createInferenceMapper(context) { + return function (t) { + for (var i = 0; i < context.typeParameters.length; i++) { + if (t === context.typeParameters[i]) { + return getInferredType(context, i); + } + } + return t; + }; + } + function identityMapper(type) { + return type; + } + function combineTypeMappers(mapper1, mapper2) { + return function (t) { return mapper2(mapper1(t)); }; + } + function instantiateTypeParameter(typeParameter, mapper) { + var result = createType(512); + result.symbol = typeParameter.symbol; + if (typeParameter.constraint) { + result.constraint = instantiateType(typeParameter.constraint, mapper); + } + else { + result.target = typeParameter; + result.mapper = mapper; + } + return result; + } + function instantiateSignature(signature, mapper, eraseTypeParameters) { + if (signature.typeParameters && !eraseTypeParameters) { + var freshTypeParameters = instantiateList(signature.typeParameters, mapper, instantiateTypeParameter); + mapper = combineTypeMappers(createTypeMapper(signature.typeParameters, freshTypeParameters), mapper); + } + var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), signature.resolvedReturnType ? instantiateType(signature.resolvedReturnType, mapper) : undefined, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); + result.target = signature; + result.mapper = mapper; + return result; + } + function instantiateSymbol(symbol, mapper) { + if (symbol.flags & 16777216) { + var links = getSymbolLinks(symbol); + symbol = links.target; + mapper = combineTypeMappers(links.mapper, mapper); + } + var result = createSymbol(16777216 | 67108864 | symbol.flags, symbol.name); + result.declarations = symbol.declarations; + result.parent = symbol.parent; + result.target = symbol; + result.mapper = mapper; + if (symbol.valueDeclaration) { + result.valueDeclaration = symbol.valueDeclaration; + } + return result; + } + function instantiateAnonymousType(type, mapper) { + var result = createObjectType(32768, 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); + return result; + } + function instantiateType(type, mapper) { + if (mapper !== identityMapper) { + if (type.flags & 512) { + return mapper(type); + } + if (type.flags & 32768) { + return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? instantiateAnonymousType(type, mapper) : type; + } + if (type.flags & 4096) { + return createTypeReference(type.target, instantiateList(type.typeArguments, mapper, instantiateType)); + } + if (type.flags & 8192) { + return createTupleType(instantiateList(type.elementTypes, mapper, instantiateType)); + } + if (type.flags & 16384) { + return getUnionType(instantiateList(type.types, mapper, instantiateType), true); + } + } + return type; + } + function isContextSensitive(node) { + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); + switch (node.kind) { + case 158: + case 159: + return isContextSensitiveFunctionLikeDeclaration(node); + case 150: + return ts.forEach(node.properties, isContextSensitive); + case 149: + return ts.forEach(node.elements, isContextSensitive); + case 166: + return isContextSensitive(node.whenTrue) || + isContextSensitive(node.whenFalse); + case 165: + return node.operatorToken.kind === 49 && + (isContextSensitive(node.left) || isContextSensitive(node.right)); + case 207: + return isContextSensitive(node.initializer); + case 130: + case 129: + return isContextSensitiveFunctionLikeDeclaration(node); + case 157: + return isContextSensitive(node.expression); + } + return false; + } + function isContextSensitiveFunctionLikeDeclaration(node) { + return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { return p.type; }); + } + function getTypeWithoutConstructors(type) { + if (type.flags & 48128) { + var resolved = resolveObjectOrUnionTypeMembers(type); + if (resolved.constructSignatures.length) { + var result = createObjectType(32768, type.symbol); + result.members = resolved.members; + result.properties = resolved.properties; + result.callSignatures = resolved.callSignatures; + result.constructSignatures = emptyArray; + type = result; + } + } + return type; + } + var subtypeRelation = {}; + var assignableRelation = {}; + var identityRelation = {}; + function isTypeIdenticalTo(source, target) { + return checkTypeRelatedTo(source, target, identityRelation, undefined); + } + function compareTypes(source, target) { + return checkTypeRelatedTo(source, target, identityRelation, undefined) ? -1 : 0; + } + function isTypeSubtypeOf(source, target) { + return checkTypeSubtypeOf(source, target, undefined); + } + function isTypeAssignableTo(source, target) { + return checkTypeAssignableTo(source, target, undefined); + } + function checkTypeSubtypeOf(source, target, errorNode, headMessage, containingMessageChain) { + return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain); + } + function checkTypeAssignableTo(source, target, errorNode, headMessage) { + return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage); + } + function isSignatureAssignableTo(source, target) { + var sourceType = getOrCreateTypeFromSignature(source); + var targetType = getOrCreateTypeFromSignature(target); + return checkTypeRelatedTo(sourceType, targetType, assignableRelation, undefined); + } + function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain) { + var errorInfo; + var sourceStack; + var targetStack; + var maybeStack; + var expandingFlags; + var depth = 0; + var overflow = false; + ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking"); + var result = isRelatedTo(source, target, errorNode !== undefined, headMessage); + if (overflow) { + error(errorNode, ts.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); + } + else if (errorInfo) { + if (errorInfo.next === undefined) { + errorInfo = undefined; + isRelatedTo(source, target, errorNode !== undefined, headMessage, true); + } + if (containingMessageChain) { + errorInfo = ts.concatenateDiagnosticMessageChains(containingMessageChain, errorInfo); + } + diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo)); + } + return result !== 0; + function reportError(message, arg0, arg1, arg2) { + errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); + } + function isRelatedTo(source, target, reportErrors, headMessage, elaborateErrors) { + if (elaborateErrors === void 0) { elaborateErrors = false; } + var result; + if (source === target) + return -1; + if (relation !== identityRelation) { + if (target.flags & 1) + return -1; + if (source === undefinedType) + return -1; + if (source === nullType && target !== undefinedType) + return -1; + if (source.flags & 128 && target === numberType) + return -1; + if (source.flags & 256 && target === stringType) + return -1; + if (relation === assignableRelation) { + if (source.flags & 1) + return -1; + if (source === numberType && target.flags & 128) + return -1; + } + } + if (source.flags & 16384 || target.flags & 16384) { + if (relation === identityRelation) { + if (source.flags & 16384 && target.flags & 16384) { + if (result = unionTypeRelatedToUnionType(source, target)) { + if (result &= unionTypeRelatedToUnionType(target, source)) { + return result; + } + } + } + else if (source.flags & 16384) { + if (result = unionTypeRelatedToType(source, target, reportErrors)) { + return result; + } + } + else { + if (result = unionTypeRelatedToType(target, source, reportErrors)) { + return result; + } + } + } + else { + if (source.flags & 16384) { + if (result = unionTypeRelatedToType(source, target, reportErrors)) { + return result; + } + } + else { + if (result = typeRelatedToUnionType(source, target, reportErrors)) { + return result; + } + } + } + } + else if (source.flags & 512 && target.flags & 512) { + if (result = typeParameterRelatedTo(source, target, reportErrors)) { + return result; + } + } + else { + var saveErrorInfo = errorInfo; + if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { + if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + return result; + } + } + var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; + var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); + if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && + (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { + errorInfo = saveErrorInfo; + return result; + } + } + if (reportErrors) { + headMessage = headMessage || ts.Diagnostics.Type_0_is_not_assignable_to_type_1; + var sourceType = typeToString(source); + var targetType = typeToString(target); + if (sourceType === targetType) { + sourceType = typeToString(source, undefined, 128); + targetType = typeToString(target, undefined, 128); + } + reportError(headMessage, sourceType, targetType); + } + return 0; + } + function unionTypeRelatedToUnionType(source, target) { + var result = -1; + var sourceTypes = source.types; + for (var i = 0, len = sourceTypes.length; i < len; i++) { + var related = typeRelatedToUnionType(sourceTypes[i], target, false); + if (!related) { + return 0; + } + result &= related; + } + return result; + } + function typeRelatedToUnionType(source, target, reportErrors) { + var targetTypes = target.types; + for (var i = 0, len = targetTypes.length; i < len; i++) { + var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); + if (related) { + return related; + } + } + return 0; + } + function unionTypeRelatedToType(source, target, reportErrors) { + var result = -1; + var sourceTypes = source.types; + for (var i = 0, len = sourceTypes.length; i < len; i++) { + var related = isRelatedTo(sourceTypes[i], target, reportErrors); + if (!related) { + return 0; + } + result &= related; + } + return result; + } + function typesRelatedTo(sources, targets, reportErrors) { + var result = -1; + for (var i = 0, len = sources.length; i < len; i++) { + var related = isRelatedTo(sources[i], targets[i], reportErrors); + if (!related) { + return 0; + } + result &= related; + } + return result; + } + function typeParameterRelatedTo(source, target, reportErrors) { + if (relation === identityRelation) { + if (source.symbol.name !== target.symbol.name) { + return 0; + } + if (source.constraint === target.constraint) { + return -1; + } + if (source.constraint === noConstraintType || target.constraint === noConstraintType) { + return 0; + } + return isRelatedTo(source.constraint, target.constraint, reportErrors); + } + else { + while (true) { + var constraint = getConstraintOfTypeParameter(source); + if (constraint === target) + return -1; + if (!(constraint && constraint.flags & 512)) + break; + source = constraint; + } + return 0; + } + } + function objectTypeRelatedTo(source, target, reportErrors, elaborateErrors) { + if (elaborateErrors === void 0) { elaborateErrors = false; } + if (overflow) { + return 0; + } + var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; + var related = relation[id]; + if (related !== undefined) { + if (!elaborateErrors || (related === 3)) { + return related === 1 ? -1 : 0; + } + } + if (depth > 0) { + for (var i = 0; i < depth; i++) { + if (maybeStack[i][id]) { + return 1; + } + } + if (depth === 100) { + overflow = true; + return 0; + } + } + else { + sourceStack = []; + targetStack = []; + maybeStack = []; + expandingFlags = 0; + } + sourceStack[depth] = source; + targetStack[depth] = target; + maybeStack[depth] = {}; + maybeStack[depth][id] = 1; + depth++; + var saveExpandingFlags = expandingFlags; + if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack)) + expandingFlags |= 1; + if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack)) + expandingFlags |= 2; + if (expandingFlags === 3) { + var result = 1; + } + else { + var result = propertiesRelatedTo(source, target, reportErrors); + if (result) { + result &= signaturesRelatedTo(source, target, 0, reportErrors); + if (result) { + result &= signaturesRelatedTo(source, target, 1, reportErrors); + if (result) { + result &= stringIndexTypesRelatedTo(source, target, reportErrors); + if (result) { + result &= numberIndexTypesRelatedTo(source, target, reportErrors); + } + } + } + } + } + expandingFlags = saveExpandingFlags; + depth--; + if (result) { + var maybeCache = maybeStack[depth]; + var destinationCache = (result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; + ts.copyMap(maybeCache, destinationCache); + } + else { + relation[id] = reportErrors ? 3 : 2; + } + return result; + } + function isDeeplyNestedGeneric(type, stack) { + if (type.flags & 4096 && depth >= 10) { + var target = type.target; + var count = 0; + for (var i = 0; i < depth; i++) { + var t = stack[i]; + if (t.flags & 4096 && t.target === target) { + count++; + if (count >= 10) + return true; + } + } + } + return false; + } + function propertiesRelatedTo(source, target, reportErrors) { + if (relation === identityRelation) { + return propertiesIdenticalTo(source, target); + } + var result = -1; + var properties = getPropertiesOfObjectType(target); + var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); + for (var i = 0; i < properties.length; i++) { + var targetProp = properties[i]; + var sourceProp = getPropertyOfType(source, targetProp.name); + if (sourceProp !== targetProp) { + if (!sourceProp) { + if (!(targetProp.flags & 536870912) || requireOptionalProperties) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); + } + return 0; + } + } + else if (!(targetProp.flags & 134217728)) { + var sourceFlags = getDeclarationFlagsFromSymbol(sourceProp); + var targetFlags = getDeclarationFlagsFromSymbol(targetProp); + if (sourceFlags & 32 || targetFlags & 32) { + if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { + if (reportErrors) { + if (sourceFlags & 32 && targetFlags & 32) { + reportError(ts.Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp)); + } + else { + reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourceFlags & 32 ? source : target), typeToString(sourceFlags & 32 ? target : source)); + } + } + return 0; + } + } + else if (targetFlags & 64) { + var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32; + var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(sourceProp.parent) : undefined; + var targetClass = getDeclaredTypeOfSymbol(targetProp.parent); + if (!sourceClass || !hasBaseType(sourceClass, targetClass)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass)); + } + return 0; + } + } + else if (sourceFlags & 64) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); + } + return 0; + } + var related = isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp)); + } + return 0; + } + result &= related; + if (sourceProp.flags & 536870912 && !(targetProp.flags & 536870912)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); + } + return 0; + } + } + } + } + return result; + } + function propertiesIdenticalTo(source, target) { + var sourceProperties = getPropertiesOfObjectType(source); + var targetProperties = getPropertiesOfObjectType(target); + if (sourceProperties.length !== targetProperties.length) { + return 0; + } + var result = -1; + for (var i = 0, len = sourceProperties.length; i < len; ++i) { + var sourceProp = sourceProperties[i]; + var targetProp = getPropertyOfObjectType(target, sourceProp.name); + if (!targetProp) { + return 0; + } + var related = compareProperties(sourceProp, targetProp, isRelatedTo); + if (!related) { + return 0; + } + result &= related; + } + return result; + } + function signaturesRelatedTo(source, target, kind, reportErrors) { + if (relation === identityRelation) { + return signaturesIdenticalTo(source, target, kind); + } + if (target === anyFunctionType || source === anyFunctionType) { + return -1; + } + var sourceSignatures = getSignaturesOfType(source, kind); + var targetSignatures = getSignaturesOfType(target, kind); + var result = -1; + var saveErrorInfo = errorInfo; + outer: for (var i = 0; i < targetSignatures.length; i++) { + var t = targetSignatures[i]; + if (!t.hasStringLiterals || target.flags & 65536) { + var localErrors = reportErrors; + for (var j = 0; j < sourceSignatures.length; j++) { + var s = sourceSignatures[j]; + if (!s.hasStringLiterals || source.flags & 65536) { + var related = signatureRelatedTo(s, t, localErrors); + if (related) { + result &= related; + errorInfo = saveErrorInfo; + continue outer; + } + localErrors = false; + } + } + return 0; + } + } + return result; + } + function signatureRelatedTo(source, target, reportErrors) { + if (source === target) { + return -1; + } + if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) { + return 0; + } + var sourceMax = source.parameters.length; + var targetMax = target.parameters.length; + var checkCount; + if (source.hasRestParameter && target.hasRestParameter) { + checkCount = sourceMax > targetMax ? sourceMax : targetMax; + sourceMax--; + targetMax--; + } + else if (source.hasRestParameter) { + sourceMax--; + checkCount = targetMax; + } + else if (target.hasRestParameter) { + targetMax--; + checkCount = sourceMax; + } + else { + checkCount = sourceMax < targetMax ? sourceMax : targetMax; + } + source = getErasedSignature(source); + target = getErasedSignature(target); + var result = -1; + for (var i = 0; i < checkCount; i++) { + var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); + var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); + var saveErrorInfo = errorInfo; + var related = isRelatedTo(s, t, reportErrors); + if (!related) { + related = isRelatedTo(t, s, false); + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, source.parameters[i < sourceMax ? i : sourceMax].name, target.parameters[i < targetMax ? i : targetMax].name); + } + return 0; + } + errorInfo = saveErrorInfo; + } + result &= related; + } + var t = getReturnTypeOfSignature(target); + if (t === voidType) + return result; + var s = getReturnTypeOfSignature(source); + return result & isRelatedTo(s, t, reportErrors); + } + function signaturesIdenticalTo(source, target, kind) { + var sourceSignatures = getSignaturesOfType(source, kind); + var targetSignatures = getSignaturesOfType(target, kind); + if (sourceSignatures.length !== targetSignatures.length) { + return 0; + } + var result = -1; + for (var i = 0, len = sourceSignatures.length; i < len; ++i) { + var related = compareSignatures(sourceSignatures[i], targetSignatures[i], true, isRelatedTo); + if (!related) { + return 0; + } + result &= related; + } + return result; + } + function stringIndexTypesRelatedTo(source, target, reportErrors) { + if (relation === identityRelation) { + return indexTypesIdenticalTo(0, source, target); + } + var targetType = getIndexTypeOfType(target, 0); + if (targetType) { + var sourceType = getIndexTypeOfType(source, 0); + if (!sourceType) { + if (reportErrors) { + reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); + } + return 0; + } + var related = isRelatedTo(sourceType, targetType, reportErrors); + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Index_signatures_are_incompatible); + } + return 0; + } + return related; + } + return -1; + } + function numberIndexTypesRelatedTo(source, target, reportErrors) { + if (relation === identityRelation) { + return indexTypesIdenticalTo(1, source, target); + } + var targetType = getIndexTypeOfType(target, 1); + if (targetType) { + var sourceStringType = getIndexTypeOfType(source, 0); + var sourceNumberType = getIndexTypeOfType(source, 1); + if (!(sourceStringType || sourceNumberType)) { + if (reportErrors) { + reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); + } + return 0; + } + if (sourceStringType && sourceNumberType) { + var related = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); + } + else { + var related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); + } + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Index_signatures_are_incompatible); + } + return 0; + } + return related; + } + return -1; + } + function indexTypesIdenticalTo(indexKind, source, target) { + var targetType = getIndexTypeOfType(target, indexKind); + var sourceType = getIndexTypeOfType(source, indexKind); + if (!sourceType && !targetType) { + return -1; + } + if (sourceType && targetType) { + return isRelatedTo(sourceType, targetType); + } + return 0; + } + } + function isPropertyIdenticalTo(sourceProp, targetProp) { + return compareProperties(sourceProp, targetProp, compareTypes) !== 0; + } + function compareProperties(sourceProp, targetProp, compareTypes) { + if (sourceProp === targetProp) { + return -1; + } + var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (32 | 64); + var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (32 | 64); + if (sourcePropAccessibility !== targetPropAccessibility) { + return 0; + } + if (sourcePropAccessibility) { + if (getTargetSymbol(sourceProp) !== getTargetSymbol(targetProp)) { + return 0; + } + } + else { + if ((sourceProp.flags & 536870912) !== (targetProp.flags & 536870912)) { + return 0; + } + } + return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); + } + function compareSignatures(source, target, compareReturnTypes, compareTypes) { + if (source === target) { + return -1; + } + if (source.parameters.length !== target.parameters.length || + source.minArgumentCount !== target.minArgumentCount || + source.hasRestParameter !== target.hasRestParameter) { + return 0; + } + var result = -1; + if (source.typeParameters && target.typeParameters) { + if (source.typeParameters.length !== target.typeParameters.length) { + return 0; + } + for (var i = 0, len = source.typeParameters.length; i < len; ++i) { + var related = compareTypes(source.typeParameters[i], target.typeParameters[i]); + if (!related) { + return 0; + } + result &= related; + } + } + else if (source.typeParameters || target.typeParameters) { + return 0; + } + source = getErasedSignature(source); + target = getErasedSignature(target); + for (var i = 0, len = source.parameters.length; i < len; i++) { + var s = source.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); + var t = target.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); + var related = compareTypes(s, t); + if (!related) { + return 0; + } + result &= related; + } + if (compareReturnTypes) { + result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); + } + return result; + } + function isSupertypeOfEach(candidate, types) { + for (var i = 0, len = types.length; i < len; i++) { + if (candidate !== types[i] && !isTypeSubtypeOf(types[i], candidate)) + return false; + } + return true; + } + function getCommonSupertype(types) { + return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + } + function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { + var bestSupertype; + var bestSupertypeDownfallType; + var bestSupertypeScore = 0; + for (var i = 0; i < types.length; i++) { + var score = 0; + var downfallType = undefined; + for (var j = 0; j < types.length; j++) { + if (isTypeSubtypeOf(types[j], types[i])) { + score++; + } + else if (!downfallType) { + downfallType = types[j]; + } + } + if (score > bestSupertypeScore) { + bestSupertype = types[i]; + bestSupertypeDownfallType = downfallType; + bestSupertypeScore = score; + } + if (bestSupertypeScore === types.length - 1) { + break; + } + } + checkTypeSubtypeOf(bestSupertypeDownfallType, bestSupertype, errorLocation, ts.Diagnostics.Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0, errorMessageChainHead); + } + function isArrayType(type) { + return type.flags & 4096 && type.target === globalArrayType; + } + function isArrayLikeType(type) { + return !(type.flags & (32 | 64)) && isTypeAssignableTo(type, anyArrayType); + } + function isTupleLikeType(type) { + return !!getPropertyOfType(type, "0"); + } + function getWidenedTypeOfObjectLiteral(type) { + var properties = getPropertiesOfObjectType(type); + var members = {}; + ts.forEach(properties, function (p) { + var propType = getTypeOfSymbol(p); + var widenedType = getWidenedType(propType); + if (propType !== widenedType) { + var symbol = createSymbol(p.flags | 67108864, p.name); + symbol.declarations = p.declarations; + symbol.parent = p.parent; + symbol.type = widenedType; + symbol.target = p; + if (p.valueDeclaration) + symbol.valueDeclaration = p.valueDeclaration; + p = symbol; + } + members[p.name] = p; + }); + var stringIndexType = getIndexTypeOfType(type, 0); + var numberIndexType = getIndexTypeOfType(type, 1); + if (stringIndexType) + stringIndexType = getWidenedType(stringIndexType); + if (numberIndexType) + numberIndexType = getWidenedType(numberIndexType); + return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexType, numberIndexType); + } + function getWidenedType(type) { + if (type.flags & 786432) { + if (type.flags & (32 | 64)) { + return anyType; + } + if (type.flags & 131072) { + return getWidenedTypeOfObjectLiteral(type); + } + if (type.flags & 16384) { + return getUnionType(ts.map(type.types, getWidenedType)); + } + if (isArrayType(type)) { + return createArrayType(getWidenedType(type.typeArguments[0])); + } + } + return type; + } + function reportWideningErrorsInType(type) { + if (type.flags & 16384) { + var errorReported = false; + ts.forEach(type.types, function (t) { + if (reportWideningErrorsInType(t)) { + errorReported = true; + } + }); + return errorReported; + } + if (isArrayType(type)) { + return reportWideningErrorsInType(type.typeArguments[0]); + } + if (type.flags & 131072) { + var errorReported = false; + ts.forEach(getPropertiesOfObjectType(type), function (p) { + var t = getTypeOfSymbol(p); + if (t.flags & 262144) { + if (!reportWideningErrorsInType(t)) { + error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t))); + } + errorReported = true; + } + }); + return errorReported; + } + return false; + } + function reportImplicitAnyError(declaration, type) { + var typeAsString = typeToString(getWidenedType(type)); + switch (declaration.kind) { + case 128: + case 127: + var diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; + break; + case 126: + var diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; + break; + case 193: + case 130: + case 129: + case 132: + case 133: + case 158: + case 159: + if (!declaration.name) { + error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); + return; + } + var diagnostic = ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; + break; + default: + var diagnostic = ts.Diagnostics.Variable_0_implicitly_has_an_1_type; + } + error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString); + } + function reportErrorsFromWidening(declaration, type) { + if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 262144) { + if (!reportWideningErrorsInType(type)) { + reportImplicitAnyError(declaration, type); + } + } + } + function forEachMatchingParameterType(source, target, callback) { + var sourceMax = source.parameters.length; + var targetMax = target.parameters.length; + var count; + if (source.hasRestParameter && target.hasRestParameter) { + count = sourceMax > targetMax ? sourceMax : targetMax; + sourceMax--; + targetMax--; + } + else if (source.hasRestParameter) { + sourceMax--; + count = targetMax; + } + else if (target.hasRestParameter) { + targetMax--; + count = sourceMax; + } + else { + count = sourceMax < targetMax ? sourceMax : targetMax; + } + for (var i = 0; i < count; i++) { + var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); + var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); + callback(s, t); + } + } + function createInferenceContext(typeParameters, inferUnionTypes) { + var inferences = []; + for (var i = 0; i < typeParameters.length; i++) { + inferences.push({ primary: undefined, secondary: undefined }); + } + return { + typeParameters: typeParameters, + inferUnionTypes: inferUnionTypes, + inferenceCount: 0, + inferences: inferences, + inferredTypes: new Array(typeParameters.length) + }; + } + function inferTypes(context, source, target) { + var sourceStack; + var targetStack; + var depth = 0; + var inferiority = 0; + inferFromTypes(source, target); + function isInProcess(source, target) { + for (var i = 0; i < depth; i++) { + if (source === sourceStack[i] && target === targetStack[i]) + return true; + } + return false; + } + function isWithinDepthLimit(type, stack) { + if (depth >= 5) { + var target = type.target; + var count = 0; + for (var i = 0; i < depth; i++) { + var t = stack[i]; + if (t.flags & 4096 && t.target === target) + count++; + } + return count < 5; + } + return true; + } + function inferFromTypes(source, target) { + if (source === anyFunctionType) { + return; + } + if (target.flags & 512) { + var typeParameters = context.typeParameters; + for (var i = 0; i < typeParameters.length; i++) { + if (target === typeParameters[i]) { + var inferences = context.inferences[i]; + var candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : inferences.primary || (inferences.primary = []); + if (!ts.contains(candidates, source)) + candidates.push(source); + break; + } + } + } + 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++) { + inferFromTypes(sourceTypes[i], targetTypes[i]); + } + } + else if (target.flags & 16384) { + var targetTypes = target.types; + var typeParameterCount = 0; + var typeParameter; + for (var i = 0; i < targetTypes.length; i++) { + var t = targetTypes[i]; + if (t.flags & 512 && ts.contains(context.typeParameters, t)) { + typeParameter = t; + typeParameterCount++; + } + else { + inferFromTypes(source, t); + } + } + if (typeParameterCount === 1) { + inferiority++; + inferFromTypes(source, typeParameter); + inferiority--; + } + } + else if (source.flags & 16384) { + var sourceTypes = source.types; + for (var i = 0; i < sourceTypes.length; i++) { + inferFromTypes(sourceTypes[i], target); + } + } + else if (source.flags & 48128 && (target.flags & (4096 | 8192) || + (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { + if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { + if (depth === 0) { + sourceStack = []; + targetStack = []; + } + sourceStack[depth] = source; + targetStack[depth] = target; + depth++; + inferFromProperties(source, target); + inferFromSignatures(source, target, 0); + inferFromSignatures(source, target, 1); + inferFromIndexTypes(source, target, 0, 0); + inferFromIndexTypes(source, target, 1, 1); + inferFromIndexTypes(source, target, 0, 1); + depth--; + } + } + } + function inferFromProperties(source, target) { + var properties = getPropertiesOfObjectType(target); + for (var i = 0; i < properties.length; i++) { + var targetProp = properties[i]; + var sourceProp = getPropertyOfObjectType(source, targetProp.name); + if (sourceProp) { + inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); + } + } + } + function inferFromSignatures(source, target, kind) { + var sourceSignatures = getSignaturesOfType(source, kind); + var targetSignatures = getSignaturesOfType(target, kind); + var sourceLen = sourceSignatures.length; + var targetLen = targetSignatures.length; + var len = sourceLen < targetLen ? sourceLen : targetLen; + for (var i = 0; i < len; i++) { + inferFromSignature(getErasedSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i])); + } + } + function inferFromSignature(source, target) { + forEachMatchingParameterType(source, target, inferFromTypes); + inferFromTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); + } + function inferFromIndexTypes(source, target, sourceKind, targetKind) { + var targetIndexType = getIndexTypeOfType(target, targetKind); + if (targetIndexType) { + var sourceIndexType = getIndexTypeOfType(source, sourceKind); + if (sourceIndexType) { + inferFromTypes(sourceIndexType, targetIndexType); + } + } + } + } + function getInferenceCandidates(context, index) { + var inferences = context.inferences[index]; + return inferences.primary || inferences.secondary || emptyArray; + } + function getInferredType(context, index) { + var inferredType = context.inferredTypes[index]; + if (!inferredType) { + var inferences = getInferenceCandidates(context, index); + if (inferences.length) { + var unionOrSuperType = context.inferUnionTypes ? getUnionType(inferences) : getCommonSupertype(inferences); + inferredType = unionOrSuperType ? getWidenedType(unionOrSuperType) : inferenceFailureType; + } + else { + inferredType = emptyObjectType; + } + if (inferredType !== inferenceFailureType) { + var constraint = getConstraintOfTypeParameter(context.typeParameters[index]); + inferredType = constraint && !isTypeAssignableTo(inferredType, constraint) ? constraint : inferredType; + } + context.inferredTypes[index] = inferredType; + } + return inferredType; + } + function getInferredTypes(context) { + for (var i = 0; i < context.inferredTypes.length; i++) { + getInferredType(context, i); + } + return context.inferredTypes; + } + function hasAncestor(node, kind) { + return ts.getAncestor(node, kind) !== undefined; + } + function getResolvedSymbol(node) { + var links = getNodeLinks(node); + if (!links.resolvedSymbol) { + links.resolvedSymbol = (ts.getFullWidth(node) > 0 && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + } + return links.resolvedSymbol; + } + function isInTypeQuery(node) { + while (node) { + switch (node.kind) { + case 140: + return true; + case 64: + case 123: + node = node.parent; + continue; + default: + return false; + } + } + ts.Debug.fail("should not get here"); + } + function removeTypesFromUnionType(type, typeKind, isOfTypeKind) { + if (type.flags & 16384) { + var types = type.types; + if (ts.forEach(types, function (t) { return !!(t.flags & typeKind) === isOfTypeKind; })) { + var narrowedType = getUnionType(ts.filter(types, function (t) { return !(t.flags & typeKind) === isOfTypeKind; })); + if (narrowedType !== emptyObjectType) { + return narrowedType; + } + } + } + return type; + } + function hasInitializer(node) { + return !!(node.initializer || ts.isBindingPattern(node.parent) && hasInitializer(node.parent.parent)); + } + function isVariableAssignedWithin(symbol, node) { + var links = getNodeLinks(node); + if (links.assignmentChecks) { + var cachedResult = links.assignmentChecks[symbol.id]; + if (cachedResult !== undefined) { + return cachedResult; + } + } + else { + links.assignmentChecks = {}; + } + return links.assignmentChecks[symbol.id] = isAssignedIn(node); + function isAssignedInBinaryExpression(node) { + if (node.operatorToken.kind >= 52 && node.operatorToken.kind <= 63) { + var n = node.left; + while (n.kind === 157) { + n = n.expression; + } + if (n.kind === 64 && getResolvedSymbol(n) === symbol) { + return true; + } + } + return ts.forEachChild(node, isAssignedIn); + } + function isAssignedInVariableDeclaration(node) { + if (!ts.isBindingPattern(node.name) && getSymbolOfNode(node) === symbol && hasInitializer(node)) { + return true; + } + return ts.forEachChild(node, isAssignedIn); + } + function isAssignedIn(node) { + switch (node.kind) { + case 165: + return isAssignedInBinaryExpression(node); + case 191: + case 148: + return isAssignedInVariableDeclaration(node); + case 146: + case 147: + case 149: + case 150: + case 151: + case 152: + case 153: + case 154: + case 156: + case 157: + case 163: + case 160: + case 161: + case 162: + case 164: + case 166: + case 169: + case 172: + case 173: + case 175: + case 176: + case 177: + case 178: + case 179: + case 180: + case 181: + case 184: + case 185: + case 186: + case 203: + case 204: + case 187: + case 188: + case 189: + case 206: + return ts.forEachChild(node, isAssignedIn); + } + return false; + } + } + function resolveLocation(node) { + var containerNodes = []; + for (var parent = node.parent; parent; parent = parent.parent) { + if ((ts.isExpression(parent) || ts.isObjectLiteralMethod(node)) && + isContextSensitive(parent)) { + containerNodes.unshift(parent); + } + } + ts.forEach(containerNodes, function (node) { getTypeOfNode(node); }); + } + function getSymbolAtLocation(node) { + resolveLocation(node); + return getSymbolInfo(node); + } + function getTypeAtLocation(node) { + resolveLocation(node); + return getTypeOfNode(node); + } + function getTypeOfSymbolAtLocation(symbol, node) { + resolveLocation(node); + return getNarrowedTypeOfSymbol(symbol, node); + } + function getNarrowedTypeOfSymbol(symbol, node) { + var type = getTypeOfSymbol(symbol); + if (node && symbol.flags & 3 && type.flags & (1 | 48128 | 16384 | 512)) { + loop: while (node.parent) { + var child = node; + node = node.parent; + var narrowedType = type; + switch (node.kind) { + case 176: + if (child !== node.expression) { + narrowedType = narrowType(type, node.expression, child === node.thenStatement); + } + break; + case 166: + if (child !== node.condition) { + narrowedType = narrowType(type, node.condition, child === node.whenTrue); + } + break; + case 165: + if (child === node.right) { + if (node.operatorToken.kind === 48) { + narrowedType = narrowType(type, node.left, true); + } + else if (node.operatorToken.kind === 49) { + narrowedType = narrowType(type, node.left, false); + } + } + break; + case 210: + case 198: + case 193: + case 130: + case 129: + case 132: + case 133: + case 131: + break loop; + } + if (narrowedType !== type) { + if (isVariableAssignedWithin(symbol, node)) { + break; + } + type = narrowedType; + } + } + } + return type; + function narrowTypeByEquality(type, expr, assumeTrue) { + if (expr.left.kind !== 161 || expr.right.kind !== 8) { + return type; + } + var left = expr.left; + var right = expr.right; + if (left.expression.kind !== 64 || getResolvedSymbol(left.expression) !== symbol) { + return type; + } + var typeInfo = primitiveTypeInfo[right.text]; + if (expr.operatorToken.kind === 31) { + assumeTrue = !assumeTrue; + } + if (assumeTrue) { + if (!typeInfo) { + return removeTypesFromUnionType(type, 258 | 132 | 8 | 1048576, true); + } + if (isTypeSubtypeOf(typeInfo.type, type)) { + return typeInfo.type; + } + return removeTypesFromUnionType(type, typeInfo.flags, false); + } + else { + if (typeInfo) { + return removeTypesFromUnionType(type, typeInfo.flags, true); + } + return type; + } + } + function narrowTypeByAnd(type, expr, assumeTrue) { + if (assumeTrue) { + return narrowType(narrowType(type, expr.left, true), expr.right, true); + } + else { + return getUnionType([ + narrowType(type, expr.left, false), + narrowType(narrowType(type, expr.left, true), expr.right, false) + ]); + } + } + function narrowTypeByOr(type, expr, assumeTrue) { + if (assumeTrue) { + return getUnionType([ + narrowType(type, expr.left, true), + narrowType(narrowType(type, expr.left, false), expr.right, true) + ]); + } + else { + return narrowType(narrowType(type, expr.left, false), expr.right, false); + } + } + function narrowTypeByInstanceof(type, expr, assumeTrue) { + if (type.flags & 1 || !assumeTrue || expr.left.kind !== 64 || getResolvedSymbol(expr.left) !== symbol) { + return type; + } + var rightType = checkExpression(expr.right); + if (!isTypeSubtypeOf(rightType, globalFunctionType)) { + return type; + } + var prototypeProperty = getPropertyOfType(rightType, "prototype"); + if (!prototypeProperty) { + return type; + } + var targetType = getTypeOfSymbol(prototypeProperty); + if (isTypeSubtypeOf(targetType, type)) { + return targetType; + } + if (type.flags & 16384) { + return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); + } + return type; + } + function narrowType(type, expr, assumeTrue) { + switch (expr.kind) { + case 157: + return narrowType(type, expr.expression, assumeTrue); + case 165: + var operator = expr.operatorToken.kind; + if (operator === 30 || operator === 31) { + return narrowTypeByEquality(type, expr, assumeTrue); + } + else if (operator === 48) { + return narrowTypeByAnd(type, expr, assumeTrue); + } + else if (operator === 49) { + return narrowTypeByOr(type, expr, assumeTrue); + } + else if (operator === 86) { + return narrowTypeByInstanceof(type, expr, assumeTrue); + } + break; + case 163: + if (expr.operator === 46) { + return narrowType(type, expr.operand, !assumeTrue); + } + break; + } + return type; + } + } + function markLinkedImportsAsReferenced(node) { + var nodeLinks = getNodeLinks(node); + while (nodeLinks.importOnRightSide) { + var rightSide = nodeLinks.importOnRightSide; + nodeLinks.importOnRightSide = undefined; + getSymbolLinks(rightSide).referenced = true; + ts.Debug.assert((rightSide.flags & 8388608) !== 0); + nodeLinks = getNodeLinks(ts.getDeclarationOfKind(rightSide, 200)); + } + } + function checkIdentifier(node) { + var symbol = getResolvedSymbol(node); + if (symbol === argumentsSymbol && ts.getContainingFunction(node).kind === 159) { + error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression); + } + if (symbol.flags & 8388608) { + var symbolLinks = getSymbolLinks(symbol); + if (!symbolLinks.referenced) { + var importOrExportAssignment = getLeftSideOfImportOrExportAssignment(node); + if (!importOrExportAssignment || + (importOrExportAssignment.flags & 1) || + (importOrExportAssignment.kind === 201)) { + symbolLinks.referenced = !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveImport(symbol)); + } + else { + var nodeLinks = getNodeLinks(importOrExportAssignment); + ts.Debug.assert(!nodeLinks.importOnRightSide); + nodeLinks.importOnRightSide = symbol; + } + } + if (symbolLinks.referenced) { + markLinkedImportsAsReferenced(ts.getDeclarationOfKind(symbol, 200)); + } + } + checkCollisionWithCapturedSuperVariable(node, node); + checkCollisionWithCapturedThisVariable(node, node); + return getNarrowedTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol), node); + } + function captureLexicalThis(node, container) { + var classNode = container.parent && container.parent.kind === 194 ? container.parent : undefined; + getNodeLinks(node).flags |= 2; + if (container.kind === 128 || container.kind === 131) { + getNodeLinks(classNode).flags |= 4; + } + else { + getNodeLinks(container).flags |= 4; + } + } + function checkThisExpression(node) { + var container = ts.getThisContainer(node, true); + var needToCaptureLexicalThis = false; + if (container.kind === 159) { + container = ts.getThisContainer(container, false); + needToCaptureLexicalThis = (languageVersion < 2); + } + switch (container.kind) { + case 198: + error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); + break; + case 197: + error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); + break; + case 131: + if (isInConstructorArgumentInitializer(node, container)) { + error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); + } + break; + case 128: + case 127: + if (container.flags & 128) { + error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); + } + break; + case 124: + error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); + break; + } + if (needToCaptureLexicalThis) { + captureLexicalThis(node, container); + } + var classNode = container.parent && container.parent.kind === 194 ? container.parent : undefined; + if (classNode) { + var symbol = getSymbolOfNode(classNode); + return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); + } + return anyType; + } + function isInConstructorArgumentInitializer(node, constructorDecl) { + for (var n = node; n && n !== constructorDecl; n = n.parent) { + if (n.kind === 126) { + return true; + } + } + return false; + } + function checkSuperExpression(node) { + var isCallExpression = node.parent.kind === 153 && node.parent.expression === node; + var enclosingClass = ts.getAncestor(node, 194); + var baseClass; + if (enclosingClass && ts.getClassBaseTypeNode(enclosingClass)) { + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); + baseClass = classType.baseTypes.length && classType.baseTypes[0]; + } + if (!baseClass) { + error(node, ts.Diagnostics.super_can_only_be_referenced_in_a_derived_class); + return unknownType; + } + var container = ts.getSuperContainer(node, true); + if (container) { + var canUseSuperExpression = false; + if (isCallExpression) { + canUseSuperExpression = container.kind === 131; + } + else { + var needToCaptureLexicalThis = false; + while (container && container.kind === 159) { + container = ts.getSuperContainer(container, true); + needToCaptureLexicalThis = true; + } + if (container && container.parent && container.parent.kind === 194) { + if (container.flags & 128) { + canUseSuperExpression = + container.kind === 130 || + container.kind === 129 || + container.kind === 132 || + container.kind === 133; + } + else { + canUseSuperExpression = + container.kind === 130 || + container.kind === 129 || + container.kind === 132 || + container.kind === 133 || + container.kind === 128 || + container.kind === 127 || + container.kind === 131; + } + } + } + if (canUseSuperExpression) { + var returnType; + if ((container.flags & 128) || isCallExpression) { + getNodeLinks(node).flags |= 32; + returnType = getTypeOfSymbol(baseClass.symbol); + } + else { + getNodeLinks(node).flags |= 16; + returnType = baseClass; + } + if (container.kind === 131 && isInConstructorArgumentInitializer(node, container)) { + error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); + returnType = unknownType; + } + if (!isCallExpression && needToCaptureLexicalThis) { + captureLexicalThis(node.parent, container); + } + return returnType; + } + } + if (container.kind === 124) { + error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); + } + else if (isCallExpression) { + error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); + } + else { + error(node, ts.Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class); + } + return unknownType; + } + function getContextuallyTypedParameterType(parameter) { + if (isFunctionExpressionOrArrowFunction(parameter.parent)) { + var func = parameter.parent; + if (isContextSensitive(func)) { + var contextualSignature = getContextualSignature(func); + if (contextualSignature) { + var funcHasRestParameters = ts.hasRestParameters(func); + var len = func.parameters.length - (funcHasRestParameters ? 1 : 0); + var indexOfParameter = ts.indexOf(func.parameters, parameter); + if (indexOfParameter < len) { + return getTypeAtPosition(contextualSignature, indexOfParameter); + } + if (indexOfParameter === (func.parameters.length - 1) && + funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { + return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]); + } + } + } + } + return undefined; + } + function getContextualTypeForInitializerExpression(node) { + var declaration = node.parent; + if (node === declaration.initializer) { + if (declaration.type) { + return getTypeFromTypeNode(declaration.type); + } + if (declaration.kind === 126) { + var type = getContextuallyTypedParameterType(declaration); + if (type) { + return type; + } + } + if (ts.isBindingPattern(declaration.name)) { + return getTypeFromBindingPattern(declaration.name); + } + } + return undefined; + } + function getContextualTypeForReturnExpression(node) { + var func = ts.getContainingFunction(node); + if (func) { + if (func.type || func.kind === 131 || func.kind === 132 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(func.symbol, 133))) { + return getReturnTypeOfSignature(getSignatureFromDeclaration(func)); + } + var signature = getContextualSignatureForFunctionLikeDeclaration(func); + if (signature) { + return getReturnTypeOfSignature(signature); + } + } + return undefined; + } + function getContextualTypeForArgument(callTarget, arg) { + var args = getEffectiveCallArguments(callTarget); + var argIndex = ts.indexOf(args, arg); + if (argIndex >= 0) { + var signature = getResolvedSignature(callTarget); + return getTypeAtPosition(signature, argIndex); + } + return undefined; + } + function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { + if (template.parent.kind === 155) { + return getContextualTypeForArgument(template.parent, substitutionExpression); + } + return undefined; + } + function getContextualTypeForBinaryOperand(node) { + var binaryExpression = node.parent; + var operator = binaryExpression.operatorToken.kind; + if (operator >= 52 && operator <= 63) { + if (node === binaryExpression.right) { + return checkExpression(binaryExpression.left); + } + } + else if (operator === 49) { + var type = getContextualType(binaryExpression); + if (!type && node === binaryExpression.right) { + type = checkExpression(binaryExpression.left); + } + return type; + } + return undefined; + } + function applyToContextualType(type, mapper) { + if (!(type.flags & 16384)) { + return mapper(type); + } + var types = type.types; + var mappedType; + var mappedTypes; + for (var i = 0; i < types.length; i++) { + var t = mapper(types[i]); + if (t) { + if (!mappedType) { + mappedType = t; + } + else if (!mappedTypes) { + mappedTypes = [mappedType, t]; + } + else { + mappedTypes.push(t); + } + } + } + return mappedTypes ? getUnionType(mappedTypes) : mappedType; + } + function getTypeOfPropertyOfContextualType(type, name) { + return applyToContextualType(type, function (t) { + var prop = getPropertyOfObjectType(t, name); + return prop ? getTypeOfSymbol(prop) : undefined; + }); + } + function getIndexTypeOfContextualType(type, kind) { + return applyToContextualType(type, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }); + } + function contextualTypeIsTupleLikeType(type) { + return !!(type.flags & 16384 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); + } + function contextualTypeHasIndexSignature(type, kind) { + return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }) : getIndexTypeOfObjectOrUnionType(type, kind)); + } + function getContextualTypeForObjectLiteralMethod(node) { + ts.Debug.assert(ts.isObjectLiteralMethod(node)); + if (isInsideWithStatementBody(node)) { + return undefined; + } + return getContextualTypeForObjectLiteralElement(node); + } + function getContextualTypeForObjectLiteralElement(element) { + var objectLiteral = element.parent; + var type = getContextualType(objectLiteral); + if (type) { + if (!ts.hasDynamicName(element)) { + var symbolName = getSymbolOfNode(element).name; + var propertyType = getTypeOfPropertyOfContextualType(type, symbolName); + if (propertyType) { + return propertyType; + } + } + return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || + getIndexTypeOfContextualType(type, 0); + } + return undefined; + } + function getContextualTypeForElementExpression(node) { + var arrayLiteral = node.parent; + var type = getContextualType(arrayLiteral); + if (type) { + var index = ts.indexOf(arrayLiteral.elements, node); + return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1); + } + return undefined; + } + function getContextualTypeForConditionalOperand(node) { + var conditional = node.parent; + return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; + } + function getContextualType(node) { + if (isInsideWithStatementBody(node)) { + return undefined; + } + if (node.contextualType) { + return node.contextualType; + } + var parent = node.parent; + switch (parent.kind) { + case 191: + case 126: + case 128: + case 127: + case 148: + return getContextualTypeForInitializerExpression(node); + case 159: + case 184: + return getContextualTypeForReturnExpression(node); + case 153: + case 154: + return getContextualTypeForArgument(parent, node); + case 156: + return getTypeFromTypeNode(parent.type); + case 165: + return getContextualTypeForBinaryOperand(node); + case 207: + return getContextualTypeForObjectLiteralElement(parent); + case 149: + return getContextualTypeForElementExpression(node); + case 166: + return getContextualTypeForConditionalOperand(node); + case 171: + ts.Debug.assert(parent.parent.kind === 167); + return getContextualTypeForSubstitutionExpression(parent.parent, node); + case 157: + return getContextualType(parent); + } + return undefined; + } + function getNonGenericSignature(type) { + var signatures = getSignaturesOfObjectOrUnionType(type, 0); + if (signatures.length === 1) { + var signature = signatures[0]; + if (!signature.typeParameters) { + return signature; + } + } + } + function isFunctionExpressionOrArrowFunction(node) { + return node.kind === 158 || node.kind === 159; + } + function getContextualSignatureForFunctionLikeDeclaration(node) { + return isFunctionExpressionOrArrowFunction(node) ? getContextualSignature(node) : undefined; + } + function getContextualSignature(node) { + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); + var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); + if (!type) { + return undefined; + } + if (!(type.flags & 16384)) { + return getNonGenericSignature(type); + } + var signatureList; + var types = type.types; + for (var i = 0; i < types.length; i++) { + if (signatureList && + getSignaturesOfObjectOrUnionType(types[i], 0).length > 1) { + return undefined; + } + var signature = getNonGenericSignature(types[i]); + if (signature) { + if (!signatureList) { + signatureList = [signature]; + } + else if (!compareSignatures(signatureList[0], signature, false, compareTypes)) { + return undefined; + } + else { + signatureList.push(signature); + } + } + } + var result; + if (signatureList) { + result = cloneSignature(signatureList[0]); + result.resolvedReturnType = undefined; + result.unionSignatures = signatureList; + } + return result; + } + function isInferentialContext(mapper) { + return mapper && mapper !== identityMapper; + } + function isAssignmentTarget(node) { + var parent = node.parent; + if (parent.kind === 165 && parent.operatorToken.kind === 52 && parent.left === node) { + return true; + } + if (parent.kind === 207) { + return isAssignmentTarget(parent.parent); + } + if (parent.kind === 149) { + return isAssignmentTarget(parent); + } + return false; + } + function checkSpreadElementExpression(node, contextualMapper) { + var type = checkExpressionCached(node.expression, contextualMapper); + if (!isArrayLikeType(type)) { + error(node.expression, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(type)); + return unknownType; + } + return type; + } + function checkArrayLiteral(node, contextualMapper) { + var elements = node.elements; + if (!elements.length) { + return createArrayType(undefinedType); + } + var hasSpreadElement = false; + var elementTypes = []; + ts.forEach(elements, function (e) { + var type = checkExpression(e, contextualMapper); + if (e.kind === 169) { + elementTypes.push(getIndexTypeOfType(type, 1) || anyType); + hasSpreadElement = true; + } + else { + elementTypes.push(type); + } + }); + if (!hasSpreadElement) { + var contextualType = getContextualType(node); + if (contextualType && contextualTypeIsTupleLikeType(contextualType) || isAssignmentTarget(node)) { + return createTupleType(elementTypes); + } + } + return createArrayType(getUnionType(elementTypes)); + } + function isNumericName(name) { + return name.kind === 124 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + } + function isNumericComputedName(name) { + return allConstituentTypesHaveKind(checkComputedPropertyName(name), 1 | 132); + } + function isNumericLiteralName(name) { + return (+name).toString() === name; + } + function checkComputedPropertyName(node) { + var links = getNodeLinks(node.expression); + if (!links.resolvedType) { + links.resolvedType = checkExpression(node.expression); + if (!allConstituentTypesHaveKind(links.resolvedType, 1 | 132 | 258 | 1048576)) { + error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); + } + else { + checkThatExpressionIsProperSymbolReference(node.expression, links.resolvedType, true); + } + } + return links.resolvedType; + } + function checkObjectLiteral(node, contextualMapper) { + checkGrammarObjectLiteralExpression(node); + var propertiesTable = {}; + var propertiesArray = []; + var contextualType = getContextualType(node); + var typeFlags; + for (var i = 0; i < node.properties.length; i++) { + var memberDecl = node.properties[i]; + var member = memberDecl.symbol; + if (memberDecl.kind === 207 || + memberDecl.kind === 208 || + ts.isObjectLiteralMethod(memberDecl)) { + if (memberDecl.kind === 207) { + var type = checkPropertyAssignment(memberDecl, contextualMapper); + } + else if (memberDecl.kind === 130) { + var type = checkObjectLiteralMethod(memberDecl, contextualMapper); + } + else { + ts.Debug.assert(memberDecl.kind === 208); + var type = memberDecl.name.kind === 124 ? unknownType : checkExpression(memberDecl.name, contextualMapper); + } + typeFlags |= type.flags; + var prop = createSymbol(4 | 67108864 | member.flags, member.name); + prop.declarations = member.declarations; + prop.parent = member.parent; + if (member.valueDeclaration) { + prop.valueDeclaration = member.valueDeclaration; + } + prop.type = type; + prop.target = member; + member = prop; + } + else { + ts.Debug.assert(memberDecl.kind === 132 || memberDecl.kind === 133); + checkAccessorDeclaration(memberDecl); + } + if (!ts.hasDynamicName(memberDecl)) { + propertiesTable[member.name] = member; + } + propertiesArray.push(member); + } + var stringIndexType = getIndexType(0); + var numberIndexType = getIndexType(1); + var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); + result.flags |= 131072 | 524288 | (typeFlags & 262144); + return result; + function getIndexType(kind) { + if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { + var propTypes = []; + for (var i = 0; i < propertiesArray.length; i++) { + var propertyDecl = node.properties[i]; + if (kind === 0 || isNumericName(propertyDecl.name)) { + var type = getTypeOfSymbol(propertiesArray[i]); + if (!ts.contains(propTypes, type)) { + propTypes.push(type); + } + } + } + var result = propTypes.length ? getUnionType(propTypes) : undefinedType; + typeFlags |= result.flags; + return result; + } + return undefined; + } + } + function getDeclarationKindFromSymbol(s) { + return s.valueDeclaration ? s.valueDeclaration.kind : 128; + } + function getDeclarationFlagsFromSymbol(s) { + return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 16 | 128 : 0; + } + function checkClassPropertyAccess(node, left, type, prop) { + var flags = getDeclarationFlagsFromSymbol(prop); + if (!(flags & (32 | 64))) { + return; + } + var enclosingClassDeclaration = ts.getAncestor(node, 194); + var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; + var declaringClass = getDeclaredTypeOfSymbol(prop.parent); + if (flags & 32) { + if (declaringClass !== enclosingClass) { + error(node, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + } + return; + } + if (left.kind === 90) { + return; + } + if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { + error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + return; + } + if (flags & 128) { + return; + } + 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)); + } + } + function checkPropertyAccessExpression(node) { + return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name); + } + function checkQualifiedName(node) { + return checkPropertyAccessExpressionOrQualifiedName(node, node.left, node.right); + } + function checkPropertyAccessExpressionOrQualifiedName(node, left, right) { + var type = checkExpressionOrQualifiedName(left); + if (type === unknownType) + return type; + if (type !== anyType) { + var apparentType = getApparentType(getWidenedType(type)); + if (apparentType === unknownType) { + return unknownType; + } + 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)); + } + return unknownType; + } + getNodeLinks(node).resolvedSymbol = prop; + if (prop.parent && prop.parent.flags & 32) { + if (left.kind === 90 && getDeclarationKindFromSymbol(prop) !== 130) { + error(right, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); + } + else { + checkClassPropertyAccess(node, left, type, prop); + } + } + return getTypeOfSymbol(prop); + } + return anyType; + } + function isValidPropertyAccess(node, propertyName) { + var left = node.kind === 151 ? node.expression : node.left; + var type = checkExpressionOrQualifiedName(left); + if (type !== unknownType && type !== anyType) { + var prop = getPropertyOfType(getWidenedType(type), propertyName); + if (prop && prop.parent && prop.parent.flags & 32) { + if (left.kind === 90 && getDeclarationKindFromSymbol(prop) !== 130) { + return false; + } + else { + var modificationCount = diagnostics.getModificationCount(); + checkClassPropertyAccess(node, left, type, prop); + return diagnostics.getModificationCount() === modificationCount; + } + } + } + return true; + } + function checkIndexedAccess(node) { + if (!node.argumentExpression) { + var sourceFile = getSourceFile(node); + if (node.parent.kind === 154 && 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); + } + else { + var start = node.end - "]".length; + var end = node.end; + grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Expression_expected); + } + } + var objectType = getApparentType(checkExpression(node.expression)); + var indexType = node.argumentExpression ? checkExpression(node.argumentExpression) : unknownType; + if (objectType === unknownType) { + return unknownType; + } + var isConstEnum = isConstEnumObjectType(objectType); + if (isConstEnum && + (!node.argumentExpression || node.argumentExpression.kind !== 8)) { + error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); + return unknownType; + } + if (node.argumentExpression) { + var name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (name !== undefined) { + var prop = getPropertyOfType(objectType, name); + if (prop) { + getNodeLinks(node).resolvedSymbol = prop; + return getTypeOfSymbol(prop); + } + else if (isConstEnum) { + error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name, symbolToString(objectType.symbol)); + return unknownType; + } + } + } + if (allConstituentTypesHaveKind(indexType, 1 | 258 | 132 | 1048576)) { + if (allConstituentTypesHaveKind(indexType, 1 | 132)) { + var numberIndexType = getIndexTypeOfType(objectType, 1); + if (numberIndexType) { + return numberIndexType; + } + } + var stringIndexType = getIndexTypeOfType(objectType, 0); + if (stringIndexType) { + return stringIndexType; + } + if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && objectType !== anyType) { + error(node, ts.Diagnostics.Index_signature_of_object_type_implicitly_has_an_any_type); + } + return anyType; + } + error(node, ts.Diagnostics.An_index_expression_argument_must_be_of_type_string_number_symbol_or_any); + return unknownType; + } + function getPropertyNameForIndexedAccess(indexArgumentExpression, indexArgumentType) { + if (indexArgumentExpression.kind === 8 || indexArgumentExpression.kind === 7) { + return indexArgumentExpression.text; + } + if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, false)) { + var rightHandSideName = indexArgumentExpression.name.text; + return ts.getPropertyNameForKnownSymbolName(rightHandSideName); + } + return undefined; + } + function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) { + if (expressionType === unknownType) { + return false; + } + if (!ts.isWellKnownSymbolSyntactically(expression)) { + return false; + } + if ((expressionType.flags & 1048576) === 0) { + if (reportError) { + error(expression, ts.Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, ts.getTextOfNode(expression)); + } + return false; + } + var leftHandSide = expression.expression; + var leftHandSideSymbol = getResolvedSymbol(leftHandSide); + if (!leftHandSideSymbol) { + return false; + } + var globalESSymbol = getGlobalESSymbolConstructorSymbol(); + if (!globalESSymbol) { + return false; + } + if (leftHandSideSymbol !== globalESSymbol) { + if (reportError) { + error(leftHandSide, ts.Diagnostics.Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object); + } + return false; + } + return true; + } + function resolveUntypedCall(node) { + if (node.kind === 155) { + checkExpression(node.template); + } + else { + ts.forEach(node.arguments, function (argument) { + checkExpression(argument); + }); + } + return anySignature; + } + function resolveErrorCall(node) { + resolveUntypedCall(node); + return unknownSignature; + } + function reorderCandidates(signatures, result) { + var lastParent; + var lastSymbol; + var cutoffIndex = 0; + var index; + var specializedIndex = -1; + var spliceIndex; + ts.Debug.assert(!result.length); + for (var i = 0; i < signatures.length; i++) { + var signature = signatures[i]; + var symbol = signature.declaration && getSymbolOfNode(signature.declaration); + var parent = signature.declaration && signature.declaration.parent; + if (!lastSymbol || symbol === lastSymbol) { + if (lastParent && parent === lastParent) { + index++; + } + else { + lastParent = parent; + index = cutoffIndex; + } + } + else { + index = cutoffIndex = result.length; + lastParent = parent; + } + lastSymbol = symbol; + if (signature.hasStringLiterals) { + specializedIndex++; + spliceIndex = specializedIndex; + cutoffIndex++; + } + else { + spliceIndex = index; + } + result.splice(spliceIndex, 0, signature); + } + } + function getSpreadArgumentIndex(args) { + for (var i = 0; i < args.length; i++) { + if (args[i].kind === 169) { + return i; + } + } + return -1; + } + function hasCorrectArity(node, args, signature) { + var adjustedArgCount; + var typeArguments; + var callIsIncomplete; + if (node.kind === 155) { + var tagExpression = node; + adjustedArgCount = args.length; + typeArguments = undefined; + if (tagExpression.template.kind === 167) { + var templateExpression = tagExpression.template; + var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); + ts.Debug.assert(lastSpan !== undefined); + callIsIncomplete = ts.getFullWidth(lastSpan.literal) === 0 || !!lastSpan.literal.isUnterminated; + } + else { + var templateLiteral = tagExpression.template; + ts.Debug.assert(templateLiteral.kind === 10); + callIsIncomplete = !!templateLiteral.isUnterminated; + } + } + else { + var callExpression = node; + if (!callExpression.arguments) { + ts.Debug.assert(callExpression.kind === 154); + return signature.minArgumentCount === 0; + } + adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; + callIsIncomplete = callExpression.arguments.end === callExpression.end; + typeArguments = callExpression.typeArguments; + } + var hasRightNumberOfTypeArgs = !typeArguments || + (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + if (!hasRightNumberOfTypeArgs) { + return false; + } + var spreadArgIndex = getSpreadArgumentIndex(args); + if (spreadArgIndex >= 0) { + return signature.hasRestParameter && spreadArgIndex >= signature.parameters.length - 1; + } + if (!signature.hasRestParameter && adjustedArgCount > signature.parameters.length) { + return false; + } + var hasEnoughArguments = adjustedArgCount >= signature.minArgumentCount; + return callIsIncomplete || hasEnoughArguments; + } + function getSingleCallSignature(type) { + if (type.flags & 48128) { + var resolved = resolveObjectOrUnionTypeMembers(type); + if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && + resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + return resolved.callSignatures[0]; + } + } + return undefined; + } + function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper) { + var context = createInferenceContext(signature.typeParameters, true); + forEachMatchingParameterType(contextualSignature, signature, function (source, target) { + inferTypes(context, instantiateType(source, contextualMapper), target); + }); + return getSignatureInstantiation(signature, getInferredTypes(context)); + } + function inferTypeArguments(signature, args, excludeArgument) { + var typeParameters = signature.typeParameters; + var context = createInferenceContext(typeParameters, false); + var inferenceMapper = createInferenceMapper(context); + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + if (arg.kind !== 170) { + var paramType = getTypeAtPosition(signature, arg.kind === 169 ? -1 : i); + if (i === 0 && args[i].parent.kind === 155) { + var argType = globalTemplateStringsArrayType; + } + else { + var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; + var argType = checkExpressionWithContextualType(arg, paramType, mapper); + } + inferTypes(context, argType, paramType); + } + } + if (excludeArgument) { + for (var i = 0; i < args.length; i++) { + if (excludeArgument[i] === false) { + var arg = args[i]; + var paramType = getTypeAtPosition(signature, arg.kind === 169 ? -1 : i); + inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); + } + } + } + var inferredTypes = getInferredTypes(context); + context.failedTypeParameterIndex = ts.indexOf(inferredTypes, inferenceFailureType); + for (var i = 0; i < inferredTypes.length; i++) { + if (inferredTypes[i] === inferenceFailureType) { + inferredTypes[i] = unknownType; + } + } + return context; + } + function checkTypeArguments(signature, typeArguments, typeArgumentResultTypes, reportErrors) { + var typeParameters = signature.typeParameters; + var typeArgumentsAreAssignable = true; + for (var i = 0; i < typeParameters.length; i++) { + var typeArgNode = typeArguments[i]; + var typeArgument = getTypeFromTypeNode(typeArgNode); + typeArgumentResultTypes[i] = typeArgument; + if (typeArgumentsAreAssignable) { + var constraint = getConstraintOfTypeParameter(typeParameters[i]); + if (constraint) { + typeArgumentsAreAssignable = checkTypeAssignableTo(typeArgument, constraint, reportErrors ? typeArgNode : undefined, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + } + } + } + return typeArgumentsAreAssignable; + } + function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + if (arg.kind !== 170) { + var paramType = getTypeAtPosition(signature, arg.kind === 169 ? -1 : i); + var argType = i === 0 && node.kind === 155 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + if (!checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1)) { + return false; + } + } + } + return true; + } + function getEffectiveCallArguments(node) { + var args; + if (node.kind === 155) { + var template = node.template; + args = [template]; + if (template.kind === 167) { + ts.forEach(template.templateSpans, function (span) { + args.push(span.expression); + }); + } + } + else { + args = node.arguments || emptyArray; + } + return args; + } + function getEffectiveTypeArguments(callExpression) { + if (callExpression.expression.kind === 90) { + var containingClass = ts.getAncestor(callExpression, 194); + var baseClassTypeNode = containingClass && ts.getClassBaseTypeNode(containingClass); + return baseClassTypeNode && baseClassTypeNode.typeArguments; + } + else { + return callExpression.typeArguments; + } + } + function resolveCall(node, signatures, candidatesOutArray) { + var isTaggedTemplate = node.kind === 155; + var typeArguments; + if (!isTaggedTemplate) { + typeArguments = getEffectiveTypeArguments(node); + if (node.expression.kind !== 90) { + ts.forEach(typeArguments, checkSourceElement); + } + } + var candidates = candidatesOutArray || []; + reorderCandidates(signatures, candidates); + if (!candidates.length) { + error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); + return resolveErrorCall(node); + } + var args = getEffectiveCallArguments(node); + var excludeArgument; + for (var i = isTaggedTemplate ? 1 : 0; i < args.length; i++) { + if (isContextSensitive(args[i])) { + if (!excludeArgument) { + excludeArgument = new Array(args.length); + } + excludeArgument[i] = true; + } + } + var candidateForArgumentError; + var candidateForTypeArgumentError; + var resultOfFailedInference; + var result; + if (candidates.length > 1) { + result = chooseOverload(candidates, subtypeRelation); + } + if (!result) { + candidateForArgumentError = undefined; + candidateForTypeArgumentError = undefined; + resultOfFailedInference = undefined; + result = chooseOverload(candidates, assignableRelation); + } + if (result) { + return result; + } + if (candidateForArgumentError) { + checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, undefined, true); + } + else if (candidateForTypeArgumentError) { + if (!isTaggedTemplate && node.typeArguments) { + checkTypeArguments(candidateForTypeArgumentError, node.typeArguments, [], true); + } + else { + ts.Debug.assert(resultOfFailedInference.failedTypeParameterIndex >= 0); + var failedTypeParameter = candidateForTypeArgumentError.typeParameters[resultOfFailedInference.failedTypeParameterIndex]; + var inferenceCandidates = getInferenceCandidates(resultOfFailedInference, resultOfFailedInference.failedTypeParameterIndex); + var diagnosticChainHead = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly, typeToString(failedTypeParameter)); + reportNoCommonSupertypeError(inferenceCandidates, node.expression || node.tag, diagnosticChainHead); + } + } + else { + error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); + } + if (!produceDiagnostics) { + for (var i = 0, n = candidates.length; i < n; i++) { + if (hasCorrectArity(node, args, candidates[i])) { + return candidates[i]; + } + } + } + return resolveErrorCall(node); + function chooseOverload(candidates, relation) { + for (var i = 0; i < candidates.length; i++) { + if (!hasCorrectArity(node, args, candidates[i])) { + continue; + } + var originalCandidate = candidates[i]; + var inferenceResult; + while (true) { + var candidate = originalCandidate; + if (candidate.typeParameters) { + var typeArgumentTypes; + var typeArgumentsAreValid; + if (typeArguments) { + typeArgumentTypes = new Array(candidate.typeParameters.length); + typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, false); + } + else { + inferenceResult = inferTypeArguments(candidate, args, excludeArgument); + typeArgumentsAreValid = inferenceResult.failedTypeParameterIndex < 0; + typeArgumentTypes = inferenceResult.inferredTypes; + } + if (!typeArgumentsAreValid) { + break; + } + candidate = getSignatureInstantiation(candidate, typeArgumentTypes); + } + if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, false)) { + break; + } + var index = excludeArgument ? ts.indexOf(excludeArgument, true) : -1; + if (index < 0) { + return candidate; + } + excludeArgument[index] = false; + } + if (originalCandidate.typeParameters) { + var instantiatedCandidate = candidate; + if (typeArgumentsAreValid) { + candidateForArgumentError = instantiatedCandidate; + } + else { + candidateForTypeArgumentError = originalCandidate; + if (!typeArguments) { + resultOfFailedInference = inferenceResult; + } + } + } + else { + ts.Debug.assert(originalCandidate === candidate); + candidateForArgumentError = originalCandidate; + } + } + return undefined; + } + } + function resolveCallExpression(node, candidatesOutArray) { + if (node.expression.kind === 90) { + var superType = checkSuperExpression(node.expression); + if (superType !== unknownType) { + return resolveCall(node, getSignaturesOfType(superType, 1), candidatesOutArray); + } + return resolveUntypedCall(node); + } + var funcType = checkExpression(node.expression); + var apparentType = getApparentType(funcType); + if (apparentType === unknownType) { + return resolveErrorCall(node); + } + var callSignatures = getSignaturesOfType(apparentType, 0); + var constructSignatures = getSignaturesOfType(apparentType, 1); + if (funcType === anyType || (!callSignatures.length && !constructSignatures.length && !(funcType.flags & 16384) && isTypeAssignableTo(funcType, globalFunctionType))) { + if (node.typeArguments) { + error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); + } + return resolveUntypedCall(node); + } + if (!callSignatures.length) { + if (constructSignatures.length) { + error(node, ts.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType)); + } + else { + error(node, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); + } + return resolveErrorCall(node); + } + return resolveCall(node, callSignatures, candidatesOutArray); + } + function resolveNewExpression(node, candidatesOutArray) { + if (node.arguments && languageVersion < 2) { + var spreadIndex = getSpreadArgumentIndex(node.arguments); + if (spreadIndex >= 0) { + error(node.arguments[spreadIndex], ts.Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher); + } + } + var expressionType = checkExpression(node.expression); + if (expressionType === anyType) { + if (node.typeArguments) { + error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); + } + return resolveUntypedCall(node); + } + expressionType = getApparentType(expressionType); + if (expressionType === unknownType) { + return resolveErrorCall(node); + } + var constructSignatures = getSignaturesOfType(expressionType, 1); + if (constructSignatures.length) { + return resolveCall(node, constructSignatures, candidatesOutArray); + } + var callSignatures = getSignaturesOfType(expressionType, 0); + if (callSignatures.length) { + var signature = resolveCall(node, callSignatures, candidatesOutArray); + if (getReturnTypeOfSignature(signature) !== voidType) { + error(node, ts.Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword); + } + return signature; + } + error(node, ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature); + return resolveErrorCall(node); + } + function resolveTaggedTemplateExpression(node, candidatesOutArray) { + var tagType = checkExpression(node.tag); + var apparentType = getApparentType(tagType); + if (apparentType === unknownType) { + return resolveErrorCall(node); + } + var callSignatures = getSignaturesOfType(apparentType, 0); + if (tagType === anyType || (!callSignatures.length && !(tagType.flags & 16384) && isTypeAssignableTo(tagType, globalFunctionType))) { + return resolveUntypedCall(node); + } + if (!callSignatures.length) { + error(node, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); + return resolveErrorCall(node); + } + return resolveCall(node, callSignatures, candidatesOutArray); + } + function getResolvedSignature(node, candidatesOutArray) { + var links = getNodeLinks(node); + if (!links.resolvedSignature || candidatesOutArray) { + links.resolvedSignature = anySignature; + if (node.kind === 153) { + links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); + } + else if (node.kind === 154) { + links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); + } + else if (node.kind === 155) { + links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); + } + else { + ts.Debug.fail("Branch in 'getResolvedSignature' should be unreachable."); + } + } + return links.resolvedSignature; + } + function checkCallExpression(node) { + checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments); + var signature = getResolvedSignature(node); + if (node.expression.kind === 90) { + return voidType; + } + if (node.kind === 154) { + var declaration = signature.declaration; + if (declaration && + declaration.kind !== 131 && + declaration.kind !== 135 && + declaration.kind !== 139) { + if (compilerOptions.noImplicitAny) { + error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); + } + return anyType; + } + } + return getReturnTypeOfSignature(signature); + } + function checkTaggedTemplateExpression(node) { + if (languageVersion < 2) { + grammarErrorOnFirstToken(node.template, ts.Diagnostics.Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher); + } + return getReturnTypeOfSignature(getResolvedSignature(node)); + } + function checkTypeAssertion(node) { + var exprType = checkExpression(node.expression); + var targetType = getTypeFromTypeNode(node.type); + if (produceDiagnostics && targetType !== unknownType) { + var widenedType = getWidenedType(exprType); + if (!(isTypeAssignableTo(targetType, widenedType))) { + checkTypeAssignableTo(exprType, targetType, node, ts.Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other); + } + } + return targetType; + } + function getTypeAtPosition(signature, pos) { + if (pos >= 0) { + return signature.hasRestParameter ? pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + } + return signature.hasRestParameter ? getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : anyArrayType; + } + function assignContextualParameterTypes(signature, context, mapper) { + var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); + for (var i = 0; i < len; i++) { + var parameter = signature.parameters[i]; + var links = getSymbolLinks(parameter); + links.type = instantiateType(getTypeAtPosition(context, i), mapper); + } + if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) { + var parameter = signature.parameters[signature.parameters.length - 1]; + var links = getSymbolLinks(parameter); + links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper); + } + } + function getReturnTypeFromBody(func, contextualMapper) { + var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func); + if (!func.body) { + return unknownType; + } + if (func.body.kind !== 172) { + var type = checkExpressionCached(func.body, contextualMapper); + } + else { + var types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper); + if (types.length === 0) { + return voidType; + } + var type = contextualSignature ? getUnionType(types) : getCommonSupertype(types); + if (!type) { + error(func, ts.Diagnostics.No_best_common_type_exists_among_return_expressions); + return unknownType; + } + } + if (!contextualSignature) { + reportErrorsFromWidening(func, type); + } + return getWidenedType(type); + } + function checkAndAggregateReturnExpressionTypes(body, contextualMapper) { + var aggregatedTypes = []; + ts.forEachReturnStatement(body, function (returnStatement) { + var expr = returnStatement.expression; + if (expr) { + var type = checkExpressionCached(expr, contextualMapper); + if (!ts.contains(aggregatedTypes, type)) { + aggregatedTypes.push(type); + } + } + }); + return aggregatedTypes; + } + function bodyContainsAReturnStatement(funcBody) { + return ts.forEachReturnStatement(funcBody, function (returnStatement) { + return true; + }); + } + function bodyContainsSingleThrowStatement(body) { + return (body.statements.length === 1) && (body.statements[0].kind === 188); + } + function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { + if (!produceDiagnostics) { + return; + } + if (returnType === voidType || returnType === anyType) { + return; + } + if (ts.nodeIsMissing(func.body) || func.body.kind !== 172) { + return; + } + var bodyBlock = func.body; + if (bodyContainsAReturnStatement(bodyBlock)) { + return; + } + if (bodyContainsSingleThrowStatement(bodyBlock)) { + return; + } + 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 !== 130 || ts.isObjectLiteralMethod(node)); + var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); + if (!hasGrammarError && node.kind === 158) { + checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); + } + if (contextualMapper === identityMapper && isContextSensitive(node)) { + return anyFunctionType; + } + var links = getNodeLinks(node); + var type = getTypeOfSymbol(node.symbol); + if (!(links.flags & 64)) { + var contextualSignature = getContextualSignature(node); + if (!(links.flags & 64)) { + links.flags |= 64; + if (contextualSignature) { + var signature = getSignaturesOfType(type, 0)[0]; + if (isContextSensitive(node)) { + assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); + } + if (!node.type) { + signature.resolvedReturnType = resolvingType; + var returnType = getReturnTypeFromBody(node, contextualMapper); + if (signature.resolvedReturnType === resolvingType) { + signature.resolvedReturnType = returnType; + } + } + } + checkSignatureDeclaration(node); + } + } + if (produceDiagnostics && node.kind !== 130 && node.kind !== 129) { + checkCollisionWithCapturedSuperVariable(node, node.name); + checkCollisionWithCapturedThisVariable(node, node.name); + } + return type; + } + function checkFunctionExpressionOrObjectLiteralMethodBody(node) { + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); + if (node.type) { + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + } + if (node.body) { + if (node.body.kind === 172) { + checkSourceElement(node.body); + } + else { + var exprType = checkExpression(node.body); + if (node.type) { + checkTypeAssignableTo(exprType, getTypeFromTypeNode(node.type), node.body, undefined); + } + checkFunctionExpressionBodies(node.body); + } + } + } + function checkArithmeticOperandType(operand, type, diagnostic) { + if (!allConstituentTypesHaveKind(type, 1 | 132)) { + error(operand, diagnostic); + return false; + } + return true; + } + function checkReferenceExpression(n, invalidReferenceMessage, constantVarianleMessage) { + function findSymbol(n) { + var symbol = getNodeLinks(n).resolvedSymbol; + return symbol && getExportSymbolOfValueSymbolIfExported(symbol); + } + function isReferenceOrErrorExpression(n) { + switch (n.kind) { + case 64: + var symbol = findSymbol(n); + return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; + case 151: + var symbol = findSymbol(n); + return !symbol || symbol === unknownSymbol || (symbol.flags & ~8) !== 0; + case 152: + return true; + case 157: + return isReferenceOrErrorExpression(n.expression); + default: + return false; + } + } + function isConstVariableReference(n) { + switch (n.kind) { + case 64: + case 151: + var symbol = findSymbol(n); + return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 4096) !== 0; + case 152: + var index = n.argumentExpression; + var symbol = findSymbol(n.expression); + if (symbol && index && index.kind === 8) { + var name = index.text; + var prop = getPropertyOfType(getTypeOfSymbol(symbol), name); + return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 4096) !== 0; + } + return false; + case 157: + return isConstVariableReference(n.expression); + default: + return false; + } + } + if (!isReferenceOrErrorExpression(n)) { + error(n, invalidReferenceMessage); + return false; + } + if (isConstVariableReference(n)) { + error(n, constantVarianleMessage); + return false; + } + return true; + } + function checkDeleteExpression(node) { + if (node.parserContextFlags & 1 && node.expression.kind === 64) { + grammarErrorOnNode(node.expression, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode); + } + var operandType = checkExpression(node.expression); + return booleanType; + } + function checkTypeOfExpression(node) { + var operandType = checkExpression(node.expression); + return stringType; + } + function checkVoidExpression(node) { + var operandType = checkExpression(node.expression); + return undefinedType; + } + function checkPrefixUnaryExpression(node) { + if ((node.operator === 38 || node.operator === 39)) { + checkGrammarEvalOrArgumentsInStrictMode(node, node.operand); + } + var operandType = checkExpression(node.operand); + switch (node.operator) { + case 33: + case 34: + case 47: + if (someConstituentTypeHasKind(operandType, 1048576)) { + error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); + } + return numberType; + case 46: + return booleanType; + case 38: + case 39: + 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); + } + return numberType; + } + return unknownType; + } + function checkPostfixUnaryExpression(node) { + checkGrammarEvalOrArgumentsInStrictMode(node, node.operand); + var operandType = checkExpression(node.operand); + 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); + } + return numberType; + } + function someConstituentTypeHasKind(type, kind) { + if (type.flags & kind) { + return true; + } + if (type.flags & 16384) { + var types = type.types; + for (var i = 0; i < types.length; i++) { + if (types[i].flags & kind) { + return true; + } + } + return false; + } + return false; + } + function allConstituentTypesHaveKind(type, kind) { + if (type.flags & kind) { + return true; + } + if (type.flags & 16384) { + var types = type.types; + for (var i = 0; i < types.length; i++) { + if (!(types[i].flags & kind)) { + return false; + } + } + return true; + } + return false; + } + function isConstEnumObjectType(type) { + return type.flags & (48128 | 32768) && type.symbol && isConstEnumSymbol(type.symbol); + } + function isConstEnumSymbol(symbol) { + return (symbol.flags & 128) !== 0; + } + function checkInstanceOfExpression(node, leftType, rightType) { + if (allConstituentTypesHaveKind(leftType, 1049086)) { + 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); + } + if (!(rightType.flags & 1 || 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); + } + return booleanType; + } + function checkInExpression(node, leftType, rightType) { + if (!allConstituentTypesHaveKind(leftType, 1 | 258 | 132 | 1048576)) { + error(node.left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); + } + if (!allConstituentTypesHaveKind(rightType, 1 | 48128 | 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); + } + return booleanType; + } + function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { + var properties = node.properties; + for (var i = 0; i < properties.length; i++) { + var p = properties[i]; + if (p.kind === 207 || p.kind === 208) { + var name = p.name; + var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || + isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, 1) || + getIndexTypeOfType(sourceType, 0); + if (type) { + checkDestructuringAssignment(p.initializer || name, type); + } + else { + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name)); + } + } + else { + error(p, ts.Diagnostics.Property_assignment_expected); + } + } + return sourceType; + } + function checkArrayLiteralAssignment(node, sourceType, contextualMapper) { + if (!isArrayLikeType(sourceType)) { + error(node, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(sourceType)); + return sourceType; + } + var elements = node.elements; + for (var i = 0; i < elements.length; i++) { + var e = elements[i]; + if (e.kind !== 170) { + if (e.kind !== 169) { + var propName = "" + i; + var type = sourceType.flags & 1 ? sourceType : isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : getIndexTypeOfType(sourceType, 1); + if (type) { + checkDestructuringAssignment(e, type, contextualMapper); + } + else { + error(e, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); + } + } + else { + if (i === elements.length - 1) { + checkReferenceAssignment(e.expression, sourceType, contextualMapper); + } + else { + error(e, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); + } + } + } + } + return sourceType; + } + function checkDestructuringAssignment(target, sourceType, contextualMapper) { + if (target.kind === 165 && target.operatorToken.kind === 52) { + checkBinaryExpression(target, contextualMapper); + target = target.left; + } + if (target.kind === 150) { + return checkObjectLiteralAssignment(target, sourceType, contextualMapper); + } + if (target.kind === 149) { + return checkArrayLiteralAssignment(target, sourceType, contextualMapper); + } + return checkReferenceAssignment(target, sourceType, contextualMapper); + } + function checkReferenceAssignment(target, sourceType, contextualMapper) { + var targetType = checkExpression(target, contextualMapper); + if (checkReferenceExpression(target, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant)) { + checkTypeAssignableTo(sourceType, targetType, target, undefined); + } + return sourceType; + } + function checkBinaryExpression(node, contextualMapper) { + if (ts.isLeftHandSideExpression(node.left) && ts.isAssignmentOperator(node.operatorToken.kind)) { + checkGrammarEvalOrArgumentsInStrictMode(node, node.left); + } + var operator = node.operatorToken.kind; + if (operator === 52 && (node.left.kind === 150 || node.left.kind === 149)) { + return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); + } + var leftType = checkExpression(node.left, contextualMapper); + var rightType = checkExpression(node.right, contextualMapper); + switch (operator) { + case 35: + case 55: + case 36: + case 56: + case 37: + case 57: + case 34: + case 54: + case 40: + case 58: + case 41: + case 59: + case 42: + case 60: + case 44: + case 62: + case 45: + case 63: + case 43: + case 61: + if (leftType.flags & (32 | 64)) + leftType = rightType; + if (rightType.flags & (32 | 64)) + rightType = leftType; + 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)); + } + 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); + if (leftOk && rightOk) { + checkAssignmentOperator(numberType); + } + } + return numberType; + case 33: + case 53: + if (leftType.flags & (32 | 64)) + leftType = rightType; + if (rightType.flags & (32 | 64)) + rightType = leftType; + var resultType; + if (allConstituentTypesHaveKind(leftType, 132) && allConstituentTypesHaveKind(rightType, 132)) { + resultType = numberType; + } + else { + if (allConstituentTypesHaveKind(leftType, 258) || allConstituentTypesHaveKind(rightType, 258)) { + resultType = stringType; + } + else if (leftType.flags & 1 || rightType.flags & 1) { + resultType = anyType; + } + if (resultType && !checkForDisallowedESSymbolOperand(operator)) { + return resultType; + } + } + if (!resultType) { + reportOperatorError(); + return anyType; + } + if (operator === 53) { + checkAssignmentOperator(resultType); + } + return resultType; + case 24: + case 25: + case 26: + case 27: + if (!checkForDisallowedESSymbolOperand(operator)) { + return booleanType; + } + case 28: + case 29: + case 30: + case 31: + if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { + reportOperatorError(); + } + return booleanType; + case 86: + return checkInstanceOfExpression(node, leftType, rightType); + case 85: + return checkInExpression(node, leftType, rightType); + case 48: + return rightType; + case 49: + return getUnionType([leftType, rightType]); + case 52: + checkAssignmentOperator(rightType); + return rightType; + case 23: + return rightType; + } + function checkForDisallowedESSymbolOperand(operator) { + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : someConstituentTypeHasKind(rightType, 1048576) ? node.right : undefined; + if (offendingSymbolOperand) { + error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); + return false; + } + return true; + } + function getSuggestedBooleanOperator(operator) { + switch (operator) { + case 44: + case 62: + return 49; + case 45: + case 63: + return 31; + case 43: + case 61: + return 48; + default: + return undefined; + } + } + function checkAssignmentOperator(valueType) { + if (produceDiagnostics && operator >= 52 && operator <= 63) { + 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 (ok) { + checkTypeAssignableTo(valueType, leftType, node.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)); + } + } + function checkYieldExpression(node) { + if (!(node.parserContextFlags & 4)) { + grammarErrorOnFirstToken(node, ts.Diagnostics.yield_expression_must_be_contained_within_a_generator_declaration); + } + else { + grammarErrorOnFirstToken(node, ts.Diagnostics.yield_expressions_are_not_currently_supported); + } + } + function checkConditionalExpression(node, contextualMapper) { + checkExpression(node.condition); + var type1 = checkExpression(node.whenTrue, contextualMapper); + var type2 = checkExpression(node.whenFalse, contextualMapper); + return getUnionType([type1, type2]); + } + function checkTemplateExpression(node) { + ts.forEach(node.templateSpans, function (templateSpan) { + checkExpression(templateSpan.expression); + }); + return stringType; + } + function checkExpressionWithContextualType(node, contextualType, contextualMapper) { + var saveContextualType = node.contextualType; + node.contextualType = contextualType; + var result = checkExpression(node, contextualMapper); + node.contextualType = saveContextualType; + return result; + } + function checkExpressionCached(node, contextualMapper) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = checkExpression(node, contextualMapper); + } + return links.resolvedType; + } + function checkPropertyAssignment(node, contextualMapper) { + if (node.name.kind === 124) { + checkComputedPropertyName(node.name); + } + return checkExpression(node.initializer, contextualMapper); + } + function checkObjectLiteralMethod(node, contextualMapper) { + checkGrammarMethod(node); + if (node.name.kind === 124) { + checkComputedPropertyName(node.name); + } + var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); + return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); + } + function instantiateTypeWithSingleGenericCallSignature(node, type, contextualMapper) { + if (contextualMapper && contextualMapper !== identityMapper) { + var signature = getSingleCallSignature(type); + if (signature && signature.typeParameters) { + var contextualType = getContextualType(node); + if (contextualType) { + var contextualSignature = getSingleCallSignature(contextualType); + if (contextualSignature && !contextualSignature.typeParameters) { + return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper)); + } + } + } + } + return type; + } + function checkExpression(node, contextualMapper) { + return checkExpressionOrQualifiedName(node, contextualMapper); + } + function checkExpressionOrQualifiedName(node, contextualMapper) { + var type; + if (node.kind == 123) { + type = checkQualifiedName(node); + } + else { + var uninstantiatedType = checkExpressionWorker(node, contextualMapper); + type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); + } + if (isConstEnumObjectType(type)) { + var ok = (node.parent.kind === 151 && node.parent.expression === node) || + (node.parent.kind === 152 && node.parent.expression === node) || + ((node.kind === 64 || node.kind === 123) && 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); + } + } + return type; + } + function checkNumericLiteral(node) { + checkGrammarNumbericLiteral(node); + return numberType; + } + function checkExpressionWorker(node, contextualMapper) { + switch (node.kind) { + case 64: + return checkIdentifier(node); + case 92: + return checkThisExpression(node); + case 90: + return checkSuperExpression(node); + case 88: + return nullType; + case 94: + case 79: + return booleanType; + case 7: + return checkNumericLiteral(node); + case 167: + return checkTemplateExpression(node); + case 8: + case 10: + return stringType; + case 9: + return globalRegExpType; + case 149: + return checkArrayLiteral(node, contextualMapper); + case 150: + return checkObjectLiteral(node, contextualMapper); + case 151: + return checkPropertyAccessExpression(node); + case 152: + return checkIndexedAccess(node); + case 153: + case 154: + return checkCallExpression(node); + case 155: + return checkTaggedTemplateExpression(node); + case 156: + return checkTypeAssertion(node); + case 157: + return checkExpression(node.expression, contextualMapper); + case 158: + case 159: + return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); + case 161: + return checkTypeOfExpression(node); + case 160: + return checkDeleteExpression(node); + case 162: + return checkVoidExpression(node); + case 163: + return checkPrefixUnaryExpression(node); + case 164: + return checkPostfixUnaryExpression(node); + case 165: + return checkBinaryExpression(node, contextualMapper); + case 166: + return checkConditionalExpression(node, contextualMapper); + case 169: + return checkSpreadElementExpression(node, contextualMapper); + case 170: + return undefinedType; + case 168: + checkYieldExpression(node); + return unknownType; + } + return unknownType; + } + function checkTypeParameter(node) { + if (node.expression) { + grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected); + } + checkSourceElement(node.constraint); + if (produceDiagnostics) { + checkTypeParameterHasIllegalReferencesInConstraint(node); + checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); + } + } + function checkParameter(node) { + checkGrammarModifiers(node) || checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + checkVariableLikeDeclaration(node); + var func = ts.getContainingFunction(node); + if (node.flags & 112) { + func = ts.getContainingFunction(node); + if (!(func.kind === 131 && ts.nodeIsPresent(func.body))) { + error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); + } + } + if (node.questionToken && ts.isBindingPattern(node.name) && func.body) { + error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature); + } + if (node.dotDotDotToken) { + if (!isArrayType(getTypeOfSymbol(node.symbol))) { + error(node, ts.Diagnostics.A_rest_parameter_must_be_of_an_array_type); + } + } + } + function checkSignatureDeclaration(node) { + if (node.kind === 136) { + checkGrammarIndexSignature(node); + } + else if (node.kind === 138 || node.kind === 193 || node.kind === 139 || + node.kind === 134 || node.kind === 131 || + node.kind === 135) { + checkGrammarFunctionLikeDeclaration(node); + } + checkTypeParameters(node.typeParameters); + ts.forEach(node.parameters, checkParameter); + if (node.type) { + checkSourceElement(node.type); + } + if (produceDiagnostics) { + checkCollisionWithArgumentsInGeneratedCode(node); + if (compilerOptions.noImplicitAny && !node.type) { + switch (node.kind) { + case 135: + error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); + break; + case 134: + error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); + break; + } + } + } + checkSpecializedSignatureDeclaration(node); + } + function checkTypeForDuplicateIndexSignatures(node) { + if (node.kind === 195) { + var nodeSymbol = getSymbolOfNode(node); + if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { + return; + } + } + var indexSymbol = getIndexSymbol(getSymbolOfNode(node)); + if (indexSymbol) { + var seenNumericIndexer = false; + var seenStringIndexer = false; + for (var i = 0, len = indexSymbol.declarations.length; i < len; ++i) { + var declaration = indexSymbol.declarations[i]; + if (declaration.parameters.length === 1 && declaration.parameters[0].type) { + switch (declaration.parameters[0].type.kind) { + case 119: + if (!seenStringIndexer) { + seenStringIndexer = true; + } + else { + error(declaration, ts.Diagnostics.Duplicate_string_index_signature); + } + break; + case 117: + if (!seenNumericIndexer) { + seenNumericIndexer = true; + } + else { + error(declaration, ts.Diagnostics.Duplicate_number_index_signature); + } + break; + } + } + } + } + } + function checkPropertyDeclaration(node) { + checkGrammarModifiers(node) || checkGrammarProperty(node) || checkGrammarComputedPropertyName(node.name); + checkVariableLikeDeclaration(node); + } + function checkMethodDeclaration(node) { + checkGrammarMethod(node) || checkGrammarComputedPropertyName(node.name); + checkFunctionLikeDeclaration(node); + } + function checkConstructorDeclaration(node) { + checkSignatureDeclaration(node); + checkGrammarConstructorTypeParameters(node) || checkGrammarConstructorTypeAnnotation(node); + checkSourceElement(node.body); + var symbol = getSymbolOfNode(node); + var firstDeclaration = ts.getDeclarationOfKind(symbol, node.kind); + if (node === firstDeclaration) { + checkFunctionOrConstructorSymbol(symbol); + } + if (ts.nodeIsMissing(node.body)) { + return; + } + if (!produceDiagnostics) { + return; + } + function isSuperCallExpression(n) { + return n.kind === 153 && n.expression.kind === 90; + } + function containsSuperCall(n) { + if (isSuperCallExpression(n)) { + return true; + } + switch (n.kind) { + case 158: + case 193: + case 159: + case 150: return false; + default: return ts.forEachChild(n, containsSuperCall); + } + } + function markThisReferencesAsErrors(n) { + if (n.kind === 92) { + error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); + } + else if (n.kind !== 158 && n.kind !== 193) { + ts.forEachChild(n, markThisReferencesAsErrors); + } + } + function isInstancePropertyWithInitializer(n) { + return n.kind === 128 && + !(n.flags & 128) && + !!n.initializer; + } + if (ts.getClassBaseTypeNode(node.parent)) { + if (containsSuperCall(node.body)) { + var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || + ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); + if (superCallShouldBeFirst) { + var statements = node.body.statements; + if (!statements.length || statements[0].kind !== 175 || !isSuperCallExpression(statements[0].expression)) { + error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); + } + else { + markThisReferencesAsErrors(statements[0].expression); + } + } + } + else { + error(node, ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call); + } + } + } + function checkAccessorDeclaration(node) { + if (produceDiagnostics) { + checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); + if (node.kind === 132) { + 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 === 132 ? 133 : 132; + var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); + if (otherAccessor) { + if (((node.flags & 112) !== (otherAccessor.flags & 112))) { + error(node.name, ts.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); + } + var currentAccessorType = getAnnotatedAccessorType(node); + var otherAccessorType = getAnnotatedAccessorType(otherAccessor); + if (currentAccessorType && otherAccessorType) { + if (!isTypeIdenticalTo(currentAccessorType, otherAccessorType)) { + error(node, ts.Diagnostics.get_and_set_accessor_must_have_the_same_type); + } + } + } + } + checkAndStoreTypeOfAccessors(getSymbolOfNode(node)); + } + checkFunctionLikeDeclaration(node); + } + function checkTypeReference(node) { + checkGrammarTypeArguments(node, node.typeArguments); + var type = getTypeFromTypeReferenceNode(node); + if (type !== unknownType && node.typeArguments) { + var len = node.typeArguments.length; + for (var i = 0; i < len; i++) { + checkSourceElement(node.typeArguments[i]); + var constraint = getConstraintOfTypeParameter(type.target.typeParameters[i]); + if (produceDiagnostics && constraint) { + var typeArgument = type.typeArguments[i]; + checkTypeAssignableTo(typeArgument, constraint, node, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + } + } + } + } + function checkTypeQuery(node) { + getTypeFromTypeQueryNode(node); + } + function checkTypeLiteral(node) { + ts.forEach(node.members, checkSourceElement); + if (produceDiagnostics) { + var type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); + checkIndexConstraints(type); + checkTypeForDuplicateIndexSignatures(node); + } + } + function checkArrayType(node) { + checkSourceElement(node.elementType); + } + function checkTupleType(node) { + var hasErrorFromDisallowedTrailingComma = checkGrammarForDisallowedTrailingComma(node.elementTypes); + if (!hasErrorFromDisallowedTrailingComma && node.elementTypes.length === 0) { + grammarErrorOnNode(node, ts.Diagnostics.A_tuple_type_element_list_cannot_be_empty); + } + ts.forEach(node.elementTypes, checkSourceElement); + } + function checkUnionType(node) { + ts.forEach(node.types, checkSourceElement); + } + function isPrivateWithinAmbient(node) { + return (node.flags & 32) && ts.isInAmbientContext(node); + } + function checkSpecializedSignatureDeclaration(signatureDeclarationNode) { + if (!produceDiagnostics) { + return; + } + var signature = getSignatureFromDeclaration(signatureDeclarationNode); + if (!signature.hasStringLiterals) { + return; + } + if (ts.nodeIsPresent(signatureDeclarationNode.body)) { + error(signatureDeclarationNode, ts.Diagnostics.A_signature_with_an_implementation_cannot_use_a_string_literal_type); + return; + } + var signaturesToCheck; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 195) { + ts.Debug.assert(signatureDeclarationNode.kind === 134 || signatureDeclarationNode.kind === 135); + var signatureKind = signatureDeclarationNode.kind === 134 ? 0 : 1; + var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); + var containingType = getDeclaredTypeOfSymbol(containingSymbol); + signaturesToCheck = getSignaturesOfType(containingType, signatureKind); + } + else { + signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); + } + for (var i = 0; i < signaturesToCheck.length; i++) { + var otherSignature = signaturesToCheck[i]; + if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { + return; + } + } + error(signatureDeclarationNode, ts.Diagnostics.Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature); + } + function getEffectiveDeclarationFlags(n, flagsToCheck) { + var flags = ts.getCombinedNodeFlags(n); + if (n.parent.kind !== 195 && ts.isInAmbientContext(n)) { + if (!(flags & 2)) { + flags |= 1; + } + flags |= 2; + } + return flags & flagsToCheck; + } + function checkFunctionOrConstructorSymbol(symbol) { + if (!produceDiagnostics) { + return; + } + function getCanonicalOverload(overloads, implementation) { + var implementationSharesContainerWithFirstOverload = implementation !== undefined && implementation.parent === overloads[0].parent; + return implementationSharesContainerWithFirstOverload ? implementation : overloads[0]; + } + function checkFlagAgreementBetweenOverloads(overloads, implementation, flagsToCheck, someOverloadFlags, allOverloadFlags) { + var someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags; + if (someButNotAllOverloadFlags !== 0) { + var canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); + ts.forEach(overloads, function (o) { + var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags; + if (deviation & 1) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_exported_or_not_exported); + } + else if (deviation & 2) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); + } + else if (deviation & (32 | 64)) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); + } + }); + } + } + function checkQuestionTokenAgreementBetweenOverloads(overloads, implementation, someHaveQuestionToken, allHaveQuestionToken) { + if (someHaveQuestionToken !== allHaveQuestionToken) { + var canonicalHasQuestionToken = ts.hasQuestionToken(getCanonicalOverload(overloads, implementation)); + ts.forEach(overloads, function (o) { + var deviation = ts.hasQuestionToken(o) !== canonicalHasQuestionToken; + if (deviation) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_optional_or_required); + } + }); + } + } + var flagsToCheck = 1 | 2 | 32 | 64; + var someNodeFlags = 0; + var allNodeFlags = flagsToCheck; + var someHaveQuestionToken = false; + var allHaveQuestionToken = true; + var hasOverloads = false; + var bodyDeclaration; + var lastSeenNonAmbientDeclaration; + var previousDeclaration; + var declarations = symbol.declarations; + var isConstructor = (symbol.flags & 16384) !== 0; + function reportImplementationExpectedError(node) { + if (node.name && ts.getFullWidth(node.name) === 0) { + return; + } + var seen = false; + var subsequentNode = ts.forEachChild(node.parent, function (c) { + if (seen) { + return c; + } + else { + seen = c === node; + } + }); + if (subsequentNode) { + if (subsequentNode.kind === node.kind) { + var errorNode = subsequentNode.name || subsequentNode; + if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { + ts.Debug.assert(node.kind === 130 || node.kind === 129); + 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, diagnostic); + return; + } + else if (ts.nodeIsPresent(subsequentNode.body)) { + error(errorNode, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name)); + return; + } + } + } + var errorNode = node.name || node; + if (isConstructor) { + error(errorNode, ts.Diagnostics.Constructor_implementation_is_missing); + } + else { + error(errorNode, ts.Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration); + } + } + var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; + var duplicateFunctionDeclaration = false; + var multipleConstructorImplementation = false; + for (var i = 0; i < declarations.length; i++) { + var node = declarations[i]; + var inAmbientContext = ts.isInAmbientContext(node); + var inAmbientContextOrInterface = node.parent.kind === 195 || node.parent.kind === 141 || inAmbientContext; + if (inAmbientContextOrInterface) { + previousDeclaration = undefined; + } + if (node.kind === 193 || node.kind === 130 || node.kind === 129 || node.kind === 131) { + var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); + someNodeFlags |= currentNodeFlags; + allNodeFlags &= currentNodeFlags; + someHaveQuestionToken = someHaveQuestionToken || ts.hasQuestionToken(node); + allHaveQuestionToken = allHaveQuestionToken && ts.hasQuestionToken(node); + if (ts.nodeIsPresent(node.body) && bodyDeclaration) { + if (isConstructor) { + multipleConstructorImplementation = true; + } + else { + duplicateFunctionDeclaration = true; + } + } + else if (!isExportSymbolInsideModule && previousDeclaration && previousDeclaration.parent === node.parent && previousDeclaration.end !== node.pos) { + reportImplementationExpectedError(previousDeclaration); + } + if (ts.nodeIsPresent(node.body)) { + if (!bodyDeclaration) { + bodyDeclaration = node; + } + } + else { + hasOverloads = true; + } + previousDeclaration = node; + if (!inAmbientContextOrInterface) { + lastSeenNonAmbientDeclaration = node; + } + } + } + if (multipleConstructorImplementation) { + ts.forEach(declarations, function (declaration) { + error(declaration, ts.Diagnostics.Multiple_constructor_implementations_are_not_allowed); + }); + } + if (duplicateFunctionDeclaration) { + ts.forEach(declarations, function (declaration) { + error(declaration.name, ts.Diagnostics.Duplicate_function_implementation); + }); + } + if (!isExportSymbolInsideModule && lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body) { + reportImplementationExpectedError(lastSeenNonAmbientDeclaration); + } + if (hasOverloads) { + checkFlagAgreementBetweenOverloads(declarations, bodyDeclaration, flagsToCheck, someNodeFlags, allNodeFlags); + checkQuestionTokenAgreementBetweenOverloads(declarations, bodyDeclaration, someHaveQuestionToken, allHaveQuestionToken); + if (bodyDeclaration) { + var signatures = getSignaturesOfSymbol(symbol); + var bodySignature = getSignatureFromDeclaration(bodyDeclaration); + if (!bodySignature.hasStringLiterals) { + for (var i = 0, len = signatures.length; i < len; ++i) { + if (!signatures[i].hasStringLiterals && !isSignatureAssignableTo(bodySignature, signatures[i])) { + error(signatures[i].declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); + break; + } + } + } + } + } + } + function checkExportsOnMergedDeclarations(node) { + if (!produceDiagnostics) { + return; + } + var symbol; + var symbol = node.localSymbol; + if (!symbol) { + symbol = getSymbolOfNode(node); + if (!(symbol.flags & 7340032)) { + return; + } + } + if (ts.getDeclarationOfKind(symbol, node.kind) !== node) { + return; + } + var exportedDeclarationSpaces = 0; + var nonExportedDeclarationSpaces = 0; + ts.forEach(symbol.declarations, function (d) { + var declarationSpaces = getDeclarationSpaces(d); + if (getEffectiveDeclarationFlags(d, 1)) { + exportedDeclarationSpaces |= declarationSpaces; + } + else { + nonExportedDeclarationSpaces |= declarationSpaces; + } + }); + var commonDeclarationSpace = exportedDeclarationSpaces & nonExportedDeclarationSpaces; + if (commonDeclarationSpace) { + ts.forEach(symbol.declarations, function (d) { + if (getDeclarationSpaces(d) & commonDeclarationSpace) { + error(d.name, ts.Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, ts.declarationNameToString(d.name)); + } + }); + } + function getDeclarationSpaces(d) { + switch (d.kind) { + case 195: + return 2097152; + case 198: + return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; + case 194: + case 197: + return 2097152 | 1048576; + case 200: + var result = 0; + var target = resolveImport(getSymbolOfNode(d)); + ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); + return result; + default: + return 1048576; + } + } + } + function checkFunctionDeclaration(node) { + if (produceDiagnostics) { + checkFunctionLikeDeclaration(node) || + checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || + checkGrammarFunctionName(node.name) || + checkGrammarForGenerator(node); + checkCollisionWithCapturedSuperVariable(node, node.name); + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + } + } + function checkFunctionLikeDeclaration(node) { + checkSignatureDeclaration(node); + if (node.name.kind === 124) { + checkComputedPropertyName(node.name); + } + if (!ts.hasDynamicName(node)) { + var symbol = getSymbolOfNode(node); + var localSymbol = node.localSymbol || symbol; + var firstDeclaration = ts.getDeclarationOfKind(localSymbol, node.kind); + if (node === firstDeclaration) { + checkFunctionOrConstructorSymbol(localSymbol); + } + if (symbol.parent) { + if (ts.getDeclarationOfKind(symbol, node.kind) === node) { + checkFunctionOrConstructorSymbol(symbol); + } + } + } + checkSourceElement(node.body); + if (node.type && !isAccessor(node.kind)) { + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + } + if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !node.type && !isPrivateWithinAmbient(node)) { + reportImplicitAnyError(node, anyType); + } + } + function checkBlock(node) { + if (node.kind === 172) { + checkGrammarStatementInAmbientContext(node); + } + ts.forEach(node.statements, checkSourceElement); + if (ts.isFunctionBlock(node) || node.kind === 199) { + checkFunctionExpressionBodies(node); + } + } + function checkCollisionWithArgumentsInGeneratedCode(node) { + if (!ts.hasRestParameters(node) || ts.isInAmbientContext(node) || ts.nodeIsMissing(node.body)) { + return; + } + ts.forEach(node.parameters, function (p) { + if (p.name && !ts.isBindingPattern(p.name) && p.name.text === argumentsSymbol.name) { + error(p, ts.Diagnostics.Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters); + } + }); + } + function needCollisionCheckForIdentifier(node, identifier, name) { + if (!(identifier && identifier.text === name)) { + return false; + } + if (node.kind === 128 || + node.kind === 127 || + node.kind === 130 || + node.kind === 129 || + node.kind === 132 || + node.kind === 133) { + return false; + } + if (ts.isInAmbientContext(node)) { + return false; + } + var root = getRootDeclaration(node); + if (root.kind === 126 && ts.nodeIsMissing(root.parent.body)) { + return false; + } + return true; + } + function checkCollisionWithCapturedThisVariable(node, name) { + if (needCollisionCheckForIdentifier(node, name, "_this")) { + potentialThisCollisions.push(node); + } + } + function checkIfThisIsCapturedInEnclosingScope(node) { + var current = node; + while (current) { + if (getNodeCheckFlags(current) & 4) { + var isDeclaration = node.kind !== 64; + if (isDeclaration) { + error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); + } + else { + error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference); + } + return; + } + current = current.parent; + } + } + function checkCollisionWithCapturedSuperVariable(node, name) { + if (!needCollisionCheckForIdentifier(node, name, "_super")) { + return; + } + var enclosingClass = ts.getAncestor(node, 194); + if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { + return; + } + if (ts.getClassBaseTypeNode(enclosingClass)) { + var isDeclaration = node.kind !== 64; + if (isDeclaration) { + error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); + } + else { + error(node, ts.Diagnostics.Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference); + } + } + } + function checkCollisionWithRequireExportsInGeneratedCode(node, name) { + if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { + return; + } + if (node.kind === 198 && ts.getModuleInstanceState(node) !== 1) { + return; + } + var parent = getDeclarationContainer(node); + if (parent.kind === 210 && ts.isExternalModule(parent)) { + error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); + } + } + function checkVarDeclaredNamesNotShadowed(node) { + if (node.initializer && (ts.getCombinedNodeFlags(node) & 6144) === 0) { + var symbol = getSymbolOfNode(node); + if (symbol.flags & 1) { + var localDeclarationSymbol = resolveName(node, node.name.text, 3, undefined, undefined); + if (localDeclarationSymbol && + localDeclarationSymbol !== symbol && + localDeclarationSymbol.flags & 2) { + if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 6144) { + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 192); + var container = varDeclList.parent.kind === 173 && + varDeclList.parent.parent; + var namesShareScope = container && + (container.kind === 172 && ts.isAnyFunction(container.parent) || + (container.kind === 199 && container.kind === 198) || + container.kind === 210); + if (!namesShareScope) { + var name = symbolToString(localDeclarationSymbol); + error(ts.getErrorSpanForNode(node), ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); + } + } + } + } + } + } + function isParameterDeclaration(node) { + while (node.kind === 148) { + node = node.parent.parent; + } + return node.kind === 126; + } + function checkParameterInitializer(node) { + if (getRootDeclaration(node).kind === 126) { + var func = ts.getContainingFunction(node); + visit(node.initializer); + } + function visit(n) { + if (n.kind === 64) { + var referencedSymbol = getNodeLinks(n).resolvedSymbol; + if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455) === referencedSymbol) { + if (referencedSymbol.valueDeclaration.kind === 126) { + if (referencedSymbol.valueDeclaration === node) { + error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); + return; + } + if (referencedSymbol.valueDeclaration.pos < node.pos) { + return; + } + } + error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n)); + } + } + else { + ts.forEachChild(n, visit); + } + } + } + function checkVariableLikeDeclaration(node) { + checkSourceElement(node.type); + if (node.name.kind === 124) { + checkComputedPropertyName(node.name); + if (node.initializer) { + checkExpressionCached(node.initializer); + } + } + if (ts.isBindingPattern(node.name)) { + ts.forEach(node.name.elements, checkSourceElement); + } + if (node.initializer && getRootDeclaration(node).kind === 126 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); + return; + } + if (ts.isBindingPattern(node.name)) { + if (node.initializer) { + checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, undefined); + checkParameterInitializer(node); + } + return; + } + var symbol = getSymbolOfNode(node); + var type = getTypeOfVariableOrParameterOrProperty(symbol); + if (node === symbol.valueDeclaration) { + if (node.initializer) { + checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, undefined); + checkParameterInitializer(node); + } + } + else { + var declarationType = getWidenedTypeForVariableLikeDeclaration(node); + if (type !== unknownType && declarationType !== unknownType && !isTypeIdenticalTo(type, declarationType)) { + error(node.name, ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2, ts.declarationNameToString(node.name), typeToString(type), typeToString(declarationType)); + } + if (node.initializer) { + checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, undefined); + } + } + if (node.kind !== 128 && node.kind !== 127) { + checkExportsOnMergedDeclarations(node); + if (node.kind === 191 || node.kind === 148) { + checkVarDeclaredNamesNotShadowed(node); + } + checkCollisionWithCapturedSuperVariable(node, node.name); + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + } + } + function checkVariableDeclaration(node) { + checkGrammarVariableDeclaration(node); + return checkVariableLikeDeclaration(node); + } + function checkBindingElement(node) { + checkGrammarBindingElement(node); + return checkVariableLikeDeclaration(node); + } + function checkVariableStatement(node) { + checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarModifiers(node) || checkGrammarVariableDeclarationList(node.declarationList) || checkGrammarForDisallowedLetOrConstStatement(node); + ts.forEach(node.declarationList.declarations, checkSourceElement); + } + function checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) { + if (node.modifiers) { + if (inBlockOrObjectLiteralExpression(node)) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); + } + } + } + function inBlockOrObjectLiteralExpression(node) { + while (node) { + if (node.kind === 172 || node.kind === 150) { + return true; + } + node = node.parent; + } + } + function checkExpressionStatement(node) { + checkGrammarStatementInAmbientContext(node); + checkExpression(node.expression); + } + function checkIfStatement(node) { + checkGrammarStatementInAmbientContext(node); + checkExpression(node.expression); + checkSourceElement(node.thenStatement); + checkSourceElement(node.elseStatement); + } + function checkDoStatement(node) { + checkGrammarStatementInAmbientContext(node); + checkSourceElement(node.statement); + checkExpression(node.expression); + } + function checkWhileStatement(node) { + checkGrammarStatementInAmbientContext(node); + checkExpression(node.expression); + checkSourceElement(node.statement); + } + function checkForStatement(node) { + if (!checkGrammarStatementInAmbientContext(node)) { + if (node.initializer && node.initializer.kind == 192) { + checkGrammarVariableDeclarationList(node.initializer); + } + } + if (node.initializer) { + if (node.initializer.kind === 192) { + ts.forEach(node.initializer.declarations, checkVariableDeclaration); + } + else { + checkExpression(node.initializer); + } + } + if (node.condition) + checkExpression(node.condition); + if (node.iterator) + checkExpression(node.iterator); + checkSourceElement(node.statement); + } + function checkForOfStatement(node) { + checkGrammarForOfStatement(node); + } + function checkForInStatement(node) { + checkGrammarForInOrForOfStatement(node); + if (node.initializer.kind === 192) { + var variableDeclarationList = node.initializer; + if (variableDeclarationList.declarations.length >= 1) { + var decl = variableDeclarationList.declarations[0]; + checkVariableDeclaration(decl); + } + } + else { + var varExpr = node.initializer; + var exprType = checkExpression(varExpr); + if (!allConstituentTypesHaveKind(exprType, 1 | 258)) { + error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); + } + else { + checkReferenceExpression(varExpr, ts.Diagnostics.Invalid_left_hand_side_in_for_in_statement, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); + } + } + var exprType = checkExpression(node.expression); + if (!allConstituentTypesHaveKind(exprType, 1 | 48128 | 512)) { + error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); + } + checkSourceElement(node.statement); + } + function checkBreakOrContinueStatement(node) { + checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); + } + function isGetAccessorWithAnnotatatedSetAccessor(node) { + return !!(node.kind === 132 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 133))); + } + function checkReturnStatement(node) { + if (!checkGrammarStatementInAmbientContext(node)) { + var functionBlock = ts.getContainingFunction(node); + if (!functionBlock) { + grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); + } + } + if (node.expression) { + var func = ts.getContainingFunction(node); + if (func) { + var returnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); + var exprType = checkExpressionCached(node.expression); + if (func.kind === 133) { + error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + } + else { + if (func.kind === 131) { + if (!isTypeAssignableTo(exprType, returnType)) { + error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); + } + } + else if (func.type || isGetAccessorWithAnnotatatedSetAccessor(func)) { + checkTypeAssignableTo(exprType, returnType, node.expression, undefined); + } + } + } + } + } + function checkWithStatement(node) { + if (!checkGrammarStatementInAmbientContext(node)) { + if (node.parserContextFlags & 1) { + grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); + } + } + checkExpression(node.expression); + error(node.expression, ts.Diagnostics.All_symbols_within_a_with_block_will_be_resolved_to_any); + } + function checkSwitchStatement(node) { + checkGrammarStatementInAmbientContext(node); + var firstDefaultClause; + var hasDuplicateDefaultClause = false; + var expressionType = checkExpression(node.expression); + ts.forEach(node.clauses, function (clause) { + if (clause.kind === 204 && !hasDuplicateDefaultClause) { + if (firstDefaultClause === undefined) { + firstDefaultClause = clause; + } + else { + var sourceFile = ts.getSourceFileOfNode(node); + var start = ts.skipTrivia(sourceFile.text, clause.pos); + var end = clause.statements.length > 0 ? clause.statements[0].pos : clause.end; + grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement); + hasDuplicateDefaultClause = true; + } + } + if (produceDiagnostics && clause.kind === 203) { + var caseClause = clause; + var caseType = checkExpression(caseClause.expression); + if (!isTypeAssignableTo(expressionType, caseType)) { + checkTypeAssignableTo(caseType, expressionType, caseClause.expression, undefined); + } + } + ts.forEach(clause.statements, checkSourceElement); + }); + } + function checkLabeledStatement(node) { + if (!checkGrammarStatementInAmbientContext(node)) { + var current = node.parent; + while (current) { + if (ts.isAnyFunction(current)) { + break; + } + if (current.kind === 187 && 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; + } + current = current.parent; + } + } + checkSourceElement(node.statement); + } + function checkThrowStatement(node) { + if (!checkGrammarStatementInAmbientContext(node)) { + if (node.expression === undefined) { + grammarErrorAfterFirstToken(node, ts.Diagnostics.Line_break_not_permitted_here); + } + } + if (node.expression) { + checkExpression(node.expression); + } + } + function checkTryStatement(node) { + checkGrammarStatementInAmbientContext(node); + checkBlock(node.tryBlock); + var catchClause = node.catchClause; + if (catchClause) { + if (catchClause.type) { + var sourceFile = ts.getSourceFileOfNode(node); + var colonStart = ts.skipTrivia(sourceFile.text, catchClause.name.end); + grammarErrorAtPos(sourceFile, colonStart, ":".length, ts.Diagnostics.Catch_clause_parameter_cannot_have_a_type_annotation); + } + checkGrammarEvalOrArgumentsInStrictMode(node, catchClause.name); + checkBlock(catchClause.block); + } + if (node.finallyBlock) + checkBlock(node.finallyBlock); + } + function checkIndexConstraints(type) { + var declaredNumberIndexer = getIndexDeclarationOfSymbol(type.symbol, 1); + var declaredStringIndexer = getIndexDeclarationOfSymbol(type.symbol, 0); + var stringIndexType = getIndexTypeOfType(type, 0); + var numberIndexType = getIndexTypeOfType(type, 1); + if (stringIndexType || numberIndexType) { + ts.forEach(getPropertiesOfObjectType(type), function (prop) { + var propType = getTypeOfSymbol(prop); + checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0); + checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1); + }); + if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 194) { + var classDeclaration = type.symbol.valueDeclaration; + for (var i = 0; i < classDeclaration.members.length; i++) { + var member = classDeclaration.members[i]; + if (!(member.flags & 128) && ts.hasDynamicName(member)) { + var propType = getTypeOfSymbol(member.symbol); + checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0); + checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, 1); + } + } + } + } + var errorNode; + if (stringIndexType && numberIndexType) { + errorNode = declaredNumberIndexer || declaredStringIndexer; + if (!errorNode && (type.flags & 2048)) { + var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); }); + errorNode = someBaseTypeHasBothIndexers ? undefined : type.symbol.declarations[0]; + } + } + if (errorNode && !isTypeAssignableTo(numberIndexType, stringIndexType)) { + error(errorNode, ts.Diagnostics.Numeric_index_type_0_is_not_assignable_to_string_index_type_1, typeToString(numberIndexType), typeToString(stringIndexType)); + } + function checkIndexConstraintForProperty(prop, propertyType, containingType, indexDeclaration, indexType, indexKind) { + if (!indexType) { + return; + } + if (indexKind === 1 && !isNumericName(prop.valueDeclaration.name)) { + return; + } + var errorNode; + if (prop.valueDeclaration.name.kind === 124 || prop.parent === containingType.symbol) { + errorNode = prop.valueDeclaration; + } + else if (indexDeclaration) { + errorNode = indexDeclaration; + } + else if (containingType.flags & 2048) { + var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); }); + errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; + } + if (errorNode && !isTypeAssignableTo(propertyType, indexType)) { + var errorMessage = indexKind === 0 ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; + error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); + } + } + } + function checkTypeNameIsReserved(name, message) { + switch (name.text) { + case "any": + case "number": + case "boolean": + case "string": + case "symbol": + case "void": + error(name, message, name.text); + } + } + function checkTypeParameters(typeParameterDeclarations) { + if (typeParameterDeclarations) { + for (var i = 0; i < typeParameterDeclarations.length; i++) { + var node = typeParameterDeclarations[i]; + checkTypeParameter(node); + if (produceDiagnostics) { + for (var j = 0; j < i; j++) { + if (typeParameterDeclarations[j].symbol === node.symbol) { + error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.declarationNameToString(node.name)); + } + } + } + } + } + } + function checkClassDeclaration(node) { + checkGrammarClassDeclarationHeritageClauses(node); + checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); + checkTypeParameters(node.typeParameters); + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkExportsOnMergedDeclarations(node); + var symbol = getSymbolOfNode(node); + var type = getDeclaredTypeOfSymbol(symbol); + var staticType = getTypeOfSymbol(symbol); + var baseTypeNode = ts.getClassBaseTypeNode(node); + if (baseTypeNode) { + emitExtends = emitExtends || !ts.isInAmbientContext(node); + checkTypeReference(baseTypeNode); + } + if (type.baseTypes.length) { + if (produceDiagnostics) { + var baseType = type.baseTypes[0]; + checkTypeAssignableTo(type, baseType, node.name, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); + var staticBaseType = getTypeOfSymbol(baseType.symbol); + checkTypeAssignableTo(staticType, getTypeWithoutConstructors(staticBaseType), node.name, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); + if (baseType.symbol !== resolveEntityName(node, baseTypeNode.typeName, 107455)) { + error(baseTypeNode, ts.Diagnostics.Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0, typeToString(baseType)); + } + checkKindsOfPropertyMemberOverrides(type, baseType); + } + checkExpressionOrQualifiedName(baseTypeNode.typeName); + } + var implementedTypeNodes = ts.getClassImplementedTypeNodes(node); + if (implementedTypeNodes) { + ts.forEach(implementedTypeNodes, function (typeRefNode) { + checkTypeReference(typeRefNode); + if (produceDiagnostics) { + var t = getTypeFromTypeReferenceNode(typeRefNode); + if (t !== unknownType) { + var declaredType = (t.flags & 4096) ? t.target : t; + if (declaredType.flags & (1024 | 2048)) { + checkTypeAssignableTo(type, t, node.name, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); + } + else { + error(typeRefNode, ts.Diagnostics.A_class_may_only_implement_another_class_or_interface); + } + } + } + }); + } + ts.forEach(node.members, checkSourceElement); + if (produceDiagnostics) { + checkIndexConstraints(type); + checkTypeForDuplicateIndexSignatures(node); + } + } + function getTargetSymbol(s) { + return s.flags & 16777216 ? getSymbolLinks(s).target : s; + } + function checkKindsOfPropertyMemberOverrides(type, baseType) { + var baseProperties = getPropertiesOfObjectType(baseType); + for (var i = 0, len = baseProperties.length; i < len; ++i) { + var base = getTargetSymbol(baseProperties[i]); + if (base.flags & 134217728) { + continue; + } + var derived = getTargetSymbol(getPropertyOfObjectType(type, base.name)); + if (derived) { + var baseDeclarationFlags = getDeclarationFlagsFromSymbol(base); + var derivedDeclarationFlags = getDeclarationFlagsFromSymbol(derived); + if ((baseDeclarationFlags & 32) || (derivedDeclarationFlags & 32)) { + continue; + } + if ((baseDeclarationFlags & 128) !== (derivedDeclarationFlags & 128)) { + continue; + } + if ((base.flags & derived.flags & 8192) || ((base.flags & 98308) && (derived.flags & 98308))) { + continue; + } + var errorMessage; + if (base.flags & 8192) { + if (derived.flags & 98304) { + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; + } + else { + ts.Debug.assert((derived.flags & 4) !== 0); + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property; + } + } + else if (base.flags & 4) { + ts.Debug.assert((derived.flags & 8192) !== 0); + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; + } + else { + ts.Debug.assert((base.flags & 98304) !== 0); + ts.Debug.assert((derived.flags & 8192) !== 0); + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; + } + error(derived.valueDeclaration.name, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); + } + } + } + function isAccessor(kind) { + return kind === 132 || kind === 133; + } + function areTypeParametersIdentical(list1, list2) { + if (!list1 && !list2) { + return true; + } + if (!list1 || !list2 || list1.length !== list2.length) { + return false; + } + for (var i = 0, len = list1.length; i < len; i++) { + var tp1 = list1[i]; + var tp2 = list2[i]; + if (tp1.name.text !== tp2.name.text) { + return false; + } + if (!tp1.constraint && !tp2.constraint) { + continue; + } + if (!tp1.constraint || !tp2.constraint) { + return false; + } + if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) { + return false; + } + } + return true; + } + function checkInheritedPropertiesAreIdentical(type, typeNode) { + if (!type.baseTypes.length || type.baseTypes.length === 1) { + return true; + } + var seen = {}; + ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); + var ok = true; + for (var i = 0, len = type.baseTypes.length; i < len; ++i) { + var base = type.baseTypes[i]; + var properties = getPropertiesOfObjectType(base); + for (var j = 0, proplen = properties.length; j < proplen; ++j) { + var prop = properties[j]; + if (!ts.hasProperty(seen, prop.name)) { + seen[prop.name] = { prop: prop, containingType: base }; + } + else { + var existing = seen[prop.name]; + var isInheritedProperty = existing.containingType !== type; + if (isInheritedProperty && !isPropertyIdenticalTo(existing.prop, prop)) { + ok = false; + var typeName1 = typeToString(existing.containingType); + var typeName2 = typeToString(base); + var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2); + errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); + diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(typeNode, errorInfo)); + } + } + } + } + return ok; + } + function checkInterfaceDeclaration(node) { + checkGrammarModifiers(node) || checkGrammarInterfaceDeclaration(node); + checkTypeParameters(node.typeParameters); + if (produceDiagnostics) { + checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); + checkExportsOnMergedDeclarations(node); + var symbol = getSymbolOfNode(node); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 195); + 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); + } + } + if (node === firstInterfaceDecl) { + var type = getDeclaredTypeOfSymbol(symbol); + if (checkInheritedPropertiesAreIdentical(type, node.name)) { + ts.forEach(type.baseTypes, function (baseType) { + checkTypeAssignableTo(type, baseType, node.name, ts.Diagnostics.Interface_0_incorrectly_extends_interface_1); + }); + checkIndexConstraints(type); + } + } + } + ts.forEach(ts.getInterfaceBaseTypeNodes(node), checkTypeReference); + ts.forEach(node.members, checkSourceElement); + if (produceDiagnostics) { + checkTypeForDuplicateIndexSignatures(node); + } + } + function checkTypeAliasDeclaration(node) { + checkGrammarModifiers(node); + checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0); + checkSourceElement(node.type); + } + function computeEnumMemberValues(node) { + var nodeLinks = getNodeLinks(node); + if (!(nodeLinks.flags & 128)) { + var enumSymbol = getSymbolOfNode(node); + var enumType = getDeclaredTypeOfSymbol(enumSymbol); + var autoValue = 0; + var ambient = ts.isInAmbientContext(node); + var enumIsConst = ts.isConst(node); + ts.forEach(node.members, function (member) { + if (member.name.kind !== 124 && isNumericLiteralName(member.name.text)) { + error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); + } + var initializer = member.initializer; + if (initializer) { + autoValue = getConstantValueForEnumMemberInitializer(initializer, enumIsConst); + if (autoValue === undefined) { + if (enumIsConst) { + error(initializer, ts.Diagnostics.In_const_enum_declarations_member_initializer_must_be_constant_expression); + } + else if (!ambient) { + checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, undefined); + } + } + else if (enumIsConst) { + if (isNaN(autoValue)) { + error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN); + } + else if (!isFinite(autoValue)) { + error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value); + } + } + } + else if (ambient && !enumIsConst) { + autoValue = undefined; + } + if (autoValue !== undefined) { + getNodeLinks(member).enumMemberValue = autoValue++; + } + }); + nodeLinks.flags |= 128; + } + function getConstantValueForEnumMemberInitializer(initializer, enumIsConst) { + return evalConstant(initializer); + function evalConstant(e) { + switch (e.kind) { + case 163: + var value = evalConstant(e.operand); + if (value === undefined) { + return undefined; + } + switch (e.operator) { + case 33: return value; + case 34: return -value; + case 47: return enumIsConst ? ~value : undefined; + } + return undefined; + case 165: + if (!enumIsConst) { + return undefined; + } + var left = evalConstant(e.left); + if (left === undefined) { + return undefined; + } + var right = evalConstant(e.right); + if (right === undefined) { + return undefined; + } + switch (e.operatorToken.kind) { + case 44: return left | right; + case 43: return left & right; + case 41: return left >> right; + case 42: return left >>> right; + case 40: return left << right; + case 45: return left ^ right; + case 35: return left * right; + case 36: return left / right; + case 33: return left + right; + case 34: return left - right; + case 37: return left % right; + } + return undefined; + case 7: + return +e.text; + case 157: + return enumIsConst ? evalConstant(e.expression) : undefined; + case 64: + case 152: + case 151: + if (!enumIsConst) { + return undefined; + } + var member = initializer.parent; + var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); + var enumType; + var propertyName; + if (e.kind === 64) { + enumType = currentType; + propertyName = e.text; + } + else { + if (e.kind === 152) { + if (e.argumentExpression === undefined || + e.argumentExpression.kind !== 8) { + return undefined; + } + var enumType = getTypeOfNode(e.expression); + propertyName = e.argumentExpression.text; + } + else { + var enumType = getTypeOfNode(e.expression); + propertyName = e.name.text; + } + if (enumType !== currentType) { + return undefined; + } + } + if (propertyName === undefined) { + return undefined; + } + var property = getPropertyOfObjectType(enumType, propertyName); + if (!property || !(property.flags & 8)) { + return undefined; + } + var propertyDecl = property.valueDeclaration; + if (member === propertyDecl) { + return undefined; + } + if (!isDefinedBefore(propertyDecl, member)) { + return undefined; + } + return getNodeLinks(propertyDecl).enumMemberValue; + } + } + } + } + function checkEnumDeclaration(node) { + if (!produceDiagnostics) { + return; + } + checkGrammarModifiers(node) || checkGrammarEnumDeclaration(node); + checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkExportsOnMergedDeclarations(node); + computeEnumMemberValues(node); + var enumSymbol = getSymbolOfNode(node); + var firstDeclaration = ts.getDeclarationOfKind(enumSymbol, node.kind); + if (node === firstDeclaration) { + if (enumSymbol.declarations.length > 1) { + var enumIsConst = ts.isConst(node); + ts.forEach(enumSymbol.declarations, function (decl) { + if (ts.isConstEnumDeclaration(decl) !== enumIsConst) { + error(decl.name, ts.Diagnostics.Enum_declarations_must_all_be_const_or_non_const); + } + }); + } + var seenEnumMissingInitialInitializer = false; + ts.forEach(enumSymbol.declarations, function (declaration) { + if (declaration.kind !== 197) { + return false; + } + var enumDeclaration = declaration; + if (!enumDeclaration.members.length) { + return false; + } + var firstEnumMember = enumDeclaration.members[0]; + if (!firstEnumMember.initializer) { + if (seenEnumMissingInitialInitializer) { + error(firstEnumMember.name, ts.Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element); + } + else { + seenEnumMissingInitialInitializer = true; + } + } + }); + } + } + function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { + var declarations = symbol.declarations; + for (var i = 0; i < declarations.length; i++) { + var declaration = declarations[i]; + if ((declaration.kind === 194 || (declaration.kind === 193 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { + return declaration; + } + } + return undefined; + } + function checkModuleDeclaration(node) { + if (produceDiagnostics) { + if (!checkGrammarModifiers(node)) { + if (!ts.isInAmbientContext(node) && node.name.kind === 8) { + grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names); + } + else if (node.name.kind === 64 && node.body.kind === 199) { + var statements = node.body.statements; + for (var i = 0, n = statements.length; i < n; i++) { + var statement = statements[i]; + if (statement.kind === 201) { + grammarErrorOnNode(statement, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); + } + else if (ts.isExternalModuleImportDeclaration(statement)) { + grammarErrorOnNode(ts.getExternalModuleImportDeclarationExpression(statement), ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); + } + } + } + } + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkExportsOnMergedDeclarations(node); + var symbol = getSymbolOfNode(node); + if (symbol.flags & 512 && symbol.declarations.length > 1 && !ts.isInAmbientContext(node) && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { + var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); + if (classOrFunc) { + if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { + error(node.name, ts.Diagnostics.A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged); + } + else if (node.pos < classOrFunc.pos) { + error(node.name, ts.Diagnostics.A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); + } + } + } + if (node.name.kind === 8) { + if (!isGlobalSourceFile(node.parent)) { + error(node.name, ts.Diagnostics.Ambient_external_modules_cannot_be_nested_in_other_modules); + } + if (isExternalModuleNameRelative(node.name.text)) { + error(node.name, ts.Diagnostics.Ambient_external_module_declaration_cannot_specify_relative_module_name); + } + } + } + checkSourceElement(node.body); + } + function getFirstIdentifier(node) { + while (node.kind === 123) { + node = node.left; + } + return node; + } + function checkImportDeclaration(node) { + checkGrammarModifiers(node); + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + var symbol = getSymbolOfNode(node); + var target; + if (ts.isInternalModuleImportDeclaration(node)) { + target = resolveImport(symbol); + if (target !== unknownSymbol) { + if (target.flags & 107455) { + var moduleName = getFirstIdentifier(node.moduleReference); + if (resolveEntityName(node, moduleName, 107455 | 1536).flags & 1536) { + checkExpressionOrQualifiedName(node.moduleReference); + } + else { + error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName)); + } + } + if (target.flags & 793056) { + checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0); + } + } + } + else { + if (node.parent.kind === 210) { + target = resolveImport(symbol); + } + else if (node.parent.kind === 199 && node.parent.parent.name.kind === 8) { + if (ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { + if (isExternalModuleNameRelative(ts.getExternalModuleImportDeclarationExpression(node).text)) { + error(node, ts.Diagnostics.Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name); + target = unknownSymbol; + } + else { + target = resolveImport(symbol); + } + } + else { + target = unknownSymbol; + } + } + else { + target = unknownSymbol; + } + } + if (target !== unknownSymbol) { + var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | + (symbol.flags & 793056 ? 793056 : 0) | + (symbol.flags & 1536 ? 1536 : 0); + if (target.flags & excludedMeanings) { + error(node, ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0, symbolToString(symbol)); + } + } + } + function checkExportAssignment(node) { + if (!checkGrammarModifiers(node) && (node.flags & 243)) { + grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); + } + var container = node.parent; + if (container.kind !== 210) { + container = container.parent; + } + checkTypeOfExportAssignmentSymbol(getSymbolOfNode(container)); + } + function checkSourceElement(node) { + if (!node) + return; + switch (node.kind) { + case 125: + return checkTypeParameter(node); + case 126: + return checkParameter(node); + case 128: + case 127: + return checkPropertyDeclaration(node); + case 138: + case 139: + case 134: + case 135: + return checkSignatureDeclaration(node); + case 136: + return checkSignatureDeclaration(node); + case 130: + case 129: + return checkMethodDeclaration(node); + case 131: + return checkConstructorDeclaration(node); + case 132: + case 133: + return checkAccessorDeclaration(node); + case 137: + return checkTypeReference(node); + case 140: + return checkTypeQuery(node); + case 141: + return checkTypeLiteral(node); + case 142: + return checkArrayType(node); + case 143: + return checkTupleType(node); + case 144: + return checkUnionType(node); + case 145: + return checkSourceElement(node.type); + case 193: + return checkFunctionDeclaration(node); + case 172: + case 199: + return checkBlock(node); + case 173: + return checkVariableStatement(node); + case 175: + return checkExpressionStatement(node); + case 176: + return checkIfStatement(node); + case 177: + return checkDoStatement(node); + case 178: + return checkWhileStatement(node); + case 179: + return checkForStatement(node); + case 180: + return checkForInStatement(node); + case 181: + return checkForOfStatement(node); + case 182: + case 183: + return checkBreakOrContinueStatement(node); + case 184: + return checkReturnStatement(node); + case 185: + return checkWithStatement(node); + case 186: + return checkSwitchStatement(node); + case 187: + return checkLabeledStatement(node); + case 188: + return checkThrowStatement(node); + case 189: + return checkTryStatement(node); + case 191: + return checkVariableDeclaration(node); + case 148: + return checkBindingElement(node); + case 194: + return checkClassDeclaration(node); + case 195: + return checkInterfaceDeclaration(node); + case 196: + return checkTypeAliasDeclaration(node); + case 197: + return checkEnumDeclaration(node); + case 198: + return checkModuleDeclaration(node); + case 200: + return checkImportDeclaration(node); + case 201: + return checkExportAssignment(node); + case 174: + checkGrammarStatementInAmbientContext(node); + return; + case 190: + checkGrammarStatementInAmbientContext(node); + return; + } + } + function checkFunctionExpressionBodies(node) { + switch (node.kind) { + case 158: + case 159: + ts.forEach(node.parameters, checkFunctionExpressionBodies); + checkFunctionExpressionOrObjectLiteralMethodBody(node); + break; + case 130: + case 129: + ts.forEach(node.parameters, checkFunctionExpressionBodies); + if (ts.isObjectLiteralMethod(node)) { + checkFunctionExpressionOrObjectLiteralMethodBody(node); + } + break; + case 131: + case 132: + case 133: + case 193: + ts.forEach(node.parameters, checkFunctionExpressionBodies); + break; + case 185: + checkFunctionExpressionBodies(node.expression); + break; + case 126: + case 128: + case 127: + case 146: + case 147: + case 148: + case 149: + case 150: + case 207: + case 151: + case 152: + case 153: + case 154: + case 155: + case 167: + case 171: + case 156: + case 157: + case 161: + case 162: + case 160: + case 163: + case 164: + case 165: + case 166: + case 169: + case 172: + case 199: + case 173: + case 175: + case 176: + case 177: + case 178: + case 179: + case 180: + case 181: + case 182: + case 183: + case 184: + case 186: + case 203: + case 204: + case 187: + case 188: + case 189: + case 206: + case 191: + case 192: + case 194: + case 197: + case 209: + case 210: + ts.forEachChild(node, checkFunctionExpressionBodies); + break; + } + } + function checkSourceFile(node) { + var start = new Date().getTime(); + checkSourceFileWorker(node); + ts.checkTime += new Date().getTime() - start; + } + function checkSourceFileWorker(node) { + var links = getNodeLinks(node); + if (!(links.flags & 1)) { + checkGrammarSourceFile(node); + emitExtends = false; + potentialThisCollisions.length = 0; + ts.forEach(node.statements, checkSourceElement); + checkFunctionExpressionBodies(node); + if (ts.isExternalModule(node)) { + var symbol = getExportAssignmentSymbol(node.symbol); + if (symbol && symbol.flags & 8388608) { + getSymbolLinks(symbol).referenced = true; + markLinkedImportsAsReferenced(ts.getDeclarationOfKind(symbol, 200)); + } + } + if (potentialThisCollisions.length) { + ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); + potentialThisCollisions.length = 0; + } + if (emitExtends) { + links.flags |= 8; + } + links.flags |= 1; + } + } + function getDiagnostics(sourceFile) { + throwIfNonDiagnosticsProducing(); + if (sourceFile) { + checkSourceFile(sourceFile); + return diagnostics.getDiagnostics(sourceFile.fileName); + } + ts.forEach(host.getSourceFiles(), checkSourceFile); + return diagnostics.getDiagnostics(); + } + function getGlobalDiagnostics() { + throwIfNonDiagnosticsProducing(); + return diagnostics.getGlobalDiagnostics(); + } + function throwIfNonDiagnosticsProducing() { + if (!produceDiagnostics) { + throw new Error("Trying to get diagnostics from a type checker that does not produce them."); + } + } + function isInsideWithStatementBody(node) { + if (node) { + while (node.parent) { + if (node.parent.kind === 185 && node.parent.statement === node) { + return true; + } + node = node.parent; + } + } + return false; + } + function getSymbolsInScope(location, meaning) { + var symbols = {}; + var memberFlags = 0; + function copySymbol(symbol, meaning) { + if (symbol.flags & meaning) { + var id = symbol.name; + if (!isReservedMemberName(id) && !ts.hasProperty(symbols, id)) { + symbols[id] = symbol; + } + } + } + function copySymbols(source, meaning) { + if (meaning) { + for (var id in source) { + if (ts.hasProperty(source, id)) { + copySymbol(source[id], meaning); + } + } + } + } + if (isInsideWithStatementBody(location)) { + return []; + } + while (location) { + if (location.locals && !isGlobalSourceFile(location)) { + copySymbols(location.locals, meaning); + } + switch (location.kind) { + case 210: + if (!ts.isExternalModule(location)) + break; + case 198: + copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); + break; + case 197: + copySymbols(getSymbolOfNode(location).exports, meaning & 8); + break; + case 194: + case 195: + if (!(memberFlags & 128)) { + copySymbols(getSymbolOfNode(location).members, meaning & 793056); + } + break; + case 158: + if (location.name) { + copySymbol(location.symbol, meaning); + } + break; + case 206: + if (location.name.text) { + copySymbol(location.symbol, meaning); + } + break; + } + memberFlags = location.flags; + location = location.parent; + } + copySymbols(globals, meaning); + return ts.mapToArray(symbols); + } + function isTypeDeclarationName(name) { + return name.kind == 64 && + isTypeDeclaration(name.parent) && + name.parent.name === name; + } + function isTypeDeclaration(node) { + switch (node.kind) { + case 125: + case 194: + case 195: + case 196: + case 197: + return true; + } + } + function isTypeReferenceIdentifier(entityName) { + var node = entityName; + while (node.parent && node.parent.kind === 123) + node = node.parent; + return node.parent && node.parent.kind === 137; + } + function isTypeNode(node) { + if (137 <= node.kind && node.kind <= 145) { + return true; + } + switch (node.kind) { + case 110: + case 117: + case 119: + case 111: + case 120: + return true; + case 98: + return node.parent.kind !== 162; + case 8: + return node.parent.kind === 126; + case 64: + if (node.parent.kind === 123 && node.parent.right === node) { + node = node.parent; + } + case 123: + ts.Debug.assert(node.kind === 64 || node.kind === 123, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); + var parent = node.parent; + if (parent.kind === 140) { + return false; + } + if (137 <= parent.kind && parent.kind <= 145) { + return true; + } + switch (parent.kind) { + case 125: + return node === parent.constraint; + case 128: + case 127: + case 126: + case 191: + return node === parent.type; + case 193: + case 158: + case 159: + case 131: + case 130: + case 129: + case 132: + case 133: + return node === parent.type; + case 134: + case 135: + case 136: + return node === parent.type; + case 156: + return node === parent.type; + case 153: + case 154: + return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; + case 155: + return false; + } + } + return false; + } + function getLeftSideOfImportOrExportAssignment(nodeOnRightSide) { + while (nodeOnRightSide.parent.kind === 123) { + nodeOnRightSide = nodeOnRightSide.parent; + } + if (nodeOnRightSide.parent.kind === 200) { + return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; + } + if (nodeOnRightSide.parent.kind === 201) { + return nodeOnRightSide.parent.exportName === nodeOnRightSide && nodeOnRightSide.parent; + } + return undefined; + } + function isInRightSideOfImportOrExportAssignment(node) { + return getLeftSideOfImportOrExportAssignment(node) !== undefined; + } + function isRightSideOfQualifiedNameOrPropertyAccess(node) { + return (node.parent.kind === 123 && node.parent.right === node) || + (node.parent.kind === 151 && node.parent.name === node); + } + function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { + if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(entityName)) { + return getSymbolOfNode(entityName.parent); + } + if (entityName.parent.kind === 201) { + return resolveEntityName(entityName.parent.parent, entityName, 107455 | 793056 | 1536 | 8388608); + } + if (entityName.kind !== 151) { + if (isInRightSideOfImportOrExportAssignment(entityName)) { + return getSymbolOfPartOfRightHandSideOfImport(entityName); + } + } + if (isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + entityName = entityName.parent; + } + if (ts.isExpression(entityName)) { + if (ts.getFullWidth(entityName) === 0) { + return undefined; + } + if (entityName.kind === 64) { + var meaning = 107455 | 8388608; + return resolveEntityName(entityName, entityName, meaning); + } + else if (entityName.kind === 151) { + var symbol = getNodeLinks(entityName).resolvedSymbol; + if (!symbol) { + checkPropertyAccessExpression(entityName); + } + return getNodeLinks(entityName).resolvedSymbol; + } + else if (entityName.kind === 123) { + var symbol = getNodeLinks(entityName).resolvedSymbol; + if (!symbol) { + checkQualifiedName(entityName); + } + return getNodeLinks(entityName).resolvedSymbol; + } + } + else if (isTypeReferenceIdentifier(entityName)) { + var meaning = entityName.parent.kind === 137 ? 793056 : 1536; + meaning |= 8388608; + return resolveEntityName(entityName, entityName, meaning); + } + return undefined; + } + function getSymbolInfo(node) { + if (isInsideWithStatementBody(node)) { + return undefined; + } + if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + return getSymbolOfNode(node.parent); + } + if (node.kind === 64 && isInRightSideOfImportOrExportAssignment(node)) { + return node.parent.kind === 201 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImport(node); + } + switch (node.kind) { + case 64: + case 151: + case 123: + return getSymbolOfEntityNameOrPropertyAccessExpression(node); + case 92: + case 90: + var type = checkExpression(node); + return type.symbol; + case 112: + var constructorDeclaration = node.parent; + if (constructorDeclaration && constructorDeclaration.kind === 131) { + return constructorDeclaration.parent.symbol; + } + return undefined; + case 8: + if (ts.isExternalModuleImportDeclaration(node.parent.parent) && + ts.getExternalModuleImportDeclarationExpression(node.parent.parent) === node) { + var importSymbol = getSymbolOfNode(node.parent.parent); + var moduleType = getTypeOfSymbol(importSymbol); + return moduleType ? moduleType.symbol : undefined; + } + case 7: + if (node.parent.kind == 152 && node.parent.argumentExpression === node) { + var objectType = checkExpression(node.parent.expression); + if (objectType === unknownType) + return undefined; + var apparentType = getApparentType(objectType); + if (apparentType === unknownType) + return undefined; + return getPropertyOfType(apparentType, node.text); + } + break; + } + return undefined; + } + function getShorthandAssignmentValueSymbol(location) { + if (location && location.kind === 208) { + return resolveEntityName(location, location.name, 107455); + } + return undefined; + } + function getTypeOfNode(node) { + if (isInsideWithStatementBody(node)) { + return unknownType; + } + if (ts.isExpression(node)) { + return getTypeOfExpression(node); + } + if (isTypeNode(node)) { + return getTypeFromTypeNode(node); + } + if (isTypeDeclaration(node)) { + var symbol = getSymbolOfNode(node); + return getDeclaredTypeOfSymbol(symbol); + } + if (isTypeDeclarationName(node)) { + var symbol = getSymbolInfo(node); + return symbol && getDeclaredTypeOfSymbol(symbol); + } + if (ts.isDeclaration(node)) { + var symbol = getSymbolOfNode(node); + return getTypeOfSymbol(symbol); + } + if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + var symbol = getSymbolInfo(node); + return symbol && getTypeOfSymbol(symbol); + } + if (isInRightSideOfImportOrExportAssignment(node)) { + var symbol = getSymbolInfo(node); + var declaredType = symbol && getDeclaredTypeOfSymbol(symbol); + return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol); + } + return unknownType; + } + function getTypeOfExpression(expr) { + if (isRightSideOfQualifiedNameOrPropertyAccess(expr)) { + expr = expr.parent; + } + return checkExpression(expr); + } + function getAugmentedPropertiesOfType(type) { + var type = getApparentType(type); + var propsByName = createSymbolTable(getPropertiesOfType(type)); + if (getSignaturesOfType(type, 0).length || getSignaturesOfType(type, 1).length) { + ts.forEach(getPropertiesOfType(globalFunctionType), function (p) { + if (!ts.hasProperty(propsByName, p.name)) { + propsByName[p.name] = p; + } + }); + } + return getNamedMembers(propsByName); + } + function getRootSymbols(symbol) { + if (symbol.flags & 268435456) { + var symbols = []; + var name = symbol.name; + ts.forEach(getSymbolLinks(symbol).unionType.types, function (t) { + symbols.push(getPropertyOfType(t, name)); + }); + return symbols; + } + else if (symbol.flags & 67108864) { + var target = getSymbolLinks(symbol).target; + if (target) { + return [target]; + } + } + return [symbol]; + } + function isExternalModuleSymbol(symbol) { + return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 210; + } + 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)) { + var symbolWithRelevantName = node.locals[name]; + if (symbolWithRelevantName.flags & (107455 | 1048576)) { + return false; + } + if (symbolWithRelevantName.flags & 8388608) { + var importDeclarationWithRelevantName = ts.getDeclarationOfKind(symbolWithRelevantName, 200); + if (isReferencedImportDeclaration(importDeclarationWithRelevantName)) { + return false; + } + } + } + } + return true; + } + function getLocalNameOfContainer(container) { + var links = getNodeLinks(container); + if (!links.localModuleName) { + var prefix = ""; + var name = ts.unescapeIdentifier(container.name.text); + while (!isUniqueLocalName(ts.escapeIdentifier(prefix + name), container)) { + prefix += "_"; + } + links.localModuleName = prefix + ts.getTextOfNode(container.name); + } + return links.localModuleName; + } + function getLocalNameForSymbol(symbol, location) { + var node = location; + while (node) { + if ((node.kind === 198 || node.kind === 197) && getSymbolOfNode(node) === symbol) { + return getLocalNameOfContainer(node); + } + node = node.parent; + } + ts.Debug.fail("getLocalNameForSymbol failed"); + } + function getExpressionNamePrefix(node) { + var symbol = getNodeLinks(node).resolvedSymbol; + if (symbol) { + var exportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); + if (symbol !== exportSymbol && !(exportSymbol.flags & 944)) { + symbol = exportSymbol; + } + if (symbol.parent) { + return isExternalModuleSymbol(symbol.parent) ? "exports" : getLocalNameForSymbol(getParentOfSymbol(symbol), node.parent); + } + } + } + function getExportAssignmentName(node) { + var symbol = getExportAssignmentSymbol(getSymbolOfNode(node)); + return symbol && symbolIsValue(symbol) && !isConstEnumSymbol(symbol) ? symbolToString(symbol) : undefined; + } + function isTopLevelValueImportWithEntityName(node) { + if (node.parent.kind !== 210 || !ts.isInternalModuleImportDeclaration(node)) { + return false; + } + return isImportResolvedToValue(getSymbolOfNode(node)); + } + function isImportResolvedToValue(symbol) { + var target = resolveImport(symbol); + return target !== unknownSymbol && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target); + } + function isConstEnumOrConstEnumOnlyModule(s) { + return isConstEnumSymbol(s) || s.constEnumOnlyModule; + } + function isReferencedImportDeclaration(node) { + var symbol = getSymbolOfNode(node); + if (getSymbolLinks(symbol).referenced) { + return true; + } + if (node.flags & 1) { + return isImportResolvedToValue(symbol); + } + return false; + } + function isImplementationOfOverload(node) { + if (ts.nodeIsPresent(node.body)) { + var symbol = getSymbolOfNode(node); + var signaturesOfSymbol = getSignaturesOfSymbol(symbol); + return signaturesOfSymbol.length > 1 || + (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); + } + return false; + } + function getNodeCheckFlags(node) { + return getNodeLinks(node).flags; + } + function getEnumMemberValue(node) { + computeEnumMemberValues(node.parent); + return getNodeLinks(node).enumMemberValue; + } + function getConstantValue(node) { + if (node.kind === 209) { + return getEnumMemberValue(node); + } + var symbol = getNodeLinks(node).resolvedSymbol; + if (symbol && (symbol.flags & 8)) { + var declaration = symbol.valueDeclaration; + var constantValue; + if (declaration.kind === 209) { + return getEnumMemberValue(declaration); + } + } + return undefined; + } + function writeTypeOfDeclaration(declaration, enclosingDeclaration, flags, writer) { + var symbol = getSymbolOfNode(declaration); + var type = symbol && !(symbol.flags & (2048 | 131072)) ? getTypeOfSymbol(symbol) : unknownType; + getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); + } + function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { + var signature = getSignatureFromDeclaration(signatureDeclaration); + getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); + } + function isUnknownIdentifier(location, name) { + return !resolveName(location, name, 107455, undefined, undefined); + } + function createResolver() { + return { + getLocalNameOfContainer: getLocalNameOfContainer, + getExpressionNamePrefix: getExpressionNamePrefix, + getExportAssignmentName: getExportAssignmentName, + isReferencedImportDeclaration: isReferencedImportDeclaration, + getNodeCheckFlags: getNodeCheckFlags, + isTopLevelValueImportWithEntityName: isTopLevelValueImportWithEntityName, + isDeclarationVisible: isDeclarationVisible, + isImplementationOfOverload: isImplementationOfOverload, + writeTypeOfDeclaration: writeTypeOfDeclaration, + writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration, + isSymbolAccessible: isSymbolAccessible, + isEntityNameVisible: isEntityNameVisible, + getConstantValue: getConstantValue, + isUnknownIdentifier: isUnknownIdentifier + }; + } + function initializeTypeChecker() { + ts.forEach(host.getSourceFiles(), function (file) { + ts.bindSourceFile(file); + }); + ts.forEach(host.getSourceFiles(), function (file) { + if (!ts.isExternalModule(file)) { + extendSymbolTable(globals, file.locals); + } + }); + getSymbolLinks(undefinedSymbol).type = undefinedType; + getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); + getSymbolLinks(unknownSymbol).type = unknownType; + globals[undefinedSymbol.name] = undefinedSymbol; + globalArraySymbol = getGlobalTypeSymbol("Array"); + globalArrayType = getTypeOfGlobalSymbol(globalArraySymbol, 1); + globalObjectType = getGlobalType("Object"); + globalFunctionType = getGlobalType("Function"); + globalStringType = getGlobalType("String"); + globalNumberType = getGlobalType("Number"); + globalBooleanType = getGlobalType("Boolean"); + globalRegExpType = getGlobalType("RegExp"); + if (languageVersion >= 2) { + globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); + globalESSymbolType = getGlobalType("Symbol"); + globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); + } + else { + globalTemplateStringsArrayType = unknownType; + globalESSymbolType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + globalESSymbolConstructorSymbol = undefined; + } + anyArrayType = createArrayType(anyType); + } + function checkGrammarModifiers(node) { + switch (node.kind) { + case 132: + case 133: + case 131: + case 128: + case 127: + case 130: + case 129: + case 136: + case 194: + case 195: + case 198: + case 197: + case 201: + case 173: + case 193: + case 196: + case 200: + case 126: + break; + default: + return false; + } + if (!node.modifiers) { + return; + } + var lastStatic, lastPrivate, lastProtected, lastDeclare; + var flags = 0; + for (var i = 0, n = node.modifiers.length; i < n; i++) { + var modifier = node.modifiers[i]; + switch (modifier.kind) { + case 107: + case 106: + case 105: + var text; + if (modifier.kind === 107) { + text = "public"; + } + else if (modifier.kind === 106) { + text = "protected"; + lastProtected = modifier; + } + else { + text = "private"; + lastPrivate = modifier; + } + if (flags & 112) { + return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen); + } + else if (flags & 128) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); + } + else if (node.parent.kind === 199 || node.parent.kind === 210) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); + } + flags |= ts.modifierToFlag(modifier.kind); + break; + case 108: + if (flags & 128) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); + } + else if (node.parent.kind === 199 || node.parent.kind === 210) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); + } + else if (node.kind === 126) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); + } + flags |= 128; + lastStatic = modifier; + break; + case 77: + if (flags & 1) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); + } + else if (flags & 2) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); + } + else if (node.parent.kind === 194) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); + } + else if (node.kind === 126) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); + } + flags |= 1; + break; + case 113: + if (flags & 2) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); + } + else if (node.parent.kind === 194) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); + } + else if (node.kind === 126) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); + } + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 199) { + return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); + } + flags |= 2; + lastDeclare = modifier; + break; + } + } + if (node.kind === 131) { + if (flags & 128) { + return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); + } + else if (flags & 64) { + return grammarErrorOnNode(lastProtected, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected"); + } + else if (flags & 32) { + return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); + } + } + else if (node.kind === 200 && flags & 2) { + return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); + } + else if (node.kind === 195 && flags & 2) { + return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); + } + else if (node.kind === 126 && (flags & 112) && ts.isBindingPattern(node.name)) { + return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); + } + } + function checkGrammarForDisallowedTrailingComma(list) { + if (list && list.hasTrailingComma) { + var start = list.end - ",".length; + var end = list.end; + var sourceFile = ts.getSourceFileOfNode(list[0]); + return grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Trailing_comma_not_allowed); + } + } + function checkGrammarTypeParameterList(node, typeParameters) { + if (checkGrammarForDisallowedTrailingComma(typeParameters)) { + return true; + } + if (typeParameters && typeParameters.length === 0) { + var start = typeParameters.pos - "<".length; + var sourceFile = ts.getSourceFileOfNode(node); + var end = ts.skipTrivia(sourceFile.text, typeParameters.end) + ">".length; + return grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Type_parameter_list_cannot_be_empty); + } + } + function checkGrammarParameterList(parameters) { + if (checkGrammarForDisallowedTrailingComma(parameters)) { + return true; + } + var seenOptionalParameter = false; + var parameterCount = parameters.length; + for (var i = 0; i < parameterCount; i++) { + var parameter = parameters[i]; + if (parameter.dotDotDotToken) { + if (i !== (parameterCount - 1)) { + return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); + } + if (parameter.questionToken) { + return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_rest_parameter_cannot_be_optional); + } + if (parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer); + } + } + else if (parameter.questionToken || parameter.initializer) { + seenOptionalParameter = true; + if (parameter.questionToken && parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.Parameter_cannot_have_question_mark_and_initializer); + } + } + else { + if (seenOptionalParameter) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_required_parameter_cannot_follow_an_optional_parameter); + } + } + } + } + function checkGrammarFunctionLikeDeclaration(node) { + return checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters) || checkGrammarParameterList(node.parameters); + } + function checkGrammarIndexSignatureParameters(node) { + var parameter = node.parameters[0]; + if (node.parameters.length !== 1) { + if (parameter) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter); + } + else { + return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter); + } + } + if (parameter.dotDotDotToken) { + return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter); + } + if (parameter.flags & 243) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); + } + if (parameter.questionToken) { + return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark); + } + if (parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_initializer); + } + if (!parameter.type) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); + } + if (parameter.type.kind !== 119 && parameter.type.kind !== 117) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); + } + if (!node.type) { + return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_a_type_annotation); + } + } + function checkGrammarForIndexSignatureModifier(node) { + if (node.flags & 243) { + grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_not_permitted_on_index_signature_members); + } + } + function checkGrammarIndexSignature(node) { + checkGrammarModifiers(node) || checkGrammarIndexSignatureParameters(node) || checkGrammarForIndexSignatureModifier(node); + } + function checkGrammarForAtLeastOneTypeArgument(node, typeArguments) { + if (typeArguments && typeArguments.length === 0) { + var sourceFile = ts.getSourceFileOfNode(node); + var start = typeArguments.pos - "<".length; + var end = ts.skipTrivia(sourceFile.text, typeArguments.end) + ">".length; + return grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Type_argument_list_cannot_be_empty); + } + } + function checkGrammarTypeArguments(node, typeArguments) { + return checkGrammarForDisallowedTrailingComma(typeArguments) || + checkGrammarForAtLeastOneTypeArgument(node, typeArguments); + } + function checkGrammarForOmittedArgument(node, arguments) { + if (arguments) { + var sourceFile = ts.getSourceFileOfNode(node); + for (var i = 0, n = arguments.length; i < n; i++) { + var arg = arguments[i]; + if (arg.kind === 170) { + return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); + } + } + } + } + function checkGrammarArguments(node, arguments) { + return checkGrammarForDisallowedTrailingComma(arguments) || + checkGrammarForOmittedArgument(node, arguments); + } + function checkGrammarHeritageClause(node) { + var types = node.types; + if (checkGrammarForDisallowedTrailingComma(types)) { + return true; + } + if (types && types.length === 0) { + var listType = ts.tokenToString(node.token); + var sourceFile = ts.getSourceFileOfNode(node); + return grammarErrorAtPos(sourceFile, types.pos, 0, ts.Diagnostics._0_list_cannot_be_empty, listType); + } + } + function checkGrammarClassDeclarationHeritageClauses(node) { + var seenExtendsClause = false; + var seenImplementsClause = false; + if (!checkGrammarModifiers(node) && node.heritageClauses) { + for (var i = 0, n = node.heritageClauses.length; i < n; i++) { + ts.Debug.assert(i <= 2); + var heritageClause = node.heritageClauses[i]; + if (heritageClause.token === 78) { + if (seenExtendsClause) { + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); + } + if (seenImplementsClause) { + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_must_precede_implements_clause); + } + if (heritageClause.types.length > 1) { + return grammarErrorOnFirstToken(heritageClause.types[1], ts.Diagnostics.Classes_can_only_extend_a_single_class); + } + seenExtendsClause = true; + } + else { + ts.Debug.assert(heritageClause.token === 101); + if (seenImplementsClause) { + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen); + } + seenImplementsClause = true; + } + checkGrammarHeritageClause(heritageClause); + } + } + } + function checkGrammarInterfaceDeclaration(node) { + var seenExtendsClause = false; + if (node.heritageClauses) { + for (var i = 0, n = node.heritageClauses.length; i < n; i++) { + ts.Debug.assert(i <= 1); + var heritageClause = node.heritageClauses[i]; + if (heritageClause.token === 78) { + if (seenExtendsClause) { + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); + } + seenExtendsClause = true; + } + else { + ts.Debug.assert(heritageClause.token === 101); + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause); + } + checkGrammarHeritageClause(heritageClause); + } + } + return false; + } + function checkGrammarComputedPropertyName(node) { + if (node.kind !== 124) { + return false; + } + var computedPropertyName = node; + if (computedPropertyName.expression.kind === 165 && computedPropertyName.expression.operatorToken.kind === 23) { + return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); + } + } + function checkGrammarForGenerator(node) { + if (node.asteriskToken) { + return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_currently_supported); + } + } + function checkGrammarFunctionName(name) { + return checkGrammarEvalOrArgumentsInStrictMode(name, name); + } + function checkGrammarForInvalidQuestionMark(node, questionToken, message) { + if (questionToken) { + return grammarErrorOnNode(questionToken, message); + } + } + function checkGrammarObjectLiteralExpression(node) { + var seen = {}; + var Property = 1; + var GetAccessor = 2; + var SetAccesor = 4; + var GetOrSetAccessor = GetAccessor | SetAccesor; + var inStrictMode = (node.parserContextFlags & 1) !== 0; + for (var i = 0, n = node.properties.length; i < n; i++) { + var prop = node.properties[i]; + var name = prop.name; + if (prop.kind === 170 || + name.kind === 124) { + checkGrammarComputedPropertyName(name); + continue; + } + var currentKind; + if (prop.kind === 207 || prop.kind === 208) { + checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); + if (name.kind === 7) { + checkGrammarNumbericLiteral(name); + } + currentKind = Property; + } + else if (prop.kind === 130) { + currentKind = Property; + } + else if (prop.kind === 132) { + currentKind = GetAccessor; + } + else if (prop.kind === 133) { + currentKind = SetAccesor; + } + else { + ts.Debug.fail("Unexpected syntax kind:" + prop.kind); + } + if (!ts.hasProperty(seen, name.text)) { + seen[name.text] = currentKind; + } + else { + var existingKind = seen[name.text]; + if (currentKind === Property && existingKind === Property) { + if (inStrictMode) { + grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode); + } + } + else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { + if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { + seen[name.text] = currentKind | existingKind; + } + else { + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + } + } + else { + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + } + } + } + } + function checkGrammarForInOrForOfStatement(forInOrOfStatement) { + if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { + return true; + } + if (forInOrOfStatement.initializer.kind === 192) { + var variableList = forInOrOfStatement.initializer; + if (!checkGrammarVariableDeclarationList(variableList)) { + if (variableList.declarations.length > 1) { + var diagnostic = forInOrOfStatement.kind === 180 ? 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 === 180 ? 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 === 180 ? 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); + } + } + } + return false; + } + function checkGrammarForOfStatement(forOfStatement) { + return grammarErrorOnFirstToken(forOfStatement, ts.Diagnostics.for_of_statements_are_not_currently_supported); + if (languageVersion < 2) { + return grammarErrorOnFirstToken(forOfStatement, ts.Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher); + } + return checkGrammarForInOrForOfStatement(forOfStatement); + } + function checkGrammarAccessor(accessor) { + var kind = accessor.kind; + if (languageVersion < 1) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); + } + else if (ts.isInAmbientContext(accessor)) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context); + } + else if (accessor.body === undefined) { + return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); + } + else if (accessor.typeParameters) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); + } + else if (kind === 132 && accessor.parameters.length) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); + } + else if (kind === 133) { + if (accessor.type) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); + } + else if (accessor.parameters.length !== 1) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); + } + else { + var parameter = accessor.parameters[0]; + if (parameter.dotDotDotToken) { + return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter); + } + else if (parameter.flags & 243) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); + } + else if (parameter.questionToken) { + return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter); + } + else if (parameter.initializer) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer); + } + } + } + } + function checkGrammarForNonSymbolComputedProperty(node, message) { + if (node.kind === 124 && !ts.isWellKnownSymbolSyntactically(node.expression)) { + return grammarErrorOnNode(node, message); + } + } + function checkGrammarMethod(node) { + if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || + checkGrammarFunctionLikeDeclaration(node) || + checkGrammarForGenerator(node)) { + return true; + } + if (node.parent.kind === 150) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { + return true; + } + else if (node.body === undefined) { + return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); + } + } + if (node.parent.kind === 194) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { + return true; + } + if (ts.isInAmbientContext(node)) { + return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol); + } + else if (!node.body) { + 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 === 195) { + 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 === 141) { + 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 179: + case 180: + case 181: + case 177: + case 178: + return true; + case 187: + return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); + } + return false; + } + function checkGrammarBreakOrContinueStatement(node) { + var current = node; + while (current) { + if (ts.isAnyFunction(current)) { + return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); + } + switch (current.kind) { + case 187: + if (node.label && current.label.text === node.label.text) { + var isMisplacedContinueLabel = node.kind === 182 && !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); + } + return false; + } + break; + case 186: + if (node.kind === 183 && !node.label) { + return false; + } + break; + default: + if (isIterationStatement(current, false) && !node.label) { + return false; + } + break; + } + current = current.parent; + } + if (node.label) { + var message = node.kind === 183 ? 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 === 183 ? 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); + } + } + function checkGrammarBindingElement(node) { + if (node.dotDotDotToken) { + var elements = node.parent.elements; + if (node !== elements[elements.length - 1]) { + return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); + } + if (node.initializer) { + return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - 1, 1, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); + } + } + return checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + } + function checkGrammarVariableDeclaration(node) { + if (ts.isInAmbientContext(node)) { + if (ts.isBindingPattern(node.name)) { + return grammarErrorOnNode(node, ts.Diagnostics.Destructuring_declarations_are_not_allowed_in_ambient_contexts); + } + if (node.initializer) { + return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - 1, 1, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); + } + } + else { + if (!node.initializer) { + if (ts.isBindingPattern(node.name) && !ts.isBindingPattern(node.parent)) { + return grammarErrorOnNode(node, ts.Diagnostics.A_destructuring_declaration_must_have_an_initializer); + } + if (ts.isConst(node)) { + return grammarErrorOnNode(node, ts.Diagnostics.const_declarations_must_be_initialized); + } + } + } + var checkLetConstNames = languageVersion >= 2 && (ts.isLet(node) || ts.isConst(node)); + return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || + checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + } + function checkGrammarNameInLetOrConstDeclarations(name) { + if (name.kind === 64) { + if (name.text === "let") { + return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); + } + } + else { + var elements = name.elements; + for (var i = 0; i < elements.length; ++i) { + checkGrammarNameInLetOrConstDeclarations(elements[i].name); + } + } + } + function checkGrammarVariableDeclarationList(declarationList) { + var declarations = declarationList.declarations; + if (checkGrammarForDisallowedTrailingComma(declarationList.declarations)) { + return true; + } + if (!declarationList.declarations.length) { + return grammarErrorAtPos(ts.getSourceFileOfNode(declarationList), declarations.pos, declarations.end - declarations.pos, ts.Diagnostics.Variable_declaration_list_cannot_be_empty); + } + if (languageVersion < 2) { + if (ts.isLet(declarationList)) { + return grammarErrorOnFirstToken(declarationList, ts.Diagnostics.let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher); + } + else if (ts.isConst(declarationList)) { + return grammarErrorOnFirstToken(declarationList, ts.Diagnostics.const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher); + } + } + } + function allowLetAndConstDeclarations(parent) { + switch (parent.kind) { + case 176: + case 177: + case 178: + case 185: + case 179: + case 180: + case 181: + return false; + case 187: + return allowLetAndConstDeclarations(parent.parent); + } + return true; + } + function checkGrammarForDisallowedLetOrConstStatement(node) { + if (!allowLetAndConstDeclarations(node.parent)) { + if (ts.isLet(node.declarationList)) { + return grammarErrorOnNode(node, ts.Diagnostics.let_declarations_can_only_be_declared_inside_a_block); + } + else if (ts.isConst(node.declarationList)) { + return grammarErrorOnNode(node, ts.Diagnostics.const_declarations_can_only_be_declared_inside_a_block); + } + } + } + function isIntegerLiteral(expression) { + if (expression.kind === 163) { + var unaryExpression = expression; + if (unaryExpression.operator === 33 || unaryExpression.operator === 34) { + expression = unaryExpression.operand; + } + } + if (expression.kind === 7) { + return /^[0-9]+([eE]\+?[0-9]+)?$/.test(expression.text); + } + return false; + } + function checkGrammarEnumDeclaration(enumDecl) { + var enumIsConst = (enumDecl.flags & 4096) !== 0; + var hasError = false; + if (!enumIsConst) { + var inConstantEnumMemberSection = true; + var inAmbientContext = ts.isInAmbientContext(enumDecl); + for (var i = 0, n = enumDecl.members.length; i < n; i++) { + var node = enumDecl.members[i]; + if (node.name.kind === 124) { + 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; + } + function scanToken(scanner, pos) { + scanner.setTextPos(pos); + scanner.scan(); + var start = scanner.getTokenPos(); + return start; + } + function grammarErrorOnFirstToken(node, message, arg0, arg1, arg2) { + var sourceFile = ts.getSourceFileOfNode(node); + if (!hasParseDiagnostics(sourceFile)) { + var scanner = ts.createScanner(languageVersion, true, sourceFile.text); + var start = scanToken(scanner, node.pos); + diagnostics.add(ts.createFileDiagnostic(sourceFile, start, scanner.getTextPos() - start, message, arg0, arg1, arg2)); + return true; + } + } + function grammarErrorAtPos(sourceFile, start, length, message, arg0, arg1, arg2) { + if (!hasParseDiagnostics(sourceFile)) { + diagnostics.add(ts.createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2)); + return true; + } + } + function grammarErrorOnNode(node, message, arg0, arg1, arg2) { + var sourceFile = ts.getSourceFileOfNode(node); + if (!hasParseDiagnostics(sourceFile)) { + var span = ts.getErrorSpanForNode(node); + var start = span.end > span.pos ? ts.skipTrivia(sourceFile.text, span.pos) : span.pos; + diagnostics.add(ts.createFileDiagnostic(sourceFile, start, span.end - start, message, arg0, arg1, arg2)); + return true; + } + } + function checkGrammarEvalOrArgumentsInStrictMode(contextNode, identifier) { + if (contextNode && (contextNode.parserContextFlags & 1) && ts.isEvalOrArgumentsIdentifier(identifier)) { + var name = ts.declarationNameToString(identifier); + return grammarErrorOnNode(identifier, ts.Diagnostics.Invalid_use_of_0_in_strict_mode, name); + } + } + function checkGrammarConstructorTypeParameters(node) { + if (node.typeParameters) { + return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.typeParameters.pos, node.typeParameters.end - node.typeParameters.pos, ts.Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration); + } + } + function checkGrammarConstructorTypeAnnotation(node) { + if (node.type) { + return grammarErrorOnNode(node.type, ts.Diagnostics.Type_annotation_cannot_appear_on_a_constructor_declaration); + } + } + function checkGrammarProperty(node) { + if (node.parent.kind === 194) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || + checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { + return true; + } + } + else if (node.parent.kind === 195) { + 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 === 141) { + if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { + return true; + } + } + if (ts.isInAmbientContext(node) && node.initializer) { + return grammarErrorOnFirstToken(node.initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); + } + } + function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { + if (node.kind === 195 || + node.kind === 200 || + node.kind === 201 || + (node.flags & 2)) { + return false; + } + return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); + } + function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { + for (var i = 0, n = file.statements.length; i < n; i++) { + var decl = file.statements[i]; + if (ts.isDeclaration(decl) || decl.kind === 173) { + if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { + return true; + } + } + } + } + function checkGrammarSourceFile(node) { + return ts.isInAmbientContext(node) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node); + } + function checkGrammarStatementInAmbientContext(node) { + if (ts.isInAmbientContext(node)) { + if (isAccessor(node.parent.kind)) { + return getNodeLinks(node).hasReportedStatementInAmbientContext = true; + } + var links = getNodeLinks(node); + if (!links.hasReportedStatementInAmbientContext && ts.isAnyFunction(node.parent)) { + return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); + } + if (node.parent.kind === 172 || node.parent.kind === 199 || node.parent.kind === 210) { + var links = getNodeLinks(node.parent); + if (!links.hasReportedStatementInAmbientContext) { + return links.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); + } + } + else { + } + } + } + function checkGrammarNumbericLiteral(node) { + if (node.flags & 8192) { + if (node.parserContextFlags & 1) { + return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode); + } + else if (languageVersion >= 1) { + return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); + } + } + } + function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) { + var sourceFile = ts.getSourceFileOfNode(node); + if (!hasParseDiagnostics(sourceFile)) { + var scanner = ts.createScanner(languageVersion, true, sourceFile.text); + scanToken(scanner, node.pos); + diagnostics.add(ts.createFileDiagnostic(sourceFile, scanner.getTextPos(), 0, message, arg0, arg1, arg2)); + return true; + } + } + initializeTypeChecker(); + return checker; + } + ts.createTypeChecker = createTypeChecker; +})(ts || (ts = {})); +var ts; +(function (ts) { + var indentStrings = ["", " "]; + function getIndentString(level) { + if (indentStrings[level] === undefined) { + indentStrings[level] = getIndentString(level - 1) + indentStrings[1]; + } + return indentStrings[level]; + } + ts.getIndentString = getIndentString; + function getIndentSize() { + return indentStrings[1].length; + } + function shouldEmitToOwnFile(sourceFile, compilerOptions) { + if (!ts.isDeclarationFile(sourceFile)) { + if ((ts.isExternalModule(sourceFile) || !compilerOptions.out) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { + return true; + } + return false; + } + return false; + } + ts.shouldEmitToOwnFile = shouldEmitToOwnFile; + function isExternalModuleOrDeclarationFile(sourceFile) { + return ts.isExternalModule(sourceFile) || ts.isDeclarationFile(sourceFile); + } + ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; + function createTextWriter(newLine) { + var output = ""; + var indent = 0; + var lineStart = true; + var lineCount = 0; + var linePos = 0; + function write(s) { + if (s && s.length) { + if (lineStart) { + output += getIndentString(indent); + lineStart = false; + } + output += s; + } + } + function rawWrite(s) { + if (s !== undefined) { + if (lineStart) { + lineStart = false; + } + output += s; + } + } + function writeLiteral(s) { + if (s && s.length) { + write(s); + var lineStartsOfS = ts.computeLineStarts(s); + if (lineStartsOfS.length > 1) { + lineCount = lineCount + lineStartsOfS.length - 1; + linePos = output.length - s.length + lineStartsOfS[lineStartsOfS.length - 1]; + } + } + } + function writeLine() { + if (!lineStart) { + output += newLine; + lineCount++; + linePos = output.length; + lineStart = true; + } + } + function writeTextOfNode(sourceFile, node) { + write(ts.getSourceTextOfNodeFromSourceFile(sourceFile, node)); + } + return { + write: write, + rawWrite: rawWrite, + writeTextOfNode: writeTextOfNode, + writeLiteral: writeLiteral, + writeLine: writeLine, + increaseIndent: function () { return indent++; }, + decreaseIndent: function () { return indent--; }, + getIndent: function () { return indent; }, + 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; } + }; + } + function getLineOfLocalPosition(currentSourceFile, pos) { + return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line; + } + function emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments) { + if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && + getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + writer.writeLine(); + } + } + function emitComments(currentSourceFile, writer, comments, trailingSeparator, newLine, writeComment) { + var emitLeadingSpace = !trailingSeparator; + ts.forEach(comments, function (comment) { + if (emitLeadingSpace) { + writer.write(" "); + emitLeadingSpace = false; + } + writeComment(currentSourceFile, writer, comment, newLine); + if (comment.hasTrailingNewLine) { + writer.writeLine(); + } + else if (trailingSeparator) { + writer.write(" "); + } + else { + emitLeadingSpace = true; + } + }); + } + 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; + var firstCommentLineIndent; + for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { + var nextLineStart = (currentLine + 1) === lineCount ? currentSourceFile.text.length + 1 : ts.getStartPositionOfLine(currentLine + 1, currentSourceFile); + if (pos !== comment.pos) { + if (firstCommentLineIndent === undefined) { + firstCommentLineIndent = calculateIndent(ts.getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); + } + var currentWriterIndentSpacing = writer.getIndent() * getIndentSize(); + var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(pos, nextLineStart); + if (spacesToEmit > 0) { + var numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize(); + var indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize()); + writer.rawWrite(indentSizeSpaceString); + while (numberOfSingleSpacesToEmit) { + writer.rawWrite(" "); + numberOfSingleSpacesToEmit--; + } + } + else { + writer.rawWrite(""); + } + } + writeTrimmedCurrentLine(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; + } + } + function getFirstConstructorWithBody(node) { + return ts.forEach(node.members, function (member) { + if (member.kind === 131 && ts.nodeIsPresent(member.body)) { + return member; + } + }); + } + function getAllAccessorDeclarations(declarations, accessor) { + var firstAccessor; + var getAccessor; + var setAccessor; + if (ts.hasDynamicName(accessor)) { + firstAccessor = accessor; + if (accessor.kind === 132) { + getAccessor = accessor; + } + else if (accessor.kind === 133) { + setAccessor = accessor; + } + else { + ts.Debug.fail("Accessor has wrong kind"); + } + } + else { + ts.forEach(declarations, function (member) { + if ((member.kind === 132 || member.kind === 133) && (member.flags & 128) === (accessor.flags & 128)) { + var memberName = ts.getPropertyNameForPropertyNameNode(member.name); + var accessorName = ts.getPropertyNameForPropertyNameNode(accessor.name); + if (memberName === accessorName) { + if (!firstAccessor) { + firstAccessor = member; + } + if (member.kind === 132 && !getAccessor) { + getAccessor = member; + } + if (member.kind === 133 && !setAccessor) { + setAccessor = member; + } + } + } + }); + } + return { + firstAccessor: firstAccessor, + getAccessor: getAccessor, + setAccessor: setAccessor + }; + } + function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { + var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); + sourceFilePath = sourceFilePath.replace(host.getCommonSourceDirectory(), ""); + return ts.combinePaths(newDirPath, sourceFilePath); + } + function getOwnEmitOutputFilePath(sourceFile, host, extension) { + var compilerOptions = host.getCompilerOptions(); + if (compilerOptions.outDir) { + var emitOutputFilePathWithoutExtension = ts.removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir)); + } + else { + var emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.fileName); + } + return emitOutputFilePathWithoutExtension + extension; + } + function writeFile(host, diagnostics, fileName, data, writeByteOrderMark) { + host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) { + diagnostics.push(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage)); + }); + } + function emitDeclarations(host, resolver, diagnostics, jsFilePath, root) { + var newLine = host.getNewLine(); + var compilerOptions = host.getCompilerOptions(); + var languageVersion = compilerOptions.target || 0; + var write; + var writeLine; + var increaseIndent; + var decreaseIndent; + var writeTextOfNode; + var writer = createAndSetNewTextWriterWithSymbolWriter(); + var enclosingDeclaration; + var currentSourceFile; + var reportedDeclarationError = false; + var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; + var emit = compilerOptions.stripInternal ? stripInternal : emitNode; + var aliasDeclarationEmitInfo = []; + var referencePathsOutput = ""; + if (root) { + if (!compilerOptions.noResolve) { + var addedGlobalFileReference = false; + ts.forEach(root.referencedFiles, function (fileReference) { + var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); + if (referencedFile && ((referencedFile.flags & 1024) || + shouldEmitToOwnFile(referencedFile, compilerOptions) || + !addedGlobalFileReference)) { + writeReferencePath(referencedFile); + if (!isExternalModuleOrDeclarationFile(referencedFile)) { + addedGlobalFileReference = true; + } + } + }); + } + emitSourceFile(root); + } + else { + var emittedReferencedFiles = []; + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if (!isExternalModuleOrDeclarationFile(sourceFile)) { + if (!compilerOptions.noResolve) { + ts.forEach(sourceFile.referencedFiles, function (fileReference) { + var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); + if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && + !ts.contains(emittedReferencedFiles, referencedFile))) { + writeReferencePath(referencedFile); + emittedReferencedFiles.push(referencedFile); + } + }); + } + emitSourceFile(sourceFile); + } + }); + } + return { + reportedDeclarationError: reportedDeclarationError, + aliasDeclarationEmitInfo: aliasDeclarationEmitInfo, + synchronousDeclarationOutput: writer.getText(), + referencePathsOutput: referencePathsOutput + }; + function hasInternalAnnotation(range) { + var text = currentSourceFile.text; + var comment = text.substring(range.pos, range.end); + return comment.indexOf("@internal") >= 0; + } + function stripInternal(node) { + if (node) { + var leadingCommentRanges = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + if (ts.forEach(leadingCommentRanges, hasInternalAnnotation)) { + return; + } + emitNode(node); + } + } + function createAndSetNewTextWriterWithSymbolWriter() { + var writer = createTextWriter(newLine); + writer.trackSymbol = trackSymbol; + writer.writeKeyword = writer.write; + writer.writeOperator = writer.write; + writer.writePunctuation = writer.write; + writer.writeSpace = writer.write; + writer.writeStringLiteral = writer.writeLiteral; + writer.writeParameter = writer.write; + writer.writeSymbol = writer.write; + setWriter(writer); + return writer; + } + function setWriter(newWriter) { + writer = newWriter; + write = newWriter.write; + writeTextOfNode = newWriter.writeTextOfNode; + writeLine = newWriter.writeLine; + increaseIndent = newWriter.increaseIndent; + decreaseIndent = newWriter.decreaseIndent; + } + function writeAsychronousImportDeclarations(importDeclarations) { + var oldWriter = writer; + ts.forEach(importDeclarations, function (aliasToWrite) { + var aliasEmitInfo = ts.forEach(aliasDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined; }); + if (aliasEmitInfo) { + createAndSetNewTextWriterWithSymbolWriter(); + for (var declarationIndent = aliasEmitInfo.indent; declarationIndent; declarationIndent--) { + increaseIndent(); + } + writeImportDeclaration(aliasToWrite); + aliasEmitInfo.asynchronousOutput = writer.getText(); + } + }); + setWriter(oldWriter); + } + function handleSymbolAccessibilityError(symbolAccesibilityResult) { + if (symbolAccesibilityResult.accessibility === 0) { + if (symbolAccesibilityResult && symbolAccesibilityResult.aliasesToMakeVisible) { + writeAsychronousImportDeclarations(symbolAccesibilityResult.aliasesToMakeVisible); + } + } + else { + reportedDeclarationError = true; + 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)); + } + else { + diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); + } + } + } + } + function trackSymbol(symbol, enclosingDeclaration, meaning) { + handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning)); + } + function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) { + writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; + write(": "); + if (type) { + emitType(type); + } + else { + resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2, writer); + } + } + function writeReturnTypeAtSignature(signature, getSymbolAccessibilityDiagnostic) { + writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; + write(": "); + if (signature.type) { + emitType(signature.type); + } + else { + resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2, writer); + } + } + function emitLines(nodes) { + for (var i = 0, n = nodes.length; i < n; i++) { + emit(nodes[i]); + } + } + function emitSeparatedList(nodes, separator, eachNodeEmitFn) { + var currentWriterPos = writer.getTextPos(); + for (var i = 0, n = nodes.length; i < n; i++) { + if (currentWriterPos !== writer.getTextPos()) { + write(separator); + } + currentWriterPos = writer.getTextPos(); + eachNodeEmitFn(nodes[i]); + } + } + function emitCommaList(nodes, eachNodeEmitFn) { + emitSeparatedList(nodes, ", ", eachNodeEmitFn); + } + function writeJsDocComments(declaration) { + if (declaration) { + var jsDocComments = ts.getJsDocComments(declaration, currentSourceFile); + emitNewLineBeforeLeadingComments(currentSourceFile, writer, declaration, jsDocComments); + emitComments(currentSourceFile, writer, jsDocComments, true, newLine, writeCommentRange); + } + } + function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type, getSymbolAccessibilityDiagnostic) { + writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; + emitType(type); + } + function emitType(type) { + switch (type.kind) { + case 110: + case 119: + case 117: + case 111: + case 120: + case 98: + case 8: + return writeTextOfNode(currentSourceFile, type); + case 137: + return emitTypeReference(type); + case 140: + return emitTypeQuery(type); + case 142: + return emitArrayType(type); + case 143: + return emitTupleType(type); + case 144: + return emitUnionType(type); + case 145: + return emitParenType(type); + case 138: + case 139: + return emitSignatureDeclarationWithJsDocComments(type); + case 141: + return emitTypeLiteral(type); + case 64: + return emitEntityName(type); + case 123: + return emitEntityName(type); + default: + ts.Debug.fail("Unknown type annotation: " + type.kind); + } + function emitEntityName(entityName) { + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 200 ? entityName.parent : enclosingDeclaration); + handleSymbolAccessibilityError(visibilityResult); + writeEntityName(entityName); + function writeEntityName(entityName) { + if (entityName.kind === 64) { + writeTextOfNode(currentSourceFile, entityName); + } + else { + var qualifiedName = entityName; + writeEntityName(qualifiedName.left); + write("."); + writeTextOfNode(currentSourceFile, qualifiedName.right); + } + } + } + function emitTypeReference(type) { + emitEntityName(type.typeName); + if (type.typeArguments) { + write("<"); + emitCommaList(type.typeArguments, emitType); + write(">"); + } + } + function emitTypeQuery(type) { + write("typeof "); + emitEntityName(type.exprName); + } + function emitArrayType(type) { + emitType(type.elementType); + write("[]"); + } + function emitTupleType(type) { + write("["); + emitCommaList(type.elementTypes, emitType); + write("]"); + } + function emitUnionType(type) { + emitSeparatedList(type.types, " | ", emitType); + } + function emitParenType(type) { + write("("); + emitType(type.type); + write(")"); + } + function emitTypeLiteral(type) { + write("{"); + if (type.members.length) { + writeLine(); + increaseIndent(); + emitLines(type.members); + decreaseIndent(); + } + write("}"); + } + } + function emitSourceFile(node) { + currentSourceFile = node; + enclosingDeclaration = node; + emitLines(node.statements); + } + function emitExportAssignment(node) { + write("export = "); + writeTextOfNode(currentSourceFile, node.exportName); + write(";"); + writeLine(); + } + function emitModuleElementDeclarationFlags(node) { + if (node.parent === currentSourceFile) { + if (node.flags & 1) { + write("export "); + } + if (node.kind !== 195) { + write("declare "); + } + } + } + function emitClassMemberDeclarationFlags(node) { + if (node.flags & 32) { + write("private "); + } + else if (node.flags & 64) { + write("protected "); + } + if (node.flags & 128) { + write("static "); + } + } + function emitImportDeclaration(node) { + var nodeEmitInfo = { + declaration: node, + outputPos: writer.getTextPos(), + indent: writer.getIndent(), + hasWritten: resolver.isDeclarationVisible(node) + }; + aliasDeclarationEmitInfo.push(nodeEmitInfo); + if (nodeEmitInfo.hasWritten) { + writeImportDeclaration(node); + } + } + function writeImportDeclaration(node) { + emitJsDocComments(node); + if (node.flags & 1) { + write("export "); + } + write("import "); + writeTextOfNode(currentSourceFile, node.name); + write(" = "); + if (ts.isInternalModuleImportDeclaration(node)) { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.moduleReference, getImportEntityNameVisibilityError); + write(";"); + } + else { + write("require("); + writeTextOfNode(currentSourceFile, ts.getExternalModuleImportDeclarationExpression(node)); + write(");"); + } + writer.writeLine(); + function getImportEntityNameVisibilityError(symbolAccesibilityResult) { + return { + diagnosticMessage: ts.Diagnostics.Import_declaration_0_is_using_private_name_1, + errorNode: node, + typeName: node.name + }; + } + } + function emitModuleDeclaration(node) { + if (resolver.isDeclarationVisible(node)) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + write("module "); + writeTextOfNode(currentSourceFile, node.name); + while (node.body.kind !== 199) { + node = node.body; + write("."); + writeTextOfNode(currentSourceFile, node.name); + } + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + write(" {"); + writeLine(); + increaseIndent(); + emitLines(node.body.statements); + decreaseIndent(); + write("}"); + writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; + } + } + function emitTypeAliasDeclaration(node) { + if (resolver.isDeclarationVisible(node)) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + write("type "); + writeTextOfNode(currentSourceFile, node.name); + write(" = "); + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError); + write(";"); + writeLine(); + } + function getTypeAliasDeclarationVisibilityError(symbolAccesibilityResult) { + return { + diagnosticMessage: ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1, + errorNode: node.type, + typeName: node.name + }; + } + } + function emitEnumDeclaration(node) { + if (resolver.isDeclarationVisible(node)) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + if (ts.isConst(node)) { + write("const "); + } + write("enum "); + writeTextOfNode(currentSourceFile, node.name); + write(" {"); + writeLine(); + increaseIndent(); + emitLines(node.members); + decreaseIndent(); + write("}"); + writeLine(); + } + } + function emitEnumMemberDeclaration(node) { + emitJsDocComments(node); + writeTextOfNode(currentSourceFile, node.name); + var enumMemberValue = resolver.getConstantValue(node); + if (enumMemberValue !== undefined) { + write(" = "); + write(enumMemberValue.toString()); + } + write(","); + writeLine(); + } + function isPrivateMethodTypeParameter(node) { + return node.parent.kind === 130 && (node.parent.flags & 32); + } + function emitTypeParameters(typeParameters) { + function emitTypeParameter(node) { + increaseIndent(); + emitJsDocComments(node); + decreaseIndent(); + writeTextOfNode(currentSourceFile, node.name); + if (node.constraint && !isPrivateMethodTypeParameter(node)) { + write(" extends "); + if (node.parent.kind === 138 || + node.parent.kind === 139 || + (node.parent.parent && node.parent.parent.kind === 141)) { + ts.Debug.assert(node.parent.kind === 130 || + node.parent.kind === 129 || + node.parent.kind === 138 || + node.parent.kind === 139 || + node.parent.kind === 134 || + node.parent.kind === 135); + emitType(node.constraint); + } + else { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError); + } + } + function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + switch (node.parent.kind) { + case 194: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; + break; + case 195: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; + break; + case 135: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + break; + case 134: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + break; + case 130: + case 129: + 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 === 194) { + 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 193: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; + break; + default: + ts.Debug.fail("This is unknown parent for type parameter: " + node.parent.kind); + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + }; + } + } + if (typeParameters) { + write("<"); + emitCommaList(typeParameters, emitTypeParameter); + write(">"); + } + } + function emitHeritageClause(typeReferences, isImplementsList) { + if (typeReferences) { + write(isImplementsList ? " implements " : " extends "); + emitCommaList(typeReferences, emitTypeOfTypeReference); + } + function emitTypeOfTypeReference(node) { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + function getHeritageClauseVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + if (node.parent.parent.kind === 194) { + 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; + } + else { + diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.parent.parent.name + }; + } + } + } + function emitClassDeclaration(node) { + function emitParameterProperties(constructorDeclaration) { + if (constructorDeclaration) { + ts.forEach(constructorDeclaration.parameters, function (param) { + if (param.flags & 112) { + emitPropertyDeclaration(param); + } + }); + } + } + if (resolver.isDeclarationVisible(node)) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + write("class "); + writeTextOfNode(currentSourceFile, node.name); + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + emitTypeParameters(node.typeParameters); + var baseTypeNode = ts.getClassBaseTypeNode(node); + if (baseTypeNode) { + emitHeritageClause([baseTypeNode], false); + } + emitHeritageClause(ts.getClassImplementedTypeNodes(node), true); + write(" {"); + writeLine(); + increaseIndent(); + emitParameterProperties(getFirstConstructorWithBody(node)); + emitLines(node.members); + decreaseIndent(); + write("}"); + writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; + } + } + function emitInterfaceDeclaration(node) { + if (resolver.isDeclarationVisible(node)) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + write("interface "); + writeTextOfNode(currentSourceFile, node.name); + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + emitTypeParameters(node.typeParameters); + emitHeritageClause(ts.getInterfaceBaseTypeNodes(node), false); + write(" {"); + writeLine(); + increaseIndent(); + emitLines(node.members); + decreaseIndent(); + write("}"); + writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; + } + } + function emitPropertyDeclaration(node) { + if (ts.hasDynamicName(node)) { + return; + } + emitJsDocComments(node); + emitClassMemberDeclarationFlags(node); + emitVariableDeclaration(node); + write(";"); + writeLine(); + } + function emitVariableDeclaration(node) { + if (node.kind !== 191 || resolver.isDeclarationVisible(node)) { + writeTextOfNode(currentSourceFile, node.name); + if ((node.kind === 128 || node.kind === 127) && ts.hasQuestionToken(node)) { + write("?"); + } + if ((node.kind === 128 || node.kind === 127) && node.parent.kind === 141) { + emitTypeOfVariableDeclarationFromTypeLiteral(node); + } + else if (!(node.flags & 32)) { + writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError); + } + } + function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + if (node.kind === 191) { + diagnosticMessage = 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 === 128 || node.kind === 127) { + if (node.flags & 128) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : 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 === 194) { + diagnosticMessage = 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 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; + } + else { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; + } + } + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + } : undefined; + } + } + function emitTypeOfVariableDeclarationFromTypeLiteral(node) { + if (node.type) { + write(": "); + emitType(node.type); + } + } + function emitVariableStatement(node) { + var hasDeclarationWithEmit = ts.forEach(node.declarationList.declarations, function (varDeclaration) { return resolver.isDeclarationVisible(varDeclaration); }); + if (hasDeclarationWithEmit) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + if (ts.isLet(node.declarationList)) { + write("let "); + } + else if (ts.isConst(node.declarationList)) { + write("const "); + } + else { + write("var "); + } + emitCommaList(node.declarationList.declarations, emitVariableDeclaration); + write(";"); + writeLine(); + } + } + function emitAccessorDeclaration(node) { + if (ts.hasDynamicName(node)) { + return; + } + var accessors = getAllAccessorDeclarations(node.parent.members, node); + if (node === accessors.firstAccessor) { + emitJsDocComments(accessors.getAccessor); + emitJsDocComments(accessors.setAccessor); + emitClassMemberDeclarationFlags(node); + writeTextOfNode(currentSourceFile, node.name); + if (!(node.flags & 32)) { + var accessorWithTypeAnnotation = node; + var type = getTypeAnnotationFromAccessor(node); + if (!type) { + var anotherAccessor = node.kind === 132 ? accessors.setAccessor : accessors.getAccessor; + type = getTypeAnnotationFromAccessor(anotherAccessor); + if (type) { + accessorWithTypeAnnotation = anotherAccessor; + } + } + writeTypeOfDeclaration(node, type, getAccessorDeclarationTypeVisibilityError); + } + write(";"); + writeLine(); + } + function getTypeAnnotationFromAccessor(accessor) { + if (accessor) { + return accessor.kind === 132 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : undefined; + } + } + function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + if (accessorWithTypeAnnotation.kind === 133) { + 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 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; + } + else { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: accessorWithTypeAnnotation.parameters[0], + typeName: accessorWithTypeAnnotation.name + }; + } + else { + if (accessorWithTypeAnnotation.flags & 128) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; + } + else { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: accessorWithTypeAnnotation.name, + typeName: undefined + }; + } + } + } + function emitFunctionDeclaration(node) { + if (ts.hasDynamicName(node)) { + return; + } + if ((node.kind !== 193 || resolver.isDeclarationVisible(node)) && + !resolver.isImplementationOfOverload(node)) { + emitJsDocComments(node); + if (node.kind === 193) { + emitModuleElementDeclarationFlags(node); + } + else if (node.kind === 130) { + emitClassMemberDeclarationFlags(node); + } + if (node.kind === 193) { + write("function "); + writeTextOfNode(currentSourceFile, node.name); + } + else if (node.kind === 131) { + write("constructor"); + } + else { + writeTextOfNode(currentSourceFile, node.name); + if (ts.hasQuestionToken(node)) { + write("?"); + } + } + emitSignatureDeclaration(node); + } + } + function emitSignatureDeclarationWithJsDocComments(node) { + emitJsDocComments(node); + emitSignatureDeclaration(node); + } + function emitSignatureDeclaration(node) { + if (node.kind === 135 || node.kind === 139) { + write("new "); + } + emitTypeParameters(node.typeParameters); + if (node.kind === 136) { + write("["); + } + else { + write("("); + } + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + emitCommaList(node.parameters, emitParameterDeclaration); + if (node.kind === 136) { + write("]"); + } + else { + write(")"); + } + var isFunctionTypeOrConstructorType = node.kind === 138 || node.kind === 139; + if (isFunctionTypeOrConstructorType || node.parent.kind === 141) { + if (node.type) { + write(isFunctionTypeOrConstructorType ? " => " : ": "); + emitType(node.type); + } + } + else if (node.kind !== 131 && !(node.flags & 32)) { + writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); + } + enclosingDeclaration = prevEnclosingDeclaration; + if (!isFunctionTypeOrConstructorType) { + write(";"); + writeLine(); + } + function getReturnTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + switch (node.kind) { + case 135: + 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 134: + 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 136: + 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 130: + case 129: + if (node.flags & 128) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : 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 === 194) { + 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 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; + } + else { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; + } + break; + case 193: + 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 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; + break; + default: + ts.Debug.fail("This is unknown kind for signature: " + node.kind); + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: node.name || node + }; + } + } + function emitParameterDeclaration(node) { + increaseIndent(); + emitJsDocComments(node); + if (node.dotDotDotToken) { + write("..."); + } + if (ts.isBindingPattern(node.name)) { + write("_" + ts.indexOf(node.parent.parameters, node)); + } + else { + writeTextOfNode(currentSourceFile, node.name); + } + if (node.initializer || ts.hasQuestionToken(node)) { + write("?"); + } + decreaseIndent(); + if (node.parent.kind === 138 || + node.parent.kind === 139 || + node.parent.parent.kind === 141) { + emitTypeOfVariableDeclarationFromTypeLiteral(node); + } + else if (!(node.parent.flags & 32)) { + writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); + } + function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + switch (node.parent.kind) { + case 131: + diagnosticMessage = 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; + break; + case 135: + diagnosticMessage = 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; + break; + case 134: + diagnosticMessage = 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; + break; + case 130: + case 129: + if (node.parent.flags & 128) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : 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 === 194) { + diagnosticMessage = 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 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + } + else { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? 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; + } + break; + case 193: + diagnosticMessage = 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 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; + break; + default: + ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + }; + } + } + function emitNode(node) { + switch (node.kind) { + case 131: + case 193: + case 130: + case 129: + return emitFunctionDeclaration(node); + case 135: + case 134: + case 136: + return emitSignatureDeclarationWithJsDocComments(node); + case 132: + case 133: + return emitAccessorDeclaration(node); + case 173: + return emitVariableStatement(node); + case 128: + case 127: + return emitPropertyDeclaration(node); + case 195: + return emitInterfaceDeclaration(node); + case 194: + return emitClassDeclaration(node); + case 196: + return emitTypeAliasDeclaration(node); + case 209: + return emitEnumMemberDeclaration(node); + case 197: + return emitEnumDeclaration(node); + case 198: + return emitModuleDeclaration(node); + case 200: + return emitImportDeclaration(node); + case 201: + return emitExportAssignment(node); + case 210: + return emitSourceFile(node); + } + } + function writeReferencePath(referencedFile) { + var declFileName = referencedFile.flags & 1024 ? referencedFile.fileName : shouldEmitToOwnFile(referencedFile, compilerOptions) ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; + declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); + referencePathsOutput += "/// " + newLine; + } + } + function getDeclarationDiagnostics(host, resolver, targetSourceFile) { + var diagnostics = []; + var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, ".js"); + emitDeclarations(host, resolver, diagnostics, jsFilePath, targetSourceFile); + return diagnostics; + } + ts.getDeclarationDiagnostics = getDeclarationDiagnostics; + function emitFiles(resolver, host, targetSourceFile) { + var compilerOptions = host.getCompilerOptions(); + var languageVersion = compilerOptions.target || 0; + var sourceMapDataList = compilerOptions.sourceMap ? [] : undefined; + var diagnostics = []; + var newLine = host.getNewLine(); + if (targetSourceFile === undefined) { + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if (shouldEmitToOwnFile(sourceFile, compilerOptions)) { + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, ".js"); + emitFile(jsFilePath, sourceFile); + } + }); + if (compilerOptions.out) { + emitFile(compilerOptions.out); + } + } + else { + if (shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { + var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, ".js"); + emitFile(jsFilePath, targetSourceFile); + } + else if (!ts.isDeclarationFile(targetSourceFile) && compilerOptions.out) { + emitFile(compilerOptions.out); + } + } + diagnostics = ts.sortAndDeduplicateDiagnostics(diagnostics); + return { + emitSkipped: false, + diagnostics: diagnostics, + sourceMaps: sourceMapDataList + }; + function emitJavaScript(jsFilePath, root) { + var writer = createTextWriter(newLine); + var write = writer.write; + var writeTextOfNode = writer.writeTextOfNode; + var writeLine = writer.writeLine; + var increaseIndent = writer.increaseIndent; + var decreaseIndent = writer.decreaseIndent; + var currentSourceFile; + var extendsEmitted = false; + var tempCount = 0; + var tempVariables; + var tempParameters; + var writeEmittedFiles = writeJavaScriptFile; + var emitLeadingComments = compilerOptions.removeComments ? function (node) { } : emitLeadingDeclarationComments; + var emitTrailingComments = compilerOptions.removeComments ? function (node) { } : emitTrailingDeclarationComments; + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfLocalPosition; + var detachedCommentsInfo; + var emitDetachedComments = compilerOptions.removeComments ? function (node) { } : emitDetachedCommentsAtPosition; + var emitPinnedOrTripleSlashComments = compilerOptions.removeComments ? function (node) { } : emitPinnedOrTripleSlashCommentsOfNode; + var writeComment = writeCommentRange; + var emit = emitNode; + var emitStart = function (node) { }; + var emitEnd = function (node) { }; + var emitToken = emitTokenText; + var scopeEmitStart = function (scopeDeclaration, scopeName) { }; + var scopeEmitEnd = function () { }; + var sourceMapData; + if (compilerOptions.sourceMap) { + initializeEmitterWithSourceMaps(); + } + if (root) { + emit(root); + } + else { + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if (!isExternalModuleOrDeclarationFile(sourceFile)) { + emit(sourceFile); + } + }); + } + writeLine(); + writeEmittedFiles(writer.getText(), compilerOptions.emitBOM); + return; + function initializeEmitterWithSourceMaps() { + var sourceMapDir; + var sourceMapSourceIndex = -1; + var sourceMapNameIndexMap = {}; + var sourceMapNameIndices = []; + function getSourceMapNameIndex() { + return sourceMapNameIndices.length ? sourceMapNameIndices[sourceMapNameIndices.length - 1] : -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); + } + 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 = node.name; + if (!name || name.kind !== 124) { + 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 === 193 || + node.kind === 158 || + node.kind === 130 || + node.kind === 129 || + node.kind === 132 || + node.kind === 133 || + node.kind === 198 || + node.kind === 194 || + node.kind === 197) { + if (node.name) { + var name = node.name; + scopeName = name.kind === 124 ? ts.getTextOfNode(name) : node.name.text; + } + recordScopeNameStart(scopeName); + } + else { + recordScopeNameIndex(getSourceMapNameIndex()); + } + } + function recordScopeNameEnd() { + sourceMapNameIndices.pop(); + } + ; + function writeCommentRangeWithMap(curentSourceFile, writer, comment, newLine) { + recordSourceMapSpan(comment.pos); + writeCommentRange(currentSourceFile, writer, comment, newLine); + recordSourceMapSpan(comment.end); + } + function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings) { + if (typeof JSON !== "undefined") { + return JSON.stringify({ + version: version, + file: file, + sourceRoot: sourceRoot, + sources: sources, + names: names, + mappings: mappings + }); + } + return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\"}"; + 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(); + writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings), false); + sourceMapDataList.push(sourceMapData); + writeJavaScriptFile(emitOutput + "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL, writeByteOrderMark); + } + var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); + sourceMapData = { + sourceMapFilePath: jsFilePath + ".map", + jsSourceMappingURL: sourceMapJsFile + ".map", + sourceMapFile: sourceMapJsFile, + sourceMapSourceRoot: compilerOptions.sourceRoot || "", + sourceMapSources: [], + inputSourceFileNames: [], + sourceMapNames: [], + sourceMapMappings: "", + 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(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 emitNodeWithMap(node) { + if (node) { + if (node.kind != 210) { + recordEmitNodeStartSpan(node); + emitNode(node); + recordEmitNodeEndSpan(node); + } + else { + recordNewSourceFileStart(node); + emitNode(node); + } + } + } + writeEmittedFiles = writeJavaScriptAndSourceMapFile; + emit = emitNodeWithMap; + emitStart = recordEmitNodeStartSpan; + emitEnd = recordEmitNodeEndSpan; + emitToken = writeTextWithSpanRecord; + scopeEmitStart = recordScopeNameOfNode; + scopeEmitEnd = recordScopeNameEnd; + writeComment = writeCommentRangeWithMap; + } + function writeJavaScriptFile(emitOutput, writeByteOrderMark) { + writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); + } + function createTempVariable(location, forLoopVariable) { + var name = forLoopVariable ? "_i" : undefined; + while (true) { + if (name && resolver.isUnknownIdentifier(location, name)) { + break; + } + name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + 97) : tempCount - 25); + tempCount++; + } + var result = ts.createNode(64); + result.text = name; + return result; + } + function recordTempDeclaration(name) { + if (!tempVariables) { + tempVariables = []; + } + tempVariables.push(name); + } + function createAndRecordTempVariable(location) { + var temp = createTempVariable(location, false); + 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 emitParenthesized(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]); + } + var closeTokenIsOnSameLineAsLastElement = nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes)); + if (nodes.hasTrailingComma && allowTrailingComma) { + write(","); + } + decreaseIndent(); + if (closeTokenIsOnSameLineAsLastElement) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + } + function emitList(nodes, start, count, multiLine, trailingComma) { + for (var i = 0; i < count; i++) { + if (multiLine) { + if (i) { + write(","); + } + writeLine(); + } + else { + if (i) { + write(", "); + } + } + emit(nodes[start + i]); + } + if (trailingComma) { + write(","); + } + if (multiLine) { + writeLine(); + } + } + 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(text) { + if (text.length <= 0) { + return false; + } + if (text.charCodeAt(1) === 66 || text.charCodeAt(1) === 98 || + text.charCodeAt(1) === 79 || text.charCodeAt(1) === 111) { + return true; + } + return false; + } + function emitLiteral(node) { + var text = languageVersion < 2 && ts.isTemplateLiteralKind(node.kind) ? getTemplateLiteralAsStringLiteral(node) : node.parent ? ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node) : node.text; + if (compilerOptions.sourceMap && (node.kind === 8 || ts.isTemplateLiteralKind(node.kind))) { + writer.writeLiteral(text); + } + else if (languageVersion < 2 && node.kind === 7 && isBinaryOrOctalIntegerLiteral(text)) { + write(node.text); + } + else { + write(text); + } + } + function getTemplateLiteralAsStringLiteral(node) { + return '"' + ts.escapeString(node.text) + '"'; + } + 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; i < node.templateSpans.length; i++) { + var templateSpan = node.templateSpans[i]; + var needsParens = templateSpan.expression.kind !== 157 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; + if (i > 0 || headEmitted) { + write(" + "); + } + emitParenthesized(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 153: + case 154: + return parent.expression === template; + case 155: + case 157: + return false; + default: + return comparePrecedenceToBinaryPlus(parent) !== -1; + } + } + function comparePrecedenceToBinaryPlus(expression) { + switch (expression.kind) { + case 165: + switch (expression.operatorToken.kind) { + case 35: + case 36: + case 37: + return 1; + case 33: + case 34: + return 0; + default: + return -1; + } + case 166: + return -1; + default: + return 1; + } + } + } + function emitTemplateSpan(span) { + emit(span.expression); + emit(span.literal); + } + function emitExpressionForPropertyName(node) { + ts.Debug.assert(node.kind !== 148); + if (node.kind === 8) { + emitLiteral(node); + } + else if (node.kind === 124) { + emit(node.expression); + } + else { + write("\""); + if (node.kind === 7) { + write(node.text); + } + else { + writeTextOfNode(currentSourceFile, node); + } + write("\""); + } + } + function isNotExpressionIdentifier(node) { + var parent = node.parent; + switch (parent.kind) { + case 126: + case 191: + case 148: + case 128: + case 127: + case 207: + case 208: + case 209: + case 130: + case 129: + case 193: + case 132: + case 133: + case 158: + case 194: + case 195: + case 197: + case 198: + case 200: + return parent.name === node; + case 183: + case 182: + case 201: + return false; + case 187: + return node.parent.label === node; + case 206: + return node.parent.name === node; + } + } + function emitExpressionIdentifier(node) { + var prefix = resolver.getExpressionNamePrefix(node); + if (prefix) { + write(prefix); + write("."); + } + writeTextOfNode(currentSourceFile, node); + } + function emitIdentifier(node) { + if (!node.parent) { + write(node.text); + } + else if (!isNotExpressionIdentifier(node)) { + emitExpressionIdentifier(node); + } + else { + writeTextOfNode(currentSourceFile, node); + } + } + function emitThis(node) { + if (resolver.getNodeCheckFlags(node) & 2) { + write("_this"); + } + else { + write("this"); + } + } + function emitSuper(node) { + var flags = resolver.getNodeCheckFlags(node); + if (flags & 16) { + write("_super.prototype"); + } + else if (flags & 32) { + write("_super"); + } + 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 needsParenthesisForPropertyAccess(node) { + switch (node.kind) { + case 64: + case 149: + case 151: + case 152: + case 153: + case 157: + return false; + } + return true; + } + function emitListWithSpread(elements, multiLine, trailingComma) { + var pos = 0; + var group = 0; + var length = elements.length; + while (pos < length) { + if (group === 1) { + write(".concat("); + } + else if (group > 1) { + write(", "); + } + var e = elements[pos]; + if (e.kind === 169) { + e = e.expression; + emitParenthesized(e, group === 0 && needsParenthesisForPropertyAccess(e)); + pos++; + } + else { + var i = pos; + while (i < length && elements[i].kind !== 169) { + i++; + } + write("["); + if (multiLine) { + increaseIndent(); + } + emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); + if (multiLine) { + decreaseIndent(); + } + write("]"); + pos = i; + } + group++; + } + if (group > 1) { + write(")"); + } + } + function isSpreadElementExpression(node) { + return node.kind === 169; + } + 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, (node.flags & 256) !== 0, elements.hasTrailingComma); + } + } + function createSynthesizedNode(kind) { + var node = ts.createNode(kind); + node.pos = -1; + node.end = -1; + return node; + } + function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { + var parenthesizedObjectLiteral = createDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex); + return emit(parenthesizedObjectLiteral); + } + function createDownlevelObjectLiteralWithComputedProperties(originalObjectLiteral, firstComputedPropertyIndex) { + var tempVar = createAndRecordTempVariable(originalObjectLiteral); + var initialObjectLiteral = createSynthesizedNode(150); + initialObjectLiteral.properties = originalObjectLiteral.properties.slice(0, firstComputedPropertyIndex); + initialObjectLiteral.flags |= 256; + var propertyPatches = createBinaryExpression(tempVar, 52, initialObjectLiteral); + ts.forEach(originalObjectLiteral.properties, function (property) { + var patchedProperty = tryCreatePatchingPropertyAssignment(originalObjectLiteral, tempVar, property); + if (patchedProperty) { + propertyPatches = createBinaryExpression(propertyPatches, 23, patchedProperty); + } + }); + propertyPatches = createBinaryExpression(propertyPatches, 23, tempVar); + var result = createParenthesizedExpression(propertyPatches); + return result; + } + function addCommentsToSynthesizedNode(node, leadingCommentRanges, trailingCommentRanges) { + node.leadingCommentRanges = leadingCommentRanges; + node.trailingCommentRanges = trailingCommentRanges; + } + function tryCreatePatchingPropertyAssignment(objectLiteral, tempVar, property) { + var leftHandSide = createMemberAccessForPropertyName(tempVar, property.name); + var maybeRightHandSide = tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property); + return maybeRightHandSide && createBinaryExpression(leftHandSide, 52, maybeRightHandSide); + } + function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property) { + switch (property.kind) { + case 207: + return property.initializer; + case 208: + var prefix = createIdentifier(resolver.getExpressionNamePrefix(property.name)); + return createPropertyAccessExpression(prefix, property.name); + case 130: + return createFunctionExpression(property.parameters, property.body); + case 132: + case 133: + var _a = getAllAccessorDeclarations(objectLiteral.properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; + if (firstAccessor !== property) { + return undefined; + } + var propertyDescriptor = createSynthesizedNode(150); + var descriptorProperties = []; + if (getAccessor) { + var getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); + descriptorProperties.push(getProperty); + } + if (setAccessor) { + var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpression(setAccessor.parameters, setAccessor.body)); + descriptorProperties.push(setProperty); + } + var trueExpr = createSynthesizedNode(94); + var enumerableTrue = createPropertyAssignment(createIdentifier("enumerable"), trueExpr); + descriptorProperties.push(enumerableTrue); + var configurableTrue = createPropertyAssignment(createIdentifier("configurable"), trueExpr); + descriptorProperties.push(configurableTrue); + propertyDescriptor.properties = descriptorProperties; + var objectDotDefineProperty = createPropertyAccessExpression(createIdentifier("Object"), createIdentifier("defineProperty")); + return createCallExpression(objectDotDefineProperty, createNodeArray(propertyDescriptor)); + default: + ts.Debug.fail("ObjectLiteralElement kind " + property.kind + " not accounted for."); + } + } + function createParenthesizedExpression(expression) { + var result = createSynthesizedNode(157); + result.expression = expression; + return result; + } + function createNodeArray() { + var elements = []; + for (var _i = 0; _i < arguments.length; _i++) { + elements[_i - 0] = arguments[_i]; + } + var result = elements; + result.pos = -1; + result.end = -1; + return result; + } + function createBinaryExpression(left, operator, right) { + var result = createSynthesizedNode(165); + result.operatorToken = createSynthesizedNode(operator); + result.left = left; + result.right = right; + return result; + } + function createMemberAccessForPropertyName(expression, memberName) { + if (memberName.kind === 64) { + return createPropertyAccessExpression(expression, memberName); + } + else if (memberName.kind === 8 || memberName.kind === 7) { + return createElementAccessExpression(expression, memberName); + } + else if (memberName.kind === 124) { + return createElementAccessExpression(expression, memberName.expression); + } + else { + ts.Debug.fail("Kind '" + memberName.kind + "' not accounted for."); + } + } + function createPropertyAssignment(name, initializer) { + var result = createSynthesizedNode(207); + result.name = name; + result.initializer = initializer; + return result; + } + function createFunctionExpression(parameters, body) { + var result = createSynthesizedNode(158); + result.parameters = parameters; + result.body = body; + return result; + } + function createPropertyAccessExpression(expression, name) { + var result = createSynthesizedNode(151); + result.expression = expression; + result.name = name; + return result; + } + function createElementAccessExpression(expression, argumentExpression) { + var result = createSynthesizedNode(152); + result.expression = expression; + result.argumentExpression = argumentExpression; + return result; + } + function createIdentifier(name) { + var result = createSynthesizedNode(64); + result.text = name; + return result; + } + function createCallExpression(invokedExpression, arguments) { + var result = createSynthesizedNode(153); + result.expression = invokedExpression; + result.arguments = arguments; + return result; + } + 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 === 124) { + numInitialNonComputedProperties = i; + break; + } + } + var hasComputedProperty = numInitialNonComputedProperties !== properties.length; + if (hasComputedProperty) { + emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); + return; + } + } + write("{"); + var properties = node.properties; + if (properties.length) { + emitLinePreservingList(node, properties, languageVersion >= 1, true); + } + write("}"); + } + function emitComputedPropertyName(node) { + write("["); + emit(node.expression); + write("]"); + } + function emitMethod(node) { + emit(node.name); + if (languageVersion < 2) { + write(": function "); + } + emitSignatureAndBody(node); + } + function emitPropertyAssignment(node) { + emit(node.name); + write(": "); + emit(node.initializer); + } + function emitShorthandPropertyAssignment(node) { + emit(node.name); + if (languageVersion <= 1 || resolver.getExpressionNamePrefix(node.name)) { + write(": "); + emitExpressionIdentifier(node.name); + } + } + function tryEmitConstantValue(node) { + var constantValue = resolver.getConstantValue(node); + if (constantValue !== undefined) { + write(constantValue.toString()); + if (!compilerOptions.removeComments) { + var propertyName = node.kind === 151 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + write(" /* " + propertyName + " */"); + } + return true; + } + return false; + } + function emitPropertyAccess(node) { + if (tryEmitConstantValue(node)) { + return; + } + emit(node.expression); + write("."); + emit(node.name); + } + function emitQualifiedName(node) { + emit(node.left); + write("."); + emit(node.right); + } + 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 === 169; }); + } + function skipParentheses(node) { + while (node.kind === 157 || node.kind === 156) { + node = node.expression; + } + return node; + } + function emitCallTarget(node) { + if (node.kind === 64 || node.kind === 92 || node.kind === 90) { + emit(node); + return node; + } + var temp = createAndRecordTempVariable(node); + write("("); + emit(temp); + write(" = "); + emit(node); + write(")"); + return temp; + } + function emitCallWithSpread(node) { + var target; + var expr = skipParentheses(node.expression); + if (expr.kind === 151) { + target = emitCallTarget(expr.expression); + write("."); + emit(expr.name); + } + else if (expr.kind === 152) { + target = emitCallTarget(expr.expression); + write("["); + emit(expr.argumentExpression); + write("]"); + } + else if (expr.kind === 90) { + target = expr; + write("_super"); + } + else { + emit(node.expression); + } + write(".apply("); + if (target) { + if (target.kind === 90) { + emitThis(target); + } + else { + emit(target); + } + } + else { + write("void 0"); + } + write(", "); + emitListWithSpread(node.arguments, false, false); + write(")"); + } + function emitCallExpression(node) { + if (languageVersion < 2 && hasSpreadElement(node.arguments)) { + emitCallWithSpread(node); + return; + } + var superCall = false; + if (node.expression.kind === 90) { + write("_super"); + superCall = true; + } + else { + emit(node.expression); + superCall = node.expression.kind === 151 && node.expression.expression.kind === 90; + } + if (superCall) { + 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 "); + emit(node.expression); + if (node.arguments) { + write("("); + emitCommaList(node.arguments); + write(")"); + } + } + function emitTaggedTemplateExpression(node) { + emit(node.tag); + write(" "); + emit(node.template); + } + function emitParenExpression(node) { + if (node.expression.kind === 156) { + var operand = node.expression.expression; + while (operand.kind == 156) { + operand = operand.expression; + } + if (operand.kind !== 163 && + operand.kind !== 162 && + operand.kind !== 161 && + operand.kind !== 160 && + operand.kind !== 164 && + operand.kind !== 154 && + !(operand.kind === 153 && node.parent.kind === 154) && + !(operand.kind === 158 && node.parent.kind === 153)) { + emit(operand); + return; + } + } + write("("); + emit(node.expression); + write(")"); + } + function emitDeleteExpression(node) { + write(ts.tokenToString(73)); + write(" "); + emit(node.expression); + } + function emitVoidExpression(node) { + write(ts.tokenToString(98)); + write(" "); + emit(node.expression); + } + function emitTypeOfExpression(node) { + write(ts.tokenToString(96)); + write(" "); + emit(node.expression); + } + function emitPrefixUnaryExpression(node) { + write(ts.tokenToString(node.operator)); + if (node.operand.kind === 163) { + var operand = node.operand; + if (node.operator === 33 && (operand.operator === 33 || operand.operator === 38)) { + write(" "); + } + else if (node.operator === 34 && (operand.operator === 34 || operand.operator === 39)) { + write(" "); + } + } + emit(node.operand); + } + function emitPostfixUnaryExpression(node) { + emit(node.operand); + write(ts.tokenToString(node.operator)); + } + function emitBinaryExpression(node) { + if (languageVersion < 2 && node.operatorToken.kind === 52 && + (node.left.kind === 150 || node.left.kind === 149)) { + emitDestructuring(node); + } + else { + emit(node.left); + if (node.operatorToken.kind !== 23) { + write(" "); + } + write(ts.tokenToString(node.operatorToken.kind)); + var operatorEnd = ts.getLineAndCharacterOfPosition(currentSourceFile, node.operatorToken.end); + var rightStart = ts.getLineAndCharacterOfPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.right.pos)); + var onDifferentLine = operatorEnd.line !== rightStart.line; + if (onDifferentLine) { + var exprStart = ts.getLineAndCharacterOfPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + var firstCharOfExpr = getFirstNonWhitespaceCharacterIndexOnLine(exprStart.line); + var shouldIndent = rightStart.character > firstCharOfExpr; + if (shouldIndent) { + increaseIndent(); + } + writeLine(); + } + else { + write(" "); + } + emit(node.right); + if (shouldIndent) { + decreaseIndent(); + } + } + } + function getFirstNonWhitespaceCharacterIndexOnLine(line) { + var lineStart = ts.getLineStarts(currentSourceFile)[line]; + var text = currentSourceFile.text; + for (var i = lineStart; i < text.length; i++) { + var ch = text.charCodeAt(i); + if (!ts.isWhiteSpace(text.charCodeAt(i)) || ts.isLineBreak(ch)) { + break; + } + } + return i - lineStart; + } + function emitConditionalExpression(node) { + emit(node.condition); + write(" ? "); + emit(node.whenTrue); + write(" : "); + emit(node.whenFalse); + } + function isSingleLineEmptyBlock(node) { + if (node && node.kind === 172) { + var block = node; + return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); + } + } + function emitBlock(node) { + if (isSingleLineEmptyBlock(node)) { + emitToken(14, node.pos); + write(" "); + emitToken(15, node.statements.end); + return; + } + emitToken(14, node.pos); + increaseIndent(); + scopeEmitStart(node.parent); + if (node.kind === 199) { + ts.Debug.assert(node.parent.kind === 198); + emitCaptureThisForNodeIfNecessary(node.parent); + } + emitLines(node.statements); + if (node.kind === 199) { + emitTempDeclarations(true); + } + decreaseIndent(); + writeLine(); + emitToken(15, node.statements.end); + scopeEmitEnd(); + } + function emitEmbeddedStatement(node) { + if (node.kind === 172) { + write(" "); + emit(node); + } + else { + increaseIndent(); + writeLine(); + emit(node); + decreaseIndent(); + } + } + function emitExpressionStatement(node) { + emitParenthesized(node.expression, node.expression.kind === 159); + write(";"); + } + function emitIfStatement(node) { + var endPos = emitToken(83, node.pos); + write(" "); + endPos = emitToken(16, endPos); + emit(node.expression); + emitToken(17, node.expression.end); + emitEmbeddedStatement(node.thenStatement); + if (node.elseStatement) { + writeLine(); + emitToken(75, node.thenStatement.end); + if (node.elseStatement.kind === 176) { + write(" "); + emit(node.elseStatement); + } + else { + emitEmbeddedStatement(node.elseStatement); + } + } + } + function emitDoStatement(node) { + write("do"); + emitEmbeddedStatement(node.statement); + if (node.statement.kind === 172) { + write(" "); + } + else { + writeLine(); + } + write("while ("); + emit(node.expression); + write(");"); + } + function emitWhileStatement(node) { + write("while ("); + emit(node.expression); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitForStatement(node) { + var endPos = emitToken(81, node.pos); + write(" "); + endPos = emitToken(16, endPos); + if (node.initializer && node.initializer.kind === 192) { + var variableDeclarationList = node.initializer; + var declarations = variableDeclarationList.declarations; + if (declarations[0] && ts.isLet(declarations[0])) { + emitToken(103, endPos); + } + else if (declarations[0] && ts.isConst(declarations[0])) { + emitToken(69, endPos); + } + else { + emitToken(97, endPos); + } + write(" "); + emitCommaList(variableDeclarationList.declarations); + } + else if (node.initializer) { + emit(node.initializer); + } + write(";"); + emitOptional(" ", node.condition); + write(";"); + emitOptional(" ", node.iterator); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitForInOrForOfStatement(node) { + var endPos = emitToken(81, node.pos); + write(" "); + endPos = emitToken(16, endPos); + if (node.initializer.kind === 192) { + var variableDeclarationList = node.initializer; + if (variableDeclarationList.declarations.length >= 1) { + var decl = variableDeclarationList.declarations[0]; + if (ts.isLet(decl)) { + emitToken(103, endPos); + } + else { + emitToken(97, endPos); + } + write(" "); + emit(decl); + } + } + else { + emit(node.initializer); + } + if (node.kind === 180) { + write(" in "); + } + else { + write(" of "); + } + emit(node.expression); + emitToken(17, node.expression.end); + emitEmbeddedStatement(node.statement); + } + function emitBreakOrContinueStatement(node) { + emitToken(node.kind === 183 ? 65 : 70, node.pos); + emitOptional(" ", node.label); + write(";"); + } + function emitReturnStatement(node) { + emitToken(89, node.pos); + emitOptional(" ", node.expression); + write(";"); + } + function emitWithStatement(node) { + write("with ("); + emit(node.expression); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitSwitchStatement(node) { + var endPos = emitToken(91, node.pos); + write(" "); + emitToken(16, endPos); + emit(node.expression); + endPos = emitToken(17, node.expression.end); + write(" "); + emitToken(14, endPos); + increaseIndent(); + emitLines(node.clauses); + decreaseIndent(); + writeLine(); + emitToken(15, node.clauses.end); + } + function nodeStartPositionsAreOnSameLine(node1, node2) { + return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === + getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + } + function nodeEndPositionsAreOnSameLine(node1, node2) { + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, node2.end); + } + function nodeEndIsOnSameLineAsNodeStart(node1, node2) { + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + } + function emitCaseOrDefaultClause(node) { + if (node.kind === 203) { + 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(67, node.pos); + write(" "); + emitToken(16, endPos); + emit(node.name); + emitToken(17, node.name.end); + write(" "); + emitBlock(node.block); + } + function emitDebuggerStatement(node) { + emitToken(71, node.pos); + write(";"); + } + function emitLabelledStatement(node) { + emit(node.label); + write(": "); + emit(node.statement); + } + function getContainingModule(node) { + do { + node = node.parent; + } while (node && node.kind !== 198); + return node; + } + function emitModuleMemberName(node) { + emitStart(node.name); + if (ts.getCombinedNodeFlags(node) & 1) { + var container = getContainingModule(node); + write(container ? resolver.getLocalNameOfContainer(container) : "exports"); + write("."); + } + emitNode(node.name); + emitEnd(node.name); + } + function emitDestructuring(root, value) { + var emitCount = 0; + var isDeclaration = (root.kind === 191 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 126; + if (root.kind === 165) { + emitAssignmentExpression(root); + } + else { + emitBindingElement(root, value); + } + function emitAssignment(name, value) { + if (emitCount++) { + write(", "); + } + if (name.parent && (name.parent.kind === 191 || name.parent.kind === 148)) { + emitModuleMemberName(name.parent); + } + else { + emit(name); + } + write(" = "); + emit(value); + } + function ensureIdentifier(expr) { + if (expr.kind !== 64) { + var identifier = createTempVariable(root); + if (!isDeclaration) { + recordTempDeclaration(identifier); + } + emitAssignment(identifier, expr); + expr = identifier; + } + return expr; + } + function createVoidZero() { + var zero = ts.createNode(7); + zero.text = "0"; + var result = ts.createNode(162); + result.expression = zero; + return result; + } + function createDefaultValueCheck(value, defaultValue) { + value = ensureIdentifier(value); + var equals = ts.createNode(165); + equals.left = value; + equals.operatorToken = ts.createNode(30); + equals.right = createVoidZero(); + var cond = ts.createNode(166); + cond.condition = equals; + cond.whenTrue = defaultValue; + cond.whenFalse = value; + return cond; + } + function createNumericLiteral(value) { + var node = ts.createNode(7); + node.text = "" + value; + return node; + } + function parenthesizeForAccess(expr) { + if (expr.kind === 64 || expr.kind === 151 || expr.kind === 152) { + return expr; + } + var node = ts.createNode(157); + node.expression = expr; + return node; + } + function createPropertyAccess(object, propName) { + if (propName.kind !== 64) { + return createElementAccess(object, propName); + } + var node = ts.createNode(151); + node.expression = parenthesizeForAccess(object); + node.name = propName; + return node; + } + function createElementAccess(object, index) { + var node = ts.createNode(152); + node.expression = parenthesizeForAccess(object); + node.argumentExpression = index; + return node; + } + function emitObjectLiteralAssignment(target, value) { + var properties = target.properties; + if (properties.length !== 1) { + value = ensureIdentifier(value); + } + for (var i = 0; i < properties.length; i++) { + var p = properties[i]; + if (p.kind === 207 || p.kind === 208) { + var propName = (p.name); + emitDestructuringAssignment(p.initializer || propName, createPropertyAccess(value, propName)); + } + } + } + function emitArrayLiteralAssignment(target, value) { + var elements = target.elements; + if (elements.length !== 1) { + value = ensureIdentifier(value); + } + for (var i = 0; i < elements.length; i++) { + var e = elements[i]; + if (e.kind !== 170) { + if (e.kind !== 169) { + emitDestructuringAssignment(e, createElementAccess(value, createNumericLiteral(i))); + } + else { + if (i === elements.length - 1) { + value = ensureIdentifier(value); + emitAssignment(e.expression, value); + write(".slice(" + i + ")"); + } + } + } + } + } + function emitDestructuringAssignment(target, value) { + if (target.kind === 165 && target.operatorToken.kind === 52) { + value = createDefaultValueCheck(value, target.right); + target = target.left; + } + if (target.kind === 150) { + emitObjectLiteralAssignment(target, value); + } + else if (target.kind === 149) { + emitArrayLiteralAssignment(target, value); + } + else { + emitAssignment(target, value); + } + } + function emitAssignmentExpression(root) { + var target = root.left; + var value = root.right; + if (root.parent.kind === 175) { + emitDestructuringAssignment(target, value); + } + else { + if (root.parent.kind !== 157) { + write("("); + } + value = ensureIdentifier(value); + emitDestructuringAssignment(target, value); + write(", "); + emit(value); + if (root.parent.kind !== 157) { + 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; + if (elements.length !== 1) { + value = ensureIdentifier(value); + } + for (var i = 0; i < elements.length; i++) { + var element = elements[i]; + if (pattern.kind === 146) { + var propName = element.propertyName || element.name; + emitBindingElement(element, createPropertyAccess(value, propName)); + } + else if (element.kind !== 170) { + if (!element.dotDotDotToken) { + emitBindingElement(element, createElementAccess(value, createNumericLiteral(i))); + } + else { + if (i === elements.length - 1) { + value = ensureIdentifier(value); + emitAssignment(element.name, value); + write(".slice(" + i + ")"); + } + } + } + } + } + else { + emitAssignment(target.name, value); + } + } + } + function emitVariableDeclaration(node) { + if (ts.isBindingPattern(node.name)) { + if (languageVersion < 2) { + emitDestructuring(node); + } + else { + emit(node.name); + emitOptional(" = ", node.initializer); + } + } + else { + emitModuleMemberName(node); + emitOptional(" = ", node.initializer); + } + } + function emitVariableStatement(node) { + if (!(node.flags & 1)) { + if (ts.isLet(node.declarationList)) { + write("let "); + } + else if (ts.isConst(node.declarationList)) { + write("const "); + } + else { + write("var "); + } + } + emitCommaList(node.declarationList.declarations); + write(";"); + } + function emitParameter(node) { + if (languageVersion < 2) { + if (ts.isBindingPattern(node.name)) { + var name = createTempVariable(node); + if (!tempParameters) { + tempParameters = []; + } + tempParameters.push(name); + emit(name); + } + 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 (p) { + if (ts.isBindingPattern(p.name)) { + writeLine(); + write("var "); + emitDestructuring(p, tempParameters[tempIndex]); + write(";"); + tempIndex++; + } + else if (p.initializer) { + writeLine(); + emitStart(p); + write("if ("); + emitNode(p.name); + write(" === void 0)"); + emitEnd(p); + write(" { "); + emitStart(p); + emitNode(p.name); + write(" = "); + emitNode(p.initializer); + emitEnd(p); + write("; }"); + } + }); + } + } + function emitRestParameter(node) { + if (languageVersion < 2 && ts.hasRestParameters(node)) { + var restIndex = node.parameters.length - 1; + var restParam = node.parameters[restIndex]; + var tempName = createTempVariable(node, true).text; + writeLine(); + emitLeadingComments(restParam); + emitStart(restParam); + write("var "); + emitNode(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); + emitNode(restParam.name); + write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); + emitEnd(restParam); + decreaseIndent(); + writeLine(); + write("}"); + } + } + function emitAccessor(node) { + write(node.kind === 132 ? "get " : "set "); + emit(node.name); + emitSignatureAndBody(node); + } + function shouldEmitAsArrowFunction(node) { + return node.kind === 159 && languageVersion >= 2; + } + function emitFunctionDeclaration(node) { + if (ts.nodeIsMissing(node.body)) { + return emitPinnedOrTripleSlashComments(node); + } + if (node.kind !== 130 && node.kind !== 129) { + emitLeadingComments(node); + } + if (!shouldEmitAsArrowFunction(node)) { + write("function "); + } + if (node.kind === 193 || (node.kind === 158 && node.name)) { + emit(node.name); + } + emitSignatureAndBody(node); + if (node.kind !== 130 && node.kind !== 129) { + 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.hasRestParameters(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 emitSignatureAndBody(node) { + var saveTempCount = tempCount; + var saveTempVariables = tempVariables; + var saveTempParameters = tempParameters; + tempCount = 0; + tempVariables = undefined; + tempParameters = undefined; + if (shouldEmitAsArrowFunction(node)) { + emitSignatureParametersForArrow(node); + write(" =>"); + } + else { + emitSignatureParameters(node); + } + if (isSingleLineEmptyBlock(node.body) || !node.body) { + write(" { }"); + } + else if (node.body.kind === 172) { + emitBlockFunctionBody(node, node.body); + } + else { + emitExpressionFunctionBody(node, node.body); + } + if (node.flags & 1) { + writeLine(); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emit(node.name); + emitEnd(node); + write(";"); + } + tempCount = saveTempCount; + tempVariables = saveTempVariables; + tempParameters = saveTempParameters; + } + function emitFunctionBodyPreamble(node) { + emitCaptureThisForNodeIfNecessary(node); + emitDefaultValueAssignments(node); + emitRestParameter(node); + } + function emitExpressionFunctionBody(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 "); + emitNode(body, true); + emitEnd(body); + write(";"); + emitTempDeclarations(false); + write(" "); + } + else { + increaseIndent(); + writeLine(); + emitLeadingComments(node.body); + write("return "); + emit(node.body, true); + write(";"); + emitTrailingComments(node.body); + emitTempDeclarations(true); + decreaseIndent(); + writeLine(); + } + emitStart(node.body); + write("}"); + emitEnd(node.body); + scopeEmitEnd(); + } + function emitBlockFunctionBody(node, body) { + write(" {"); + scopeEmitStart(node); + var outPos = writer.getTextPos(); + increaseIndent(); + emitDetachedComments(body.statements); + var startIndex = emitDirectivePrologues(body.statements, true); + emitFunctionBodyPreamble(node); + decreaseIndent(); + var preambleEmitted = writer.getTextPos() !== outPos; + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var i = 0, n = body.statements.length; i < n; i++) { + write(" "); + emit(body.statements[i]); + } + emitTempDeclarations(false); + write(" "); + emitLeadingCommentsOfPosition(body.statements.end); + } + else { + increaseIndent(); + emitLinesStartingAt(body.statements, startIndex); + emitTempDeclarations(true); + writeLine(); + emitLeadingCommentsOfPosition(body.statements.end); + decreaseIndent(); + } + emitToken(15, body.statements.end); + scopeEmitEnd(); + } + function findInitialSuperCall(ctor) { + if (ctor.body) { + var statement = ctor.body.statements[0]; + if (statement && statement.kind === 175) { + var expr = statement.expression; + if (expr && expr.kind === 153) { + var func = expr.expression; + if (func && func.kind === 90) { + return statement; + } + } + } + } + } + function emitParameterPropertyAssignments(node) { + ts.forEach(node.parameters, function (param) { + if (param.flags & 112) { + writeLine(); + emitStart(param); + emitStart(param.name); + write("this."); + emitNode(param.name); + emitEnd(param.name); + write(" = "); + emit(param.name); + write(";"); + emitEnd(param); + } + }); + } + function emitMemberAccessForPropertyName(memberName) { + if (memberName.kind === 8 || memberName.kind === 7) { + write("["); + emitNode(memberName); + write("]"); + } + else if (memberName.kind === 124) { + emitComputedPropertyName(memberName); + } + else { + write("."); + emitNode(memberName); + } + } + function emitMemberAssignments(node, staticFlag) { + ts.forEach(node.members, function (member) { + if (member.kind === 128 && (member.flags & 128) === staticFlag && member.initializer) { + writeLine(); + emitLeadingComments(member); + emitStart(member); + emitStart(member.name); + if (staticFlag) { + emitNode(node.name); + } + else { + write("this"); + } + emitMemberAccessForPropertyName(member.name); + emitEnd(member.name); + write(" = "); + emit(member.initializer); + write(";"); + emitEnd(member); + emitTrailingComments(member); + } + }); + } + function emitMemberFunctions(node) { + ts.forEach(node.members, function (member) { + if (member.kind === 130 || node.kind === 129) { + if (!member.body) { + return emitPinnedOrTripleSlashComments(member); + } + writeLine(); + emitLeadingComments(member); + emitStart(member); + emitStart(member.name); + emitNode(node.name); + if (!(member.flags & 128)) { + write(".prototype"); + } + emitMemberAccessForPropertyName(member.name); + emitEnd(member.name); + write(" = "); + emitStart(member); + emitFunctionDeclaration(member); + emitEnd(member); + emitEnd(member); + write(";"); + emitTrailingComments(member); + } + else if (member.kind === 132 || member.kind === 133) { + var accessors = getAllAccessorDeclarations(node.members, member); + if (member === accessors.firstAccessor) { + writeLine(); + emitStart(member); + write("Object.defineProperty("); + emitStart(member.name); + emitNode(node.name); + if (!(member.flags & 128)) { + write(".prototype"); + } + 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 emitClassDeclaration(node) { + write("var "); + emit(node.name); + write(" = (function ("); + var baseTypeNode = ts.getClassBaseTypeNode(node); + if (baseTypeNode) { + write("_super"); + } + write(") {"); + increaseIndent(); + scopeEmitStart(node); + if (baseTypeNode) { + writeLine(); + emitStart(baseTypeNode); + write("__extends("); + emit(node.name); + write(", _super);"); + emitEnd(baseTypeNode); + } + writeLine(); + emitConstructorOfClass(); + emitMemberFunctions(node); + emitMemberAssignments(node, 128); + writeLine(); + function emitClassReturnStatement() { + write("return "); + emitNode(node.name); + } + emitToken(15, node.members.end, emitClassReturnStatement); + write(";"); + decreaseIndent(); + writeLine(); + emitToken(15, node.members.end); + scopeEmitEnd(); + emitStart(node); + write(")("); + if (baseTypeNode) { + emit(baseTypeNode.typeName); + } + write(");"); + emitEnd(node); + if (node.flags & 1) { + writeLine(); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emit(node.name); + emitEnd(node); + write(";"); + } + function emitConstructorOfClass() { + var saveTempCount = tempCount; + var saveTempVariables = tempVariables; + var saveTempParameters = tempParameters; + tempCount = 0; + tempVariables = undefined; + tempParameters = undefined; + ts.forEach(node.members, function (member) { + if (member.kind === 131 && !member.body) { + emitPinnedOrTripleSlashComments(member); + } + }); + var ctor = getFirstConstructorWithBody(node); + if (ctor) { + emitLeadingComments(ctor); + } + emitStart(ctor || node); + write("function "); + emit(node.name); + emitSignatureParameters(ctor); + write(" {"); + scopeEmitStart(node, "constructor"); + increaseIndent(); + if (ctor) { + emitDetachedComments(ctor.body.statements); + } + emitCaptureThisForNodeIfNecessary(node); + if (ctor) { + emitDefaultValueAssignments(ctor); + emitRestParameter(ctor); + if (baseTypeNode) { + var superCall = findInitialSuperCall(ctor); + if (superCall) { + writeLine(); + emit(superCall); + } + } + emitParameterPropertyAssignments(ctor); + } + else { + if (baseTypeNode) { + writeLine(); + emitStart(baseTypeNode); + write("_super.apply(this, arguments);"); + emitEnd(baseTypeNode); + } + } + emitMemberAssignments(node, 0); + if (ctor) { + var statements = ctor.body.statements; + if (superCall) + statements = statements.slice(1); + emitLines(statements); + } + emitTempDeclarations(true); + writeLine(); + if (ctor) { + emitLeadingCommentsOfPosition(ctor.body.statements.end); + } + decreaseIndent(); + emitToken(15, ctor ? ctor.body.statements.end : node.members.end); + scopeEmitEnd(); + emitEnd(ctor || node); + if (ctor) { + emitTrailingComments(ctor); + } + tempCount = saveTempCount; + tempVariables = saveTempVariables; + tempParameters = saveTempParameters; + } + } + function emitInterfaceDeclaration(node) { + emitPinnedOrTripleSlashComments(node); + } + function shouldEmitEnumDeclaration(node) { + var isConstEnum = ts.isConst(node); + return !isConstEnum || compilerOptions.preserveConstEnums; + } + function emitEnumDeclaration(node) { + if (!shouldEmitEnumDeclaration(node)) { + return; + } + if (!(node.flags & 1)) { + emitStart(node); + write("var "); + emit(node.name); + emitEnd(node); + write(";"); + } + writeLine(); + emitStart(node); + write("(function ("); + emitStart(node.name); + write(resolver.getLocalNameOfContainer(node)); + emitEnd(node.name); + write(") {"); + increaseIndent(); + scopeEmitStart(node); + emitLines(node.members); + decreaseIndent(); + writeLine(); + emitToken(15, node.members.end); + scopeEmitEnd(); + write(")("); + emitModuleMemberName(node); + write(" || ("); + emitModuleMemberName(node); + write(" = {}));"); + emitEnd(node); + if (node.flags & 1) { + writeLine(); + emitStart(node); + write("var "); + emit(node.name); + write(" = "); + emitModuleMemberName(node); + emitEnd(node); + write(";"); + } + } + function emitEnumMember(node) { + var enumParent = node.parent; + emitStart(node); + write(resolver.getLocalNameOfContainer(enumParent)); + write("["); + write(resolver.getLocalNameOfContainer(enumParent)); + write("["); + emitExpressionForPropertyName(node.name); + write("] = "); + writeEnumMemberDeclarationValue(node); + write("] = "); + emitExpressionForPropertyName(node.name); + emitEnd(node); + write(";"); + } + function writeEnumMemberDeclarationValue(member) { + if (!member.initializer || ts.isConst(member.parent)) { + var value = resolver.getConstantValue(member); + if (value !== undefined) { + write(value.toString()); + return; + } + } + if (member.initializer) { + emit(member.initializer); + } + else { + write("undefined"); + } + } + function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { + if (moduleDeclaration.body.kind === 198) { + var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); + return recursiveInnerModule || moduleDeclaration.body; + } + } + function shouldEmitModuleDeclaration(node) { + return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums); + } + function emitModuleDeclaration(node) { + var shouldEmit = shouldEmitModuleDeclaration(node); + if (!shouldEmit) { + return emitPinnedOrTripleSlashComments(node); + } + emitStart(node); + write("var "); + emit(node.name); + write(";"); + emitEnd(node); + writeLine(); + emitStart(node); + write("(function ("); + emitStart(node.name); + write(resolver.getLocalNameOfContainer(node)); + emitEnd(node.name); + write(") "); + if (node.body.kind === 199) { + var saveTempCount = tempCount; + var saveTempVariables = tempVariables; + tempCount = 0; + tempVariables = undefined; + emit(node.body); + tempCount = saveTempCount; + tempVariables = saveTempVariables; + } + else { + write("{"); + increaseIndent(); + scopeEmitStart(node); + emitCaptureThisForNodeIfNecessary(node); + writeLine(); + emit(node.body); + decreaseIndent(); + writeLine(); + var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; + emitToken(15, moduleBlock.statements.end); + scopeEmitEnd(); + } + write(")("); + if (node.flags & 1) { + emit(node.name); + write(" = "); + } + emitModuleMemberName(node); + write(" || ("); + emitModuleMemberName(node); + write(" = {}));"); + emitEnd(node); + } + function emitImportDeclaration(node) { + var emitImportDeclaration = resolver.isReferencedImportDeclaration(node); + if (!emitImportDeclaration) { + emitImportDeclaration = !ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportWithEntityName(node); + } + if (emitImportDeclaration) { + if (ts.isExternalModuleImportDeclaration(node) && node.parent.kind === 210 && compilerOptions.module === 2) { + if (node.flags & 1) { + writeLine(); + emitLeadingComments(node); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emit(node.name); + write(";"); + emitEnd(node); + emitTrailingComments(node); + } + } + else { + writeLine(); + emitLeadingComments(node); + emitStart(node); + if (!(node.flags & 1)) + write("var "); + emitModuleMemberName(node); + write(" = "); + if (ts.isInternalModuleImportDeclaration(node)) { + emit(node.moduleReference); + } + else { + var literal = ts.getExternalModuleImportDeclarationExpression(node); + write("require("); + emitStart(literal); + emitLiteral(literal); + emitEnd(literal); + emitToken(17, literal.end); + } + write(";"); + emitEnd(node); + emitTrailingComments(node); + } + } + } + function getExternalImportDeclarations(node) { + var result = []; + ts.forEach(node.statements, function (statement) { + if (ts.isExternalModuleImportDeclaration(statement) && resolver.isReferencedImportDeclaration(statement)) { + result.push(statement); + } + }); + return result; + } + function getFirstExportAssignment(sourceFile) { + return ts.forEach(sourceFile.statements, function (node) { + if (node.kind === 201) { + return node; + } + }); + } + function sortAMDModules(amdModules) { + return amdModules.sort(function (moduleA, moduleB) { + if (moduleA.name === moduleB.name) { + return 0; + } + else if (!moduleA.name) { + return 1; + } + else { + return -1; + } + }); + } + function emitAMDModule(node, startIndex) { + var imports = getExternalImportDeclarations(node); + writeLine(); + write("define("); + sortAMDModules(node.amdDependencies); + if (node.amdModuleName) { + write("\"" + node.amdModuleName + "\", "); + } + write("[\"require\", \"exports\""); + ts.forEach(imports, function (imp) { + write(", "); + emitLiteral(ts.getExternalModuleImportDeclarationExpression(imp)); + }); + ts.forEach(node.amdDependencies, function (amdDependency) { + var text = "\"" + amdDependency.path + "\""; + write(", "); + write(text); + }); + write("], function (require, exports"); + ts.forEach(imports, function (imp) { + write(", "); + emit(imp.name); + }); + ts.forEach(node.amdDependencies, function (amdDependency) { + if (amdDependency.name) { + write(", "); + write(amdDependency.name); + } + }); + write(") {"); + increaseIndent(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + var exportName = resolver.getExportAssignmentName(node); + if (exportName) { + writeLine(); + var exportAssignment = getFirstExportAssignment(node); + emitStart(exportAssignment); + write("return "); + emitStart(exportAssignment.exportName); + write(exportName); + emitEnd(exportAssignment.exportName); + write(";"); + emitEnd(exportAssignment); + } + decreaseIndent(); + writeLine(); + write("});"); + } + function emitCommonJSModule(node, startIndex) { + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + var exportName = resolver.getExportAssignmentName(node); + if (exportName) { + writeLine(); + var exportAssignment = getFirstExportAssignment(node); + emitStart(exportAssignment); + write("module.exports = "); + emitStart(exportAssignment.exportName); + write(exportName); + emitEnd(exportAssignment.exportName); + write(";"); + emitEnd(exportAssignment); + } + } + 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 emitSourceFile(node) { + currentSourceFile = node; + writeLine(); + emitDetachedComments(node); + var startIndex = emitDirectivePrologues(node.statements, false); + if (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8) { + writeLine(); + write("var __extends = this.__extends || function (d, b) {"); + increaseIndent(); + writeLine(); + write("for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];"); + writeLine(); + write("function __() { this.constructor = d; }"); + writeLine(); + write("__.prototype = b.prototype;"); + writeLine(); + write("d.prototype = new __();"); + decreaseIndent(); + writeLine(); + write("};"); + extendsEmitted = true; + } + if (ts.isExternalModule(node)) { + if (compilerOptions.module === 2) { + emitAMDModule(node, startIndex); + } + else { + emitCommonJSModule(node, startIndex); + } + } + else { + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + } + emitLeadingComments(node.endOfFileToken); + } + function emitNode(node, disableComments) { + if (!node) { + return; + } + if (node.flags & 2) { + return emitPinnedOrTripleSlashComments(node); + } + var emitComments = !disableComments && shouldEmitLeadingAndTrailingComments(node); + if (emitComments) { + emitLeadingComments(node); + } + emitJavaScriptWorker(node); + if (emitComments) { + emitTrailingComments(node); + } + } + function shouldEmitLeadingAndTrailingComments(node) { + switch (node.kind) { + case 195: + case 193: + case 200: + case 196: + case 201: + return false; + case 198: + return shouldEmitModuleDeclaration(node); + case 197: + return shouldEmitEnumDeclaration(node); + } + return true; + } + function emitJavaScriptWorker(node) { + switch (node.kind) { + case 64: + return emitIdentifier(node); + case 126: + return emitParameter(node); + case 130: + case 129: + return emitMethod(node); + case 132: + case 133: + return emitAccessor(node); + case 92: + return emitThis(node); + case 90: + return emitSuper(node); + case 88: + return write("null"); + case 94: + return write("true"); + case 79: + return write("false"); + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + return emitLiteral(node); + case 167: + return emitTemplateExpression(node); + case 171: + return emitTemplateSpan(node); + case 123: + return emitQualifiedName(node); + case 146: + return emitObjectBindingPattern(node); + case 147: + return emitArrayBindingPattern(node); + case 148: + return emitBindingElement(node); + case 149: + return emitArrayLiteral(node); + case 150: + return emitObjectLiteral(node); + case 207: + return emitPropertyAssignment(node); + case 208: + return emitShorthandPropertyAssignment(node); + case 124: + return emitComputedPropertyName(node); + case 151: + return emitPropertyAccess(node); + case 152: + return emitIndexedAccess(node); + case 153: + return emitCallExpression(node); + case 154: + return emitNewExpression(node); + case 155: + return emitTaggedTemplateExpression(node); + case 156: + return emit(node.expression); + case 157: + return emitParenExpression(node); + case 193: + case 158: + case 159: + return emitFunctionDeclaration(node); + case 160: + return emitDeleteExpression(node); + case 161: + return emitTypeOfExpression(node); + case 162: + return emitVoidExpression(node); + case 163: + return emitPrefixUnaryExpression(node); + case 164: + return emitPostfixUnaryExpression(node); + case 165: + return emitBinaryExpression(node); + case 166: + return emitConditionalExpression(node); + case 169: + return emitSpreadElementExpression(node); + case 170: + return; + case 172: + case 199: + return emitBlock(node); + case 173: + return emitVariableStatement(node); + case 174: + return write(";"); + case 175: + return emitExpressionStatement(node); + case 176: + return emitIfStatement(node); + case 177: + return emitDoStatement(node); + case 178: + return emitWhileStatement(node); + case 179: + return emitForStatement(node); + case 181: + case 180: + return emitForInOrForOfStatement(node); + case 182: + case 183: + return emitBreakOrContinueStatement(node); + case 184: + return emitReturnStatement(node); + case 185: + return emitWithStatement(node); + case 186: + return emitSwitchStatement(node); + case 203: + case 204: + return emitCaseOrDefaultClause(node); + case 187: + return emitLabelledStatement(node); + case 188: + return emitThrowStatement(node); + case 189: + return emitTryStatement(node); + case 206: + return emitCatchClause(node); + case 190: + return emitDebuggerStatement(node); + case 191: + return emitVariableDeclaration(node); + case 194: + return emitClassDeclaration(node); + case 195: + return emitInterfaceDeclaration(node); + case 197: + return emitEnumDeclaration(node); + case 209: + return emitEnumMember(node); + case 198: + return emitModuleDeclaration(node); + case 200: + return emitImportDeclaration(node); + case 210: + return emitSourceFile(node); + } + } + function hasDetachedComments(pos) { + return detachedCommentsInfo !== undefined && detachedCommentsInfo[detachedCommentsInfo.length - 1].nodePos === pos; + } + function getLeadingCommentsWithoutDetachedComments() { + var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, detachedCommentsInfo[detachedCommentsInfo.length - 1].detachedCommentEndPos); + if (detachedCommentsInfo.length - 1) { + detachedCommentsInfo.pop(); + } + else { + detachedCommentsInfo = undefined; + } + return leadingComments; + } + function getLeadingCommentsToEmit(node) { + if (node.parent) { + if (node.parent.kind === 210 || node.pos !== node.parent.pos) { + var leadingComments; + if (hasDetachedComments(node.pos)) { + leadingComments = getLeadingCommentsWithoutDetachedComments(); + } + else { + leadingComments = ts.getLeadingCommentRangesOfNode(node, currentSourceFile); + } + return leadingComments; + } + } + } + function emitLeadingDeclarationComments(node) { + var leadingComments = getLeadingCommentsToEmit(node); + emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); + } + function emitTrailingDeclarationComments(node) { + if (node.parent) { + if (node.parent.kind === 210 || node.end !== node.parent.end) { + var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, node.end); + emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); + } + } + } + function emitLeadingCommentsOfLocalPosition(pos) { + var leadingComments; + if (hasDetachedComments(pos)) { + leadingComments = getLeadingCommentsWithoutDetachedComments(); + } + else { + leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); + } + emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); + emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); + } + function emitDetachedCommentsAtPosition(node) { + var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + if (leadingComments) { + var detachedComments = []; + var lastComment; + ts.forEach(leadingComments, function (comment) { + if (lastComment) { + var lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastComment.end); + var commentLine = getLineOfLocalPosition(currentSourceFile, comment.pos); + if (commentLine >= lastCommentLine + 2) { + return detachedComments; + } + } + detachedComments.push(comment); + lastComment = comment; + }); + if (detachedComments.length) { + var lastCommentLine = getLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end); + var nodeLine = getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { + emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); + var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; + if (detachedCommentsInfo) { + detachedCommentsInfo.push(currentDetachedCommentInfo); + } + else { + detachedCommentsInfo = [currentDetachedCommentInfo]; + } + } + } + } + } + function emitPinnedOrTripleSlashCommentsOfNode(node) { + var pinnedComments = ts.filter(getLeadingCommentsToEmit(node), isPinnedOrTripleSlashComment); + function isPinnedOrTripleSlashComment(comment) { + if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { + return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; + } + else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && + comment.pos + 2 < comment.end && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && + currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { + return true; + } + } + emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, pinnedComments); + emitComments(currentSourceFile, writer, pinnedComments, true, newLine, writeComment); + } + } + function writeDeclarationFile(jsFilePath, sourceFile) { + var emitDeclarationResult = emitDeclarations(host, resolver, diagnostics, jsFilePath, sourceFile); + if (!emitDeclarationResult.reportedDeclarationError) { + var declarationOutput = emitDeclarationResult.referencePathsOutput; + var appliedSyncOutputPos = 0; + ts.forEach(emitDeclarationResult.aliasDeclarationEmitInfo, function (aliasEmitInfo) { + if (aliasEmitInfo.asynchronousOutput) { + declarationOutput += emitDeclarationResult.synchronousDeclarationOutput.substring(appliedSyncOutputPos, aliasEmitInfo.outputPos); + declarationOutput += aliasEmitInfo.asynchronousOutput; + appliedSyncOutputPos = aliasEmitInfo.outputPos; + } + }); + declarationOutput += emitDeclarationResult.synchronousDeclarationOutput.substring(appliedSyncOutputPos); + writeFile(host, diagnostics, ts.removeFileExtension(jsFilePath) + ".d.ts", declarationOutput, compilerOptions.emitBOM); + } + } + function emitFile(jsFilePath, sourceFile) { + emitJavaScript(jsFilePath, sourceFile); + if (compilerOptions.declaration) { + writeDeclarationFile(jsFilePath, sourceFile); + } + } + } + ts.emitFiles = emitFiles; +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.emitTime = 0; + function createCompilerHost(options) { + var currentDirectory; + var existingDirectories = {}; + function getCanonicalFileName(fileName) { + return ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); + } + var unsupportedFileEncodingErrorCode = -2147024809; + function getSourceFile(fileName, languageVersion, onError) { + try { + var text = ts.sys.readFile(fileName, options.charset); + } + catch (e) { + if (onError) { + onError(e.number === unsupportedFileEncodingErrorCode ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText : e.message); + } + text = ""; + } + return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion) : undefined; + } + function writeFile(fileName, data, writeByteOrderMark, onError) { + function directoryExists(directoryPath) { + if (ts.hasProperty(existingDirectories, directoryPath)) { + return true; + } + if (ts.sys.directoryExists(directoryPath)) { + existingDirectories[directoryPath] = true; + return true; + } + return false; + } + function ensureDirectoriesExist(directoryPath) { + if (directoryPath.length > ts.getRootLength(directoryPath) && !directoryExists(directoryPath)) { + var parentDirectory = ts.getDirectoryPath(directoryPath); + ensureDirectoriesExist(parentDirectory); + ts.sys.createDirectory(directoryPath); + } + } + try { + ensureDirectoriesExist(ts.getDirectoryPath(ts.normalizePath(fileName))); + ts.sys.writeFile(fileName, data, writeByteOrderMark); + } + catch (e) { + if (onError) { + onError(e.message); + } + } + } + return { + getSourceFile: getSourceFile, + getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); }, + writeFile: writeFile, + getCurrentDirectory: function () { return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); }, + useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, + getCanonicalFileName: getCanonicalFileName, + getNewLine: function () { return ts.sys.newLine; } + }; + } + ts.createCompilerHost = createCompilerHost; + function getPreEmitDiagnostics(program) { + var diagnostics = program.getSyntacticDiagnostics().concat(program.getGlobalDiagnostics()).concat(program.getSemanticDiagnostics()); + return ts.sortAndDeduplicateDiagnostics(diagnostics); + } + ts.getPreEmitDiagnostics = getPreEmitDiagnostics; + function flattenDiagnosticMessageText(messageText, newLine) { + if (typeof messageText === "string") { + return messageText; + } + else { + var diagnosticChain = messageText; + var result = ""; + var indent = 0; + while (diagnosticChain) { + if (indent) { + result += newLine; + for (var i = 0; i < indent; i++) { + result += " "; + } + } + result += diagnosticChain.messageText; + indent++; + diagnosticChain = diagnosticChain.next; + } + return result; + } + } + ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText; + function createProgram(rootNames, options, host) { + var program; + var files = []; + var filesByName = {}; + var diagnostics = ts.createDiagnosticCollection(); + var seenNoDefaultLib = options.noLib; + var commonSourceDirectory; + host = host || createCompilerHost(options); + ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); + if (!seenNoDefaultLib) { + processRootFile(host.getDefaultLibFileName(options), true); + } + verifyCompilerOptions(); + var diagnosticsProducingTypeChecker; + var noDiagnosticsTypeChecker; + program = { + getSourceFile: getSourceFile, + getSourceFiles: function () { return files; }, + getCompilerOptions: function () { return options; }, + getSyntacticDiagnostics: getSyntacticDiagnostics, + getGlobalDiagnostics: getGlobalDiagnostics, + getSemanticDiagnostics: getSemanticDiagnostics, + getDeclarationDiagnostics: getDeclarationDiagnostics, + getTypeChecker: getTypeChecker, + getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, + getCommonSourceDirectory: function () { return commonSourceDirectory; }, + emit: emit, + getCurrentDirectory: host.getCurrentDirectory, + getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, + getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, + getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, + getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); } + }; + return program; + function getEmitHost(writeFileCallback) { + return { + getCanonicalFileName: host.getCanonicalFileName, + getCommonSourceDirectory: program.getCommonSourceDirectory, + getCompilerOptions: program.getCompilerOptions, + getCurrentDirectory: host.getCurrentDirectory, + getNewLine: host.getNewLine, + getSourceFile: program.getSourceFile, + getSourceFiles: program.getSourceFiles, + writeFile: writeFileCallback || host.writeFile + }; + } + function getDiagnosticsProducingTypeChecker() { + return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, true)); + } + function getTypeChecker() { + return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, false)); + } + function getDeclarationDiagnostics(targetSourceFile) { + var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(targetSourceFile); + return ts.getDeclarationDiagnostics(getEmitHost(), resolver, targetSourceFile); + } + function emit(sourceFile, writeFileCallback) { + if (options.noEmitOnError && getPreEmitDiagnostics(this).length > 0) { + return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; + } + var start = new Date().getTime(); + var emitResult = ts.emitFiles(getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile), getEmitHost(writeFileCallback), sourceFile); + ts.emitTime += new Date().getTime() - start; + return emitResult; + } + function getSourceFile(fileName) { + fileName = host.getCanonicalFileName(fileName); + return ts.hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined; + } + function getDiagnosticsHelper(sourceFile, getDiagnostics) { + if (sourceFile) { + return getDiagnostics(sourceFile); + } + var allDiagnostics = []; + ts.forEach(program.getSourceFiles(), function (sourceFile) { + ts.addRange(allDiagnostics, getDiagnostics(sourceFile)); + }); + return ts.sortAndDeduplicateDiagnostics(allDiagnostics); + } + function getSyntacticDiagnostics(sourceFile) { + return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile); + } + function getSemanticDiagnostics(sourceFile) { + return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile); + } + function getSyntacticDiagnosticsForFile(sourceFile) { + return sourceFile.parseDiagnostics; + } + function getSemanticDiagnosticsForFile(sourceFile) { + var typeChecker = getDiagnosticsProducingTypeChecker(); + ts.Debug.assert(!!sourceFile.bindDiagnostics); + var bindDiagnostics = sourceFile.bindDiagnostics; + var checkDiagnostics = typeChecker.getDiagnostics(sourceFile); + var programDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName); + return bindDiagnostics.concat(checkDiagnostics).concat(programDiagnostics); + } + function getGlobalDiagnostics() { + var typeChecker = getDiagnosticsProducingTypeChecker(); + var allDiagnostics = []; + ts.addRange(allDiagnostics, typeChecker.getGlobalDiagnostics()); + ts.addRange(allDiagnostics, diagnostics.getGlobalDiagnostics()); + return ts.sortAndDeduplicateDiagnostics(allDiagnostics); + } + function hasExtension(fileName) { + return ts.getBaseFileName(fileName).indexOf(".") >= 0; + } + function processRootFile(fileName, isDefaultLib) { + processSourceFile(ts.normalizePath(fileName), isDefaultLib); + } + function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { + if (refEnd !== undefined && refPos !== undefined) { + var start = refPos; + var length = refEnd - refPos; + } + var diagnostic; + if (hasExtension(fileName)) { + if (!options.allowNonTsExtensions && !ts.fileExtensionIs(host.getCanonicalFileName(fileName), ".ts")) { + diagnostic = ts.Diagnostics.File_0_must_have_extension_ts_or_d_ts; + } + else if (!findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { + diagnostic = ts.Diagnostics.File_0_not_found; + } + else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) { + diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself; + } + } + else { + if (options.allowNonTsExtensions && !findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { + diagnostic = ts.Diagnostics.File_0_not_found; + } + else if (!findSourceFile(fileName + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(fileName + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) { + diagnostic = ts.Diagnostics.File_0_not_found; + fileName += ".ts"; + } + } + if (diagnostic) { + if (refFile) { + diagnostics.add(ts.createFileDiagnostic(refFile, start, length, diagnostic, fileName)); + } + else { + diagnostics.add(ts.createCompilerDiagnostic(diagnostic, fileName)); + } + } + } + function findSourceFile(fileName, isDefaultLib, refFile, refStart, refLength) { + var canonicalName = host.getCanonicalFileName(fileName); + if (ts.hasProperty(filesByName, canonicalName)) { + return getSourceFileFromCache(fileName, canonicalName, false); + } + else { + var normalizedAbsolutePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); + var canonicalAbsolutePath = host.getCanonicalFileName(normalizedAbsolutePath); + if (ts.hasProperty(filesByName, canonicalAbsolutePath)) { + return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, true); + } + var file = filesByName[canonicalName] = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { + if (refFile) { + diagnostics.add(ts.createFileDiagnostic(refFile, refStart, refLength, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + } + else { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + } + }); + if (file) { + seenNoDefaultLib = seenNoDefaultLib || file.hasNoDefaultLib; + filesByName[canonicalAbsolutePath] = file; + if (!options.noResolve) { + var basePath = ts.getDirectoryPath(fileName); + processReferencedFiles(file, basePath); + processImportedModules(file, basePath); + } + if (isDefaultLib) { + files.unshift(file); + } + else { + files.push(file); + } + } + } + return file; + function getSourceFileFromCache(fileName, canonicalName, useAbsolutePath) { + var file = filesByName[canonicalName]; + if (file && host.useCaseSensitiveFileNames()) { + var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; + if (canonicalName !== sourceFileName) { + diagnostics.add(ts.createFileDiagnostic(refFile, refStart, refLength, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + } + } + return file; + } + } + function processReferencedFiles(file, basePath) { + ts.forEach(file.referencedFiles, function (ref) { + var referencedFileName = ts.isRootedDiskPath(ref.fileName) ? ref.fileName : ts.combinePaths(basePath, ref.fileName); + processSourceFile(ts.normalizePath(referencedFileName), false, file, ref.pos, ref.end); + }); + } + function processImportedModules(file, basePath) { + ts.forEach(file.statements, function (node) { + if (ts.isExternalModuleImportDeclaration(node) && + ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { + var nameLiteral = ts.getExternalModuleImportDeclarationExpression(node); + var moduleName = nameLiteral.text; + if (moduleName) { + var searchPath = basePath; + while (true) { + var searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); + if (findModuleSourceFile(searchName + ".ts", nameLiteral) || findModuleSourceFile(searchName + ".d.ts", nameLiteral)) { + break; + } + var parentPath = ts.getDirectoryPath(searchPath); + if (parentPath === searchPath) { + break; + } + searchPath = parentPath; + } + } + } + else if (node.kind === 198 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { + ts.forEachChild(node.body, function (node) { + if (ts.isExternalModuleImportDeclaration(node) && + ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { + var nameLiteral = ts.getExternalModuleImportDeclarationExpression(node); + var moduleName = nameLiteral.text; + if (moduleName) { + var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); + var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral); + if (!tsFile) { + findModuleSourceFile(searchName + ".d.ts", nameLiteral); + } + } + } + }); + } + }); + function findModuleSourceFile(fileName, nameLiteral) { + return findSourceFile(fileName, false, file, nameLiteral.pos, nameLiteral.end - nameLiteral.pos); + } + } + function verifyCompilerOptions() { + if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { + if (options.mapRoot) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); + } + if (options.sourceRoot) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option)); + } + return; + } + var firstExternalModule = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); + if (firstExternalModule && !options.module) { + var externalModuleErrorSpan = ts.getErrorSpanForNode(firstExternalModule.externalModuleIndicator); + var errorStart = ts.skipTrivia(firstExternalModule.text, externalModuleErrorSpan.pos); + var errorLength = externalModuleErrorSpan.end - errorStart; + diagnostics.add(ts.createFileDiagnostic(firstExternalModule, errorStart, errorLength, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); + } + if (options.outDir || + options.sourceRoot || + (options.mapRoot && + (!options.out || firstExternalModule !== undefined))) { + var commonPathComponents; + ts.forEach(files, function (sourceFile) { + if (!(sourceFile.flags & 1024) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { + var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); + sourcePathComponents.pop(); + if (commonPathComponents) { + for (var i = 0; i < Math.min(commonPathComponents.length, sourcePathComponents.length); i++) { + if (commonPathComponents[i] !== sourcePathComponents[i]) { + if (i === 0) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + return; + } + commonPathComponents.length = i; + break; + } + } + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; + } + } + else { + commonPathComponents = sourcePathComponents; + } + } + }); + commonSourceDirectory = ts.getNormalizedPathFromPathComponents(commonPathComponents); + if (commonSourceDirectory) { + commonSourceDirectory += ts.directorySeparator; + } + } + if (options.noEmit) { + if (options.out || options.outDir) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmit_cannot_be_specified_with_option_out_or_outDir)); + } + if (options.declaration) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmit_cannot_be_specified_with_option_declaration)); + } + } + } + } + ts.createProgram = createProgram; +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.optionDeclarations = [ + { + name: "charset", + type: "string" + }, + { + name: "codepage", + type: "number" + }, + { + name: "declaration", + shortName: "d", + type: "boolean", + description: ts.Diagnostics.Generates_corresponding_d_ts_file + }, + { + name: "diagnostics", + type: "boolean" + }, + { + name: "emitBOM", + type: "boolean" + }, + { + name: "help", + shortName: "h", + type: "boolean", + description: ts.Diagnostics.Print_this_message + }, + { + name: "listFiles", + type: "boolean" + }, + { + name: "locale", + type: "string" + }, + { + name: "mapRoot", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, + paramType: ts.Diagnostics.LOCATION + }, + { + name: "module", + shortName: "m", + type: { + "commonjs": 1, + "amd": 2 + }, + description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_or_amd, + paramType: ts.Diagnostics.KIND, + error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_or_amd + }, + { + name: "noEmit", + type: "boolean", + description: ts.Diagnostics.Do_not_emit_outputs + }, + { + name: "noEmitOnError", + type: "boolean", + description: ts.Diagnostics.Do_not_emit_outputs_if_any_type_checking_errors_were_reported + }, + { + name: "noImplicitAny", + type: "boolean", + description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type + }, + { + name: "noLib", + type: "boolean" + }, + { + name: "noLibCheck", + type: "boolean" + }, + { + name: "noResolve", + type: "boolean" + }, + { + name: "out", + type: "string", + description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, + paramType: ts.Diagnostics.FILE + }, + { + name: "outDir", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Redirect_output_structure_to_the_directory, + paramType: ts.Diagnostics.DIRECTORY + }, + { + name: "preserveConstEnums", + type: "boolean", + description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code + }, + { + name: "project", + shortName: "p", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Compile_the_project_in_the_given_directory, + paramType: ts.Diagnostics.DIRECTORY + }, + { + name: "removeComments", + type: "boolean", + description: ts.Diagnostics.Do_not_emit_comments_to_output + }, + { + name: "sourceMap", + type: "boolean", + description: ts.Diagnostics.Generates_corresponding_map_file + }, + { + name: "sourceRoot", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, + paramType: ts.Diagnostics.LOCATION + }, + { + name: "suppressImplicitAnyIndexErrors", + type: "boolean", + description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures + }, + { + name: "stripInternal", + type: "boolean", + description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, + experimental: true + }, + { + name: "target", + shortName: "t", + type: { "es3": 0, "es5": 1, "es6": 2 }, + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental, + paramType: ts.Diagnostics.VERSION, + error: ts.Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6 + }, + { + name: "version", + shortName: "v", + type: "boolean", + description: ts.Diagnostics.Print_the_compiler_s_version + }, + { + name: "watch", + shortName: "w", + type: "boolean", + description: ts.Diagnostics.Watch_input_files + } + ]; + function parseCommandLine(commandLine) { + var options = {}; + var fileNames = []; + var errors = []; + var shortOptionNames = {}; + var optionNameMap = {}; + ts.forEach(ts.optionDeclarations, function (option) { + optionNameMap[option.name.toLowerCase()] = option; + if (option.shortName) { + shortOptionNames[option.shortName] = option.name; + } + }); + parseStrings(commandLine); + return { + options: options, + fileNames: fileNames, + errors: errors + }; + function parseStrings(args) { + var i = 0; + while (i < args.length) { + var s = args[i++]; + if (s.charCodeAt(0) === 64) { + parseResponseFile(s.slice(1)); + } + else if (s.charCodeAt(0) === 45) { + s = s.slice(s.charCodeAt(1) === 45 ? 2 : 1).toLowerCase(); + if (ts.hasProperty(shortOptionNames, s)) { + s = shortOptionNames[s]; + } + if (ts.hasProperty(optionNameMap, s)) { + var opt = optionNameMap[s]; + if (!args[i] && opt.type !== "boolean") { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_expects_an_argument, opt.name)); + } + switch (opt.type) { + case "number": + options[opt.name] = parseInt(args[i++]); + break; + case "boolean": + options[opt.name] = true; + break; + case "string": + options[opt.name] = args[i++] || ""; + break; + default: + var map = opt.type; + var key = (args[i++] || "").toLowerCase(); + if (ts.hasProperty(map, key)) { + options[opt.name] = map[key]; + } + else { + errors.push(ts.createCompilerDiagnostic(opt.error)); + } + } + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, s)); + } + } + else { + fileNames.push(s); + } + } + } + function parseResponseFile(fileName) { + var text = ts.sys.readFile(fileName); + if (!text) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName)); + return; + } + var args = []; + var pos = 0; + while (true) { + while (pos < text.length && text.charCodeAt(pos) <= 32) + pos++; + if (pos >= text.length) + break; + var start = pos; + if (text.charCodeAt(start) === 34) { + pos++; + while (pos < text.length && text.charCodeAt(pos) !== 34) + pos++; + if (pos < text.length) { + args.push(text.substring(start + 1, pos)); + pos++; + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unterminated_quoted_string_in_response_file_0, fileName)); + } + } + else { + while (text.charCodeAt(pos) > 32) + pos++; + args.push(text.substring(start, pos)); + } + } + parseStrings(args); + } + } + ts.parseCommandLine = parseCommandLine; + function readConfigFile(fileName) { + try { + var text = ts.sys.readFile(fileName); + return /\S/.test(text) ? JSON.parse(text) : {}; + } + catch (e) { + } + } + ts.readConfigFile = readConfigFile; + function parseConfigFile(json, basePath) { + var errors = []; + return { + options: getCompilerOptions(), + fileNames: getFiles(), + errors: errors + }; + function getCompilerOptions() { + var options = {}; + var optionNameMap = {}; + ts.forEach(ts.optionDeclarations, function (option) { + optionNameMap[option.name] = option; + }); + var jsonOptions = json["compilerOptions"]; + if (jsonOptions) { + for (var id in jsonOptions) { + if (ts.hasProperty(optionNameMap, id)) { + var opt = optionNameMap[id]; + var optType = opt.type; + var value = jsonOptions[id]; + var expectedType = typeof optType === "string" ? optType : "string"; + if (typeof value === expectedType) { + if (typeof optType !== "string") { + var key = value.toLowerCase(); + if (ts.hasProperty(optType, key)) { + value = optType[key]; + } + else { + errors.push(ts.createCompilerDiagnostic(opt.error)); + value = 0; + } + } + if (opt.isFilePath) { + value = ts.normalizePath(ts.combinePaths(basePath, value)); + } + options[opt.name] = value; + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, id, expectedType)); + } + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, id)); + } + } + } + return options; + } + function getFiles() { + var files = []; + if (ts.hasProperty(json, "files")) { + if (json["files"] instanceof Array) { + var files = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); + } + } + else { + var sysFiles = ts.sys.readDirectory(basePath, ".ts"); + for (var i = 0; i < sysFiles.length; i++) { + var name = sysFiles[i]; + if (!ts.fileExtensionIs(name, ".d.ts") || !ts.contains(sysFiles, name.substr(0, name.length - 5) + ".ts")) { + files.push(name); + } + } + } + return files; + } + } + ts.parseConfigFile = parseConfigFile; +})(ts || (ts = {})); +var ts; +(function (ts) { + var OutliningElementsCollector; + (function (OutliningElementsCollector) { + function collectElements(sourceFile) { + var elements = []; + var collapseText = "..."; + function addOutliningSpan(hintSpanNode, startElement, endElement, autoCollapse) { + if (hintSpanNode && startElement && endElement) { + var span = { + textSpan: ts.createTextSpanFromBounds(startElement.pos, endElement.end), + hintSpan: ts.createTextSpanFromBounds(hintSpanNode.getStart(), hintSpanNode.end), + bannerText: collapseText, + autoCollapse: autoCollapse + }; + elements.push(span); + } + } + function autoCollapse(node) { + switch (node.kind) { + case 199: + case 194: + case 195: + case 197: + return false; + } + return true; + } + var depth = 0; + var maxDepth = 20; + function walk(n) { + if (depth > maxDepth) { + return; + } + switch (n.kind) { + case 172: + if (!ts.isFunctionBlock(n)) { + var parent = n.parent; + var openBrace = ts.findChildOfKind(n, 14, sourceFile); + var closeBrace = ts.findChildOfKind(n, 15, sourceFile); + if (parent.kind === 177 || + parent.kind === 180 || + parent.kind === 181 || + parent.kind === 179 || + parent.kind === 176 || + parent.kind === 178 || + parent.kind === 185 || + parent.kind === 206) { + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); + break; + } + if (parent.kind === 189) { + var tryStatement = parent; + if (tryStatement.tryBlock === n) { + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); + break; + } + else if (tryStatement.finallyBlock === n) { + var finallyKeyword = ts.findChildOfKind(tryStatement, 80, sourceFile); + if (finallyKeyword) { + addOutliningSpan(finallyKeyword, openBrace, closeBrace, autoCollapse(n)); + break; + } + } + } + var span = ts.createTextSpanFromBounds(n.getStart(), n.end); + elements.push({ + textSpan: span, + hintSpan: span, + bannerText: collapseText, + autoCollapse: autoCollapse(n) + }); + break; + } + case 199: + var openBrace = ts.findChildOfKind(n, 14, sourceFile); + var closeBrace = ts.findChildOfKind(n, 15, sourceFile); + addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); + break; + case 194: + case 195: + case 197: + case 150: + case 186: + var openBrace = ts.findChildOfKind(n, 14, sourceFile); + var closeBrace = ts.findChildOfKind(n, 15, sourceFile); + addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); + break; + case 149: + var openBracket = ts.findChildOfKind(n, 18, sourceFile); + var closeBracket = ts.findChildOfKind(n, 19, sourceFile); + addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); + break; + } + depth++; + ts.forEachChild(n, walk); + depth--; + } + walk(sourceFile); + return elements; + } + OutliningElementsCollector.collectElements = collectElements; + })(OutliningElementsCollector = ts.OutliningElementsCollector || (ts.OutliningElementsCollector = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var NavigateTo; + (function (NavigateTo) { + var MatchKind; + (function (MatchKind) { + MatchKind[MatchKind["none"] = 0] = "none"; + MatchKind[MatchKind["exact"] = 1] = "exact"; + MatchKind[MatchKind["substring"] = 2] = "substring"; + MatchKind[MatchKind["prefix"] = 3] = "prefix"; + })(MatchKind || (MatchKind = {})); + function getNavigateToItems(program, cancellationToken, searchValue, maxResultCount) { + var terms = searchValue.split(" "); + var searchTerms = ts.map(terms, function (t) { return ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t }); }); + var rawItems = []; + ts.forEach(program.getSourceFiles(), function (sourceFile) { + cancellationToken.throwIfCancellationRequested(); + var fileName = sourceFile.fileName; + var declarations = sourceFile.getNamedDeclarations(); + for (var i = 0, n = declarations.length; i < n; i++) { + var declaration = declarations[i]; + var name = declaration.name.text; + var matchKind = getMatchKind(searchTerms, name); + if (matchKind !== 0) { + rawItems.push({ name: name, fileName: fileName, matchKind: matchKind, declaration: declaration }); + } + } + }); + rawItems.sort(compareNavigateToItems); + if (maxResultCount !== undefined) { + rawItems = rawItems.slice(0, maxResultCount); + } + var items = ts.map(rawItems, createNavigateToItem); + return items; + var baseSensitivity = { sensitivity: "base" }; + function compareNavigateToItems(i1, i2) { + return i1.matchKind - i2.matchKind || + i1.name.localeCompare(i2.name, undefined, baseSensitivity) || + i1.name.localeCompare(i2.name); + } + function createNavigateToItem(rawItem) { + var declaration = rawItem.declaration; + var container = ts.getContainerNode(declaration); + return { + name: rawItem.name, + kind: ts.getNodeKind(declaration), + kindModifiers: ts.getNodeModifiers(declaration), + matchKind: MatchKind[rawItem.matchKind], + fileName: rawItem.fileName, + textSpan: ts.createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), + containerName: container && container.name ? container.name.text : "", + containerKind: container && container.name ? ts.getNodeKind(container) : "" + }; + } + function hasAnyUpperCaseCharacter(s) { + for (var i = 0, n = s.length; i < n; i++) { + var c = s.charCodeAt(i); + if ((65 <= c && c <= 90) || + (c >= 127 && s.charAt(i).toLocaleLowerCase() !== s.charAt(i))) { + return true; + } + } + return false; + } + function getMatchKind(searchTerms, name) { + var matchKind = 0; + if (name) { + for (var j = 0, n = searchTerms.length; j < n; j++) { + var searchTerm = searchTerms[j]; + var nameToSearch = searchTerm.caseSensitive ? name : name.toLocaleLowerCase(); + var index = nameToSearch.indexOf(searchTerm.term); + if (index < 0) { + return 0; + } + var termKind = 2; + if (index === 0) { + termKind = name.length === searchTerm.term.length ? 1 : 3; + } + if (matchKind === 0 || termKind < matchKind) { + matchKind = termKind; + } + } + } + return matchKind; + } + } + NavigateTo.getNavigateToItems = getNavigateToItems; + })(NavigateTo = ts.NavigateTo || (ts.NavigateTo = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var NavigationBar; + (function (NavigationBar) { + function getNavigationBarItems(sourceFile) { + var hasGlobalNode = false; + return getItemsWorker(getTopLevelNodes(sourceFile), createTopLevelItem); + function getIndent(node) { + var indent = hasGlobalNode ? 1 : 0; + var current = node.parent; + while (current) { + switch (current.kind) { + case 198: + do { + current = current.parent; + } while (current.kind === 198); + case 194: + case 197: + case 195: + case 193: + indent++; + } + current = current.parent; + } + return indent; + } + function getChildNodes(nodes) { + var childNodes = []; + function visit(node) { + switch (node.kind) { + case 173: + ts.forEach(node.declarationList.declarations, visit); + break; + case 146: + case 147: + ts.forEach(node.elements, visit); + break; + case 148: + case 191: + if (ts.isBindingPattern(node.name)) { + visit(node.name); + break; + } + case 194: + case 197: + case 195: + case 198: + case 193: + childNodes.push(node); + } + } + ts.forEach(nodes, visit); + return sortNodes(childNodes); + } + function getTopLevelNodes(node) { + var topLevelNodes = []; + topLevelNodes.push(node); + addTopLevelNodes(node.statements, topLevelNodes); + return topLevelNodes; + } + function sortNodes(nodes) { + return nodes.slice(0).sort(function (n1, n2) { + if (n1.name && n2.name) { + return ts.getPropertyNameForPropertyNameNode(n1.name).localeCompare(ts.getPropertyNameForPropertyNameNode(n2.name)); + } + else if (n1.name) { + return 1; + } + else if (n2.name) { + return -1; + } + else { + return n1.kind - n2.kind; + } + }); + } + function addTopLevelNodes(nodes, topLevelNodes) { + nodes = sortNodes(nodes); + for (var i = 0, n = nodes.length; i < n; i++) { + var node = nodes[i]; + switch (node.kind) { + case 194: + case 197: + case 195: + topLevelNodes.push(node); + break; + case 198: + var moduleDeclaration = node; + topLevelNodes.push(node); + addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); + break; + case 193: + var functionDeclaration = node; + if (isTopLevelFunctionDeclaration(functionDeclaration)) { + topLevelNodes.push(node); + addTopLevelNodes(functionDeclaration.body.statements, topLevelNodes); + } + break; + } + } + } + function isTopLevelFunctionDeclaration(functionDeclaration) { + if (functionDeclaration.kind === 193) { + if (functionDeclaration.body && functionDeclaration.body.kind === 172) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 193 && !isEmpty(s.name.text); })) { + return true; + } + if (!ts.isFunctionBlock(functionDeclaration.parent)) { + return true; + } + } + } + return false; + } + function getItemsWorker(nodes, createItem) { + var items = []; + var keyToItem = {}; + for (var i = 0, n = nodes.length; i < n; i++) { + var child = nodes[i]; + var item = createItem(child); + if (item !== undefined) { + if (item.text.length > 0) { + var key = item.text + "-" + item.kind + "-" + item.indent; + var itemWithSameName = keyToItem[key]; + if (itemWithSameName) { + merge(itemWithSameName, item); + } + else { + keyToItem[key] = item; + items.push(item); + } + } + } + } + return items; + } + function merge(target, source) { + target.spans.push.apply(target.spans, source.spans); + if (source.childItems) { + if (!target.childItems) { + target.childItems = []; + } + outer: for (var i = 0, n = source.childItems.length; i < n; i++) { + var sourceChild = source.childItems[i]; + for (var j = 0, m = target.childItems.length; j < m; j++) { + var targetChild = target.childItems[j]; + if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { + merge(targetChild, sourceChild); + continue outer; + } + } + target.childItems.push(sourceChild); + } + } + } + function createChildItem(node) { + switch (node.kind) { + case 126: + if (ts.isBindingPattern(node.name)) { + break; + } + if ((node.flags & 243) === 0) { + return undefined; + } + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 130: + case 129: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); + case 132: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); + case 133: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); + case 136: + return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); + case 209: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 134: + return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); + case 135: + return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); + case 128: + case 127: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 193: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); + case 191: + case 148: + var variableDeclarationNode; + var name; + if (node.kind === 148) { + name = node.name; + variableDeclarationNode = node; + while (variableDeclarationNode && variableDeclarationNode.kind !== 191) { + variableDeclarationNode = variableDeclarationNode.parent; + } + ts.Debug.assert(variableDeclarationNode !== undefined); + } + else { + ts.Debug.assert(!ts.isBindingPattern(node.name)); + variableDeclarationNode = node; + name = node.name; + } + if (ts.isConst(variableDeclarationNode)) { + return createItem(node, getTextOfNode(name), ts.ScriptElementKind.constElement); + } + else if (ts.isLet(variableDeclarationNode)) { + return createItem(node, getTextOfNode(name), ts.ScriptElementKind.letElement); + } + else { + return createItem(node, getTextOfNode(name), ts.ScriptElementKind.variableElement); + } + case 131: + return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); + } + return undefined; + function createItem(node, name, scriptElementKind) { + return getNavigationBarItem(name, scriptElementKind, ts.getNodeModifiers(node), [getNodeSpan(node)]); + } + } + function isEmpty(text) { + return !text || text.trim() === ""; + } + function getNavigationBarItem(text, kind, kindModifiers, spans, childItems, indent) { + if (childItems === void 0) { childItems = []; } + if (indent === void 0) { indent = 0; } + if (isEmpty(text)) { + return undefined; + } + return { + text: text, + kind: kind, + kindModifiers: kindModifiers, + spans: spans, + childItems: childItems, + indent: indent, + bolded: false, + grayed: false + }; + } + function createTopLevelItem(node) { + switch (node.kind) { + case 210: + return createSourceFileItem(node); + case 194: + return createClassItem(node); + case 197: + return createEnumItem(node); + case 195: + return createIterfaceItem(node); + case 198: + return createModuleItem(node); + case 193: + return createFunctionItem(node); + } + return undefined; + function getModuleName(moduleDeclaration) { + if (moduleDeclaration.name.kind === 8) { + return getTextOfNode(moduleDeclaration.name); + } + var result = []; + result.push(moduleDeclaration.name.text); + while (moduleDeclaration.body && moduleDeclaration.body.kind === 198) { + moduleDeclaration = moduleDeclaration.body; + result.push(moduleDeclaration.name.text); + } + return result.join("."); + } + function createModuleItem(node) { + var moduleName = getModuleName(node); + var childItems = getItemsWorker(getChildNodes(getInnermostModule(node).body.statements), createChildItem); + return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + function createFunctionItem(node) { + if (node.name && node.body && node.body.kind === 172) { + var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + return undefined; + } + function createSourceFileItem(node) { + var childItems = getItemsWorker(getChildNodes(node.statements), createChildItem); + if (childItems === undefined || childItems.length === 0) { + return undefined; + } + hasGlobalNode = true; + var rootName = ts.isExternalModule(node) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(node.fileName)))) + "\"" : ""; + return getNavigationBarItem(rootName, ts.ScriptElementKind.moduleElement, ts.ScriptElementKindModifier.none, [getNodeSpan(node)], childItems); + } + function createClassItem(node) { + var childItems; + if (node.members) { + var constructor = ts.forEach(node.members, function (member) { + return member.kind === 131 && member; + }); + var nodes = removeDynamicallyNamedProperties(node); + if (constructor) { + nodes.push.apply(nodes, constructor.parameters); + } + var childItems = getItemsWorker(sortNodes(nodes), createChildItem); + } + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.classElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + function createEnumItem(node) { + var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + function createIterfaceItem(node) { + var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + } + function removeComputedProperties(node) { + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 124; }); + } + function removeDynamicallyNamedProperties(node) { + return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); + } + function getInnermostModule(node) { + while (node.body.kind === 198) { + node = node.body; + } + return node; + } + function getNodeSpan(node) { + return node.kind === 210 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); + } + function getTextOfNode(node) { + return ts.getTextOfNodeFromSourceText(sourceFile.text, node); + } + } + NavigationBar.getNavigationBarItems = getNavigationBarItems; + })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + (function (PatternMatchKind) { + PatternMatchKind[PatternMatchKind["Exact"] = 0] = "Exact"; + PatternMatchKind[PatternMatchKind["Prefix"] = 1] = "Prefix"; + PatternMatchKind[PatternMatchKind["Substring"] = 2] = "Substring"; + PatternMatchKind[PatternMatchKind["CamelCase"] = 3] = "CamelCase"; + })(ts.PatternMatchKind || (ts.PatternMatchKind = {})); + var PatternMatchKind = ts.PatternMatchKind; + function createPatternMatch(kind, punctuationStripped, isCaseSensitive, camelCaseWeight) { + return { + kind: kind, + punctuationStripped: punctuationStripped, + isCaseSensitive: isCaseSensitive, + camelCaseWeight: camelCaseWeight + }; + } + function createPatternMatcher(pattern) { + var stringToWordSpans = {}; + pattern = pattern.trim(); + var fullPatternSegment = createSegment(pattern); + var dotSeparatedSegments = pattern.split(".").map(function (p) { return createSegment(p.trim()); }); + var invalidPattern = dotSeparatedSegments.length === 0 || ts.forEach(dotSeparatedSegments, segmentIsInvalid); + return { + getMatches: getMatches, + getMatchesForLastSegmentOfPattern: getMatchesForLastSegmentOfPattern, + patternContainsDots: dotSeparatedSegments.length > 1 + }; + function skipMatch(candidate) { + return invalidPattern || !candidate; + } + function getMatchesForLastSegmentOfPattern(candidate) { + if (skipMatch(candidate)) { + return undefined; + } + return matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments)); + } + function getMatches(candidate, dottedContainer) { + if (skipMatch(candidate)) { + return undefined; + } + var candidateMatch = matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments)); + if (!candidateMatch) { + return undefined; + } + dottedContainer = dottedContainer || ""; + var containerParts = dottedContainer.split("."); + if (dotSeparatedSegments.length - 1 > containerParts.length) { + return null; + } + var totalMatch = candidateMatch; + for (var i = dotSeparatedSegments.length - 2, j = containerParts.length - 1; i >= 0; i--, j--) { + var segment = dotSeparatedSegments[i]; + var containerName = containerParts[j]; + var containerMatch = matchSegment(containerName, segment); + if (!containerMatch) { + return undefined; + } + ts.addRange(totalMatch, containerMatch); + } + return totalMatch; + } + function getWordSpans(word) { + if (!ts.hasProperty(stringToWordSpans, word)) { + stringToWordSpans[word] = breakIntoWordSpans(word); + } + return stringToWordSpans[word]; + } + function matchTextChunk(candidate, chunk, punctuationStripped) { + var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); + if (index === 0) { + if (chunk.text.length === candidate.length) { + return createPatternMatch(0, punctuationStripped, candidate === chunk.text); + } + else { + return createPatternMatch(1, punctuationStripped, startsWith(candidate, chunk.text)); + } + } + var isLowercase = chunk.isLowerCase; + if (isLowercase) { + if (index > 0) { + var wordSpans = getWordSpans(candidate); + for (var i = 0, n = wordSpans.length; i < n; i++) { + var span = wordSpans[i]; + if (partStartsWith(candidate, span, chunk.text, true)) { + return createPatternMatch(2, punctuationStripped, partStartsWith(candidate, span, chunk.text, false)); + } + } + } + } + else { + if (candidate.indexOf(chunk.text) > 0) { + return createPatternMatch(2, punctuationStripped, true); + } + } + if (!isLowercase) { + if (chunk.characterSpans.length > 0) { + var candidateParts = getWordSpans(candidate); + var camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, false); + if (camelCaseWeight !== undefined) { + return createPatternMatch(3, punctuationStripped, true, camelCaseWeight); + } + camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, true); + if (camelCaseWeight !== undefined) { + return createPatternMatch(3, punctuationStripped, false, camelCaseWeight); + } + } + } + if (isLowercase) { + if (chunk.text.length < candidate.length) { + if (index > 0 && isUpperCaseLetter(candidate.charCodeAt(index))) { + return createPatternMatch(2, punctuationStripped, false); + } + } + } + return undefined; + } + function containsSpaceOrAsterisk(text) { + for (var i = 0; i < text.length; i++) { + var ch = text.charCodeAt(i); + if (ch === 32 || ch === 42) { + return true; + } + } + return false; + } + function matchSegment(candidate, segment) { + if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) { + var match = matchTextChunk(candidate, segment.totalTextChunk, false); + if (match) { + return [match]; + } + } + var subWordTextChunks = segment.subWordTextChunks; + var matches = undefined; + for (var i = 0, n = subWordTextChunks.length; i < n; i++) { + var subWordTextChunk = subWordTextChunks[i]; + var result = matchTextChunk(candidate, subWordTextChunk, true); + if (!result) { + return undefined; + } + matches = matches || []; + matches.push(result); + } + return matches; + } + function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) { + var patternPartStart = patternSpan ? patternSpan.start : 0; + var patternPartLength = patternSpan ? patternSpan.length : pattern.length; + if (patternPartLength > candidateSpan.length) { + return false; + } + if (ignoreCase) { + for (var i = 0; i < patternPartLength; i++) { + var ch1 = pattern.charCodeAt(patternPartStart + i); + var ch2 = candidate.charCodeAt(candidateSpan.start + i); + if (toLowerCase(ch1) !== toLowerCase(ch2)) { + return false; + } + } + } + else { + for (var i = 0; i < patternPartLength; i++) { + var ch1 = pattern.charCodeAt(patternPartStart + i); + var ch2 = candidate.charCodeAt(candidateSpan.start + i); + if (ch1 !== ch2) { + return false; + } + } + } + return true; + } + function tryCamelCaseMatch(candidate, candidateParts, chunk, ignoreCase) { + var chunkCharacterSpans = chunk.characterSpans; + var currentCandidate = 0; + var currentChunkSpan = 0; + var firstMatch = undefined; + var contiguous = undefined; + while (true) { + if (currentChunkSpan === chunkCharacterSpans.length) { + var weight = 0; + if (contiguous) { + weight += 1; + } + if (firstMatch === 0) { + weight += 2; + } + return weight; + } + else if (currentCandidate === candidateParts.length) { + return undefined; + } + var candidatePart = candidateParts[currentCandidate]; + var gotOneMatchThisCandidate = false; + for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { + var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; + if (gotOneMatchThisCandidate) { + if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || + !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { + break; + } + } + if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) { + break; + } + gotOneMatchThisCandidate = true; + firstMatch = firstMatch === undefined ? currentCandidate : firstMatch; + contiguous = contiguous === undefined ? true : contiguous; + candidatePart = ts.createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length); + } + if (!gotOneMatchThisCandidate && contiguous !== undefined) { + contiguous = false; + } + currentCandidate++; + } + } + } + ts.createPatternMatcher = createPatternMatcher; + function patternMatchCompareTo(match1, match2) { + return compareType(match1, match2) || + compareCamelCase(match1, match2) || + compareCase(match1, match2) || + comparePunctuation(match1, match2); + } + function comparePunctuation(result1, result2) { + if (result1.punctuationStripped !== result2.punctuationStripped) { + return result1.punctuationStripped ? 1 : -1; + } + return 0; + } + function compareCase(result1, result2) { + if (result1.isCaseSensitive !== result2.isCaseSensitive) { + return result1.isCaseSensitive ? -1 : 1; + } + return 0; + } + function compareType(result1, result2) { + return result1.kind - result2.kind; + } + function compareCamelCase(result1, result2) { + if (result1.kind === 3 && result2.kind === 3) { + return result2.camelCaseWeight - result1.camelCaseWeight; + } + return 0; + } + function createSegment(text) { + return { + totalTextChunk: createTextChunk(text), + subWordTextChunks: breakPatternIntoTextChunks(text) + }; + } + function segmentIsInvalid(segment) { + return segment.subWordTextChunks.length === 0; + } + function isUpperCaseLetter(ch) { + if (ch >= 65 && ch <= 90) { + return true; + } + if (ch < 127 || !ts.isUnicodeIdentifierStart(ch, 2)) { + return false; + } + var str = String.fromCharCode(ch); + return str === str.toUpperCase(); + } + function isLowerCaseLetter(ch) { + if (ch >= 97 && ch <= 122) { + return true; + } + if (ch < 127 || !ts.isUnicodeIdentifierStart(ch, 2)) { + return false; + } + var str = String.fromCharCode(ch); + return str === str.toLowerCase(); + } + function containsUpperCaseLetter(string) { + for (var i = 0, n = string.length; i < n; i++) { + if (isUpperCaseLetter(string.charCodeAt(i))) { + return true; + } + } + return false; + } + function startsWith(string, search) { + for (var i = 0, n = search.length; i < n; i++) { + if (string.charCodeAt(i) !== search.charCodeAt(i)) { + return false; + } + } + return true; + } + function indexOfIgnoringCase(string, value) { + for (var i = 0, n = string.length - value.length; i <= n; i++) { + if (startsWithIgnoringCase(string, value, i)) { + return i; + } + } + return -1; + } + function startsWithIgnoringCase(string, value, start) { + for (var i = 0, n = value.length; i < n; i++) { + var ch1 = toLowerCase(string.charCodeAt(i + start)); + var ch2 = value.charCodeAt(i); + if (ch1 !== ch2) { + return false; + } + } + return true; + } + function toLowerCase(ch) { + if (ch >= 65 && ch <= 90) { + return 97 + (ch - 65); + } + if (ch < 127) { + return ch; + } + return String.fromCharCode(ch).toLowerCase().charCodeAt(0); + } + function isDigit(ch) { + return ch >= 48 && ch <= 57; + } + function isWordChar(ch) { + return isUpperCaseLetter(ch) || isLowerCaseLetter(ch) || isDigit(ch) || ch === 95 || ch === 36; + } + function breakPatternIntoTextChunks(pattern) { + var result = []; + var wordStart = 0; + var wordLength = 0; + for (var i = 0; i < pattern.length; i++) { + var ch = pattern.charCodeAt(i); + if (isWordChar(ch)) { + if (wordLength++ === 0) { + wordStart = i; + } + } + else { + if (wordLength > 0) { + result.push(createTextChunk(pattern.substr(wordStart, wordLength))); + wordLength = 0; + } + } + } + if (wordLength > 0) { + result.push(createTextChunk(pattern.substr(wordStart, wordLength))); + } + return result; + } + function createTextChunk(text) { + var textLowerCase = text.toLowerCase(); + return { + text: text, + textLowerCase: textLowerCase, + isLowerCase: text === textLowerCase, + characterSpans: breakIntoCharacterSpans(text) + }; + } + function breakIntoCharacterSpans(identifier) { + return breakIntoSpans(identifier, false); + } + ts.breakIntoCharacterSpans = breakIntoCharacterSpans; + function breakIntoWordSpans(identifier) { + return breakIntoSpans(identifier, true); + } + ts.breakIntoWordSpans = breakIntoWordSpans; + function breakIntoSpans(identifier, word) { + var result = []; + var wordStart = 0; + for (var i = 1, n = identifier.length; i < n; i++) { + var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); + var currentIsDigit = isDigit(identifier.charCodeAt(i)); + var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); + var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart); + if (charIsPunctuation(identifier.charCodeAt(i - 1)) || + charIsPunctuation(identifier.charCodeAt(i)) || + lastIsDigit != currentIsDigit || + hasTransitionFromLowerToUpper || + hasTransitionFromUpperToLower) { + if (!isAllPunctuation(identifier, wordStart, i)) { + result.push(ts.createTextSpan(wordStart, i - wordStart)); + } + wordStart = i; + } + } + if (!isAllPunctuation(identifier, wordStart, identifier.length)) { + result.push(ts.createTextSpan(wordStart, identifier.length - wordStart)); + } + return result; + } + function charIsPunctuation(ch) { + switch (ch) { + case 33: + case 34: + case 35: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 44: + case 45: + case 46: + case 47: + case 58: + case 59: + case 63: + case 64: + case 91: + case 92: + case 93: + case 95: + case 123: + case 125: + return true; + } + return false; + } + function isAllPunctuation(identifier, start, end) { + for (var i = start; i < end; i++) { + var ch = identifier.charCodeAt(i); + if (!charIsPunctuation(ch) || ch === 95 || ch === 36) { + return false; + } + } + return true; + } + function transitionFromUpperToLower(identifier, word, index, wordStart) { + if (word) { + if (index != wordStart && + index + 1 < identifier.length) { + var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); + var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1)); + if (currentIsUpper && nextIsLower) { + for (var i = wordStart; i < index; i++) { + if (!isUpperCaseLetter(identifier.charCodeAt(i))) { + return false; + } + } + return true; + } + } + } + return false; + } + function transitionFromLowerToUpper(identifier, word, index) { + var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); + var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); + var transition = word ? (currentIsUpper && !lastIsUpper) : currentIsUpper; + return transition; + } +})(ts || (ts = {})); +var ts; +(function (ts) { + var SignatureHelp; + (function (SignatureHelp) { + var emptyArray = []; + var ArgumentListKind; + (function (ArgumentListKind) { + ArgumentListKind[ArgumentListKind["TypeArguments"] = 0] = "TypeArguments"; + ArgumentListKind[ArgumentListKind["CallArguments"] = 1] = "CallArguments"; + ArgumentListKind[ArgumentListKind["TaggedTemplateArguments"] = 2] = "TaggedTemplateArguments"; + })(ArgumentListKind || (ArgumentListKind = {})); + function getSignatureHelpItems(sourceFile, position, typeInfoResolver, cancellationToken) { + var startingToken = ts.findTokenOnLeftOfPosition(sourceFile, position); + if (!startingToken) { + return undefined; + } + var argumentInfo = getContainingArgumentInfo(startingToken); + cancellationToken.throwIfCancellationRequested(); + if (!argumentInfo) { + return undefined; + } + var call = argumentInfo.invocation; + var candidates = []; + var resolvedSignature = typeInfoResolver.getResolvedSignature(call, candidates); + cancellationToken.throwIfCancellationRequested(); + if (!candidates.length) { + return undefined; + } + return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); + function getImmediatelyContainingArgumentInfo(node) { + if (node.parent.kind === 153 || node.parent.kind === 154) { + var callExpression = node.parent; + if (node.kind === 24 || + node.kind === 16) { + var list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile); + var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; + ts.Debug.assert(list !== undefined); + return { + kind: isTypeArgList ? 0 : 1, + invocation: callExpression, + argumentsSpan: getApplicableSpanForArguments(list), + argumentIndex: 0, + argumentCount: getCommaBasedArgCount(list) + }; + } + var listItemInfo = ts.findListItemInfo(node); + if (listItemInfo) { + var list = listItemInfo.list; + var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; + var argumentIndex = (listItemInfo.listItemIndex + 1) >> 1; + return { + kind: isTypeArgList ? 0 : 1, + invocation: callExpression, + argumentsSpan: getApplicableSpanForArguments(list), + argumentIndex: argumentIndex, + argumentCount: getCommaBasedArgCount(list) + }; + } + } + else if (node.kind === 10 && node.parent.kind === 155) { + if (ts.isInsideTemplateLiteral(node, position)) { + return getArgumentListInfoForTemplate(node.parent, 0); + } + } + else if (node.kind === 11 && node.parent.parent.kind === 155) { + var templateExpression = node.parent; + var tagExpression = templateExpression.parent; + ts.Debug.assert(templateExpression.kind === 167); + var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; + return getArgumentListInfoForTemplate(tagExpression, argumentIndex); + } + else if (node.parent.kind === 171 && node.parent.parent.parent.kind === 155) { + var templateSpan = node.parent; + var templateExpression = templateSpan.parent; + var tagExpression = templateExpression.parent; + ts.Debug.assert(templateExpression.kind === 167); + if (node.kind === 13 && !ts.isInsideTemplateLiteral(node, position)) { + return undefined; + } + var spanIndex = templateExpression.templateSpans.indexOf(templateSpan); + var argumentIndex = getArgumentIndexForTemplatePiece(spanIndex, node); + return getArgumentListInfoForTemplate(tagExpression, argumentIndex); + } + return undefined; + } + function getCommaBasedArgCount(argumentsList) { + return argumentsList.getChildCount() === 0 ? 0 : 1 + ts.countWhere(argumentsList.getChildren(), function (arg) { return arg.kind === 23; }); + } + function getArgumentIndexForTemplatePiece(spanIndex, node) { + ts.Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node."); + if (ts.isTemplateLiteralKind(node.kind)) { + if (ts.isInsideTemplateLiteral(node, position)) { + return 0; + } + return spanIndex + 2; + } + return spanIndex + 1; + } + function getArgumentListInfoForTemplate(tagExpression, argumentIndex) { + var argumentCount = tagExpression.template.kind === 10 ? 1 : tagExpression.template.templateSpans.length + 1; + return { + kind: 2, + invocation: tagExpression, + argumentsSpan: getApplicableSpanForTaggedTemplate(tagExpression), + argumentIndex: argumentIndex, + argumentCount: argumentCount + }; + } + function getApplicableSpanForArguments(argumentsList) { + var applicableSpanStart = argumentsList.getFullStart(); + var applicableSpanEnd = ts.skipTrivia(sourceFile.text, argumentsList.getEnd(), false); + return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); + } + function getApplicableSpanForTaggedTemplate(taggedTemplate) { + var template = taggedTemplate.template; + var applicableSpanStart = template.getStart(); + var applicableSpanEnd = template.getEnd(); + if (template.kind === 167) { + var lastSpan = ts.lastOrUndefined(template.templateSpans); + if (lastSpan.literal.getFullWidth() === 0) { + applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false); + } + } + return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); + } + function getContainingArgumentInfo(node) { + for (var n = node; n.kind !== 210; n = n.parent) { + if (ts.isFunctionBlock(n)) { + return undefined; + } + if (n.pos < n.parent.pos || n.end > n.parent.end) { + ts.Debug.fail("Node of kind " + n.kind + " is not a subspan of its parent of kind " + n.parent.kind); + } + var argumentInfo = getImmediatelyContainingArgumentInfo(n); + if (argumentInfo) { + return argumentInfo; + } + } + return undefined; + } + function getChildListThatStartsWithOpenerToken(parent, openerToken, sourceFile) { + var children = parent.getChildren(sourceFile); + var indexOfOpenerToken = children.indexOf(openerToken); + ts.Debug.assert(indexOfOpenerToken >= 0 && children.length > indexOfOpenerToken + 1); + return children[indexOfOpenerToken + 1]; + } + function selectBestInvalidOverloadIndex(candidates, argumentCount) { + var maxParamsSignatureIndex = -1; + var maxParams = -1; + for (var i = 0; i < candidates.length; i++) { + var candidate = candidates[i]; + if (candidate.hasRestParameter || candidate.parameters.length >= argumentCount) { + return i; + } + if (candidate.parameters.length > maxParams) { + maxParams = candidate.parameters.length; + maxParamsSignatureIndex = i; + } + } + return maxParamsSignatureIndex; + } + function createSignatureHelpItems(candidates, bestSignature, argumentListInfo) { + var applicableSpan = argumentListInfo.argumentsSpan; + var isTypeParameterList = argumentListInfo.kind === 0; + var invocation = argumentListInfo.invocation; + var callTarget = ts.getInvokedExpression(invocation); + var callTargetSymbol = typeInfoResolver.getSymbolAtLocation(callTarget); + var callTargetDisplayParts = callTargetSymbol && ts.symbolToDisplayParts(typeInfoResolver, callTargetSymbol, undefined, undefined); + var items = ts.map(candidates, function (candidateSignature) { + var signatureHelpParameters; + var prefixDisplayParts = []; + var suffixDisplayParts = []; + if (callTargetDisplayParts) { + prefixDisplayParts.push.apply(prefixDisplayParts, callTargetDisplayParts); + } + if (isTypeParameterList) { + prefixDisplayParts.push(ts.punctuationPart(24)); + var typeParameters = candidateSignature.typeParameters; + signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; + suffixDisplayParts.push(ts.punctuationPart(25)); + var parameterParts = ts.mapToDisplayParts(function (writer) { + return typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation); + }); + suffixDisplayParts.push.apply(suffixDisplayParts, parameterParts); + } + else { + var typeParameterParts = ts.mapToDisplayParts(function (writer) { + return typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation); + }); + prefixDisplayParts.push.apply(prefixDisplayParts, typeParameterParts); + prefixDisplayParts.push(ts.punctuationPart(16)); + var parameters = candidateSignature.parameters; + signatureHelpParameters = parameters.length > 0 ? ts.map(parameters, createSignatureHelpParameterForParameter) : emptyArray; + suffixDisplayParts.push(ts.punctuationPart(17)); + } + var returnTypeParts = ts.mapToDisplayParts(function (writer) { + return typeInfoResolver.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, invocation); + }); + suffixDisplayParts.push.apply(suffixDisplayParts, returnTypeParts); + return { + isVariadic: candidateSignature.hasRestParameter, + prefixDisplayParts: prefixDisplayParts, + suffixDisplayParts: suffixDisplayParts, + separatorDisplayParts: [ts.punctuationPart(23), ts.spacePart()], + parameters: signatureHelpParameters, + documentation: candidateSignature.getDocumentationComment() + }; + }); + var argumentIndex = argumentListInfo.argumentIndex; + var argumentCount = argumentListInfo.argumentCount; + var selectedItemIndex = candidates.indexOf(bestSignature); + if (selectedItemIndex < 0) { + selectedItemIndex = selectBestInvalidOverloadIndex(candidates, argumentCount); + } + return { + items: items, + applicableSpan: applicableSpan, + selectedItemIndex: selectedItemIndex, + argumentIndex: argumentIndex, + argumentCount: argumentCount + }; + function createSignatureHelpParameterForParameter(parameter) { + var displayParts = ts.mapToDisplayParts(function (writer) { + return typeInfoResolver.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation); + }); + var isOptional = ts.hasQuestionToken(parameter.valueDeclaration); + return { + name: parameter.name, + documentation: parameter.getDocumentationComment(), + displayParts: displayParts, + isOptional: isOptional + }; + } + function createSignatureHelpParameterForTypeParameter(typeParameter) { + var displayParts = ts.mapToDisplayParts(function (writer) { + return typeInfoResolver.getSymbolDisplayBuilder().buildTypeParameterDisplay(typeParameter, writer, invocation); + }); + return { + name: typeParameter.symbol.name, + documentation: emptyArray, + displayParts: displayParts, + isOptional: false + }; + } + } + } + SignatureHelp.getSignatureHelpItems = getSignatureHelpItems; + })(SignatureHelp = ts.SignatureHelp || (ts.SignatureHelp = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + function getEndLinePosition(line, sourceFile) { + ts.Debug.assert(line >= 0); + var lineStarts = sourceFile.getLineStarts(); + var lineIndex = line; + if (lineIndex + 1 === lineStarts.length) { + return sourceFile.text.length - 1; + } + else { + var start = lineStarts[lineIndex]; + var pos = lineStarts[lineIndex + 1] - 1; + ts.Debug.assert(ts.isLineBreak(sourceFile.text.charCodeAt(pos))); + while (start <= pos && ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { + pos--; + } + return pos; + } + } + ts.getEndLinePosition = getEndLinePosition; + function getLineStartPositionForPosition(position, sourceFile) { + var lineStarts = sourceFile.getLineStarts(); + var line = sourceFile.getLineAndCharacterOfPosition(position).line; + return lineStarts[line]; + } + ts.getLineStartPositionForPosition = getLineStartPositionForPosition; + function rangeContainsRange(r1, r2) { + return startEndContainsRange(r1.pos, r1.end, r2); + } + ts.rangeContainsRange = rangeContainsRange; + function startEndContainsRange(start, end, range) { + return start <= range.pos && end >= range.end; + } + ts.startEndContainsRange = startEndContainsRange; + function rangeContainsStartEnd(range, start, end) { + return range.pos <= start && range.end >= end; + } + ts.rangeContainsStartEnd = rangeContainsStartEnd; + function rangeOverlapsWithStartEnd(r1, start, end) { + return startEndOverlapsWithStartEnd(r1.pos, r1.end, start, end); + } + ts.rangeOverlapsWithStartEnd = rangeOverlapsWithStartEnd; + function startEndOverlapsWithStartEnd(start1, end1, start2, end2) { + var start = Math.max(start1, start2); + var end = Math.min(end1, end2); + return start < end; + } + ts.startEndOverlapsWithStartEnd = startEndOverlapsWithStartEnd; + function findListItemInfo(node) { + var list = findContainingList(node); + if (!list) { + return undefined; + } + var children = list.getChildren(); + var listItemIndex = ts.indexOf(children, node); + return { + listItemIndex: listItemIndex, + list: list + }; + } + ts.findListItemInfo = findListItemInfo; + function findChildOfKind(n, kind, sourceFile) { + return ts.forEach(n.getChildren(sourceFile), function (c) { return c.kind === kind && c; }); + } + ts.findChildOfKind = findChildOfKind; + function findContainingList(node) { + var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { + if (c.kind === 211 && c.pos <= node.pos && c.end >= node.end) { + return c; + } + }); + return syntaxList; + } + ts.findContainingList = findContainingList; + function getTouchingWord(sourceFile, position) { + return getTouchingToken(sourceFile, position, function (n) { return isWord(n.kind); }); + } + ts.getTouchingWord = getTouchingWord; + function getTouchingPropertyName(sourceFile, position) { + return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }); + } + ts.getTouchingPropertyName = getTouchingPropertyName; + function getTouchingToken(sourceFile, position, includeItemAtEndPosition) { + return getTokenAtPositionWorker(sourceFile, position, false, includeItemAtEndPosition); + } + ts.getTouchingToken = getTouchingToken; + function getTokenAtPosition(sourceFile, position) { + return getTokenAtPositionWorker(sourceFile, position, true, undefined); + } + ts.getTokenAtPosition = getTokenAtPosition; + function getTokenAtPositionWorker(sourceFile, position, allowPositionInLeadingTrivia, includeItemAtEndPosition) { + var current = sourceFile; + outer: while (true) { + if (isToken(current)) { + return current; + } + for (var i = 0, n = current.getChildCount(sourceFile); i < n; i++) { + var child = current.getChildAt(i); + var start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile); + if (start <= position) { + var end = child.getEnd(); + if (position < end || (position === end && child.kind === 1)) { + current = child; + continue outer; + } + else if (includeItemAtEndPosition && end === position) { + var previousToken = findPrecedingToken(position, sourceFile, child); + if (previousToken && includeItemAtEndPosition(previousToken)) { + return previousToken; + } + } + } + } + return current; + } + } + function findTokenOnLeftOfPosition(file, position) { + var tokenAtPosition = getTokenAtPosition(file, position); + if (isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) { + return tokenAtPosition; + } + return findPrecedingToken(position, file); + } + ts.findTokenOnLeftOfPosition = findTokenOnLeftOfPosition; + function findNextToken(previousToken, parent) { + return find(parent); + function find(n) { + if (isToken(n) && n.pos === previousToken.end) { + return n; + } + var children = n.getChildren(); + for (var i = 0, len = children.length; i < len; ++i) { + var child = children[i]; + var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || + (child.pos === previousToken.end); + if (shouldDiveInChildNode && nodeHasTokens(child)) { + return find(child); + } + } + return undefined; + } + } + ts.findNextToken = findNextToken; + function findPrecedingToken(position, sourceFile, startNode) { + return find(startNode || sourceFile); + function findRightmostToken(n) { + if (isToken(n)) { + return n; + } + var children = n.getChildren(); + var candidate = findRightmostChildNodeWithTokens(children, children.length); + return candidate && findRightmostToken(candidate); + } + function find(n) { + if (isToken(n)) { + return n; + } + var children = n.getChildren(); + for (var i = 0, len = children.length; i < len; ++i) { + var child = children[i]; + if (nodeHasTokens(child)) { + if (position <= child.end) { + if (child.getStart(sourceFile) >= position) { + var candidate = findRightmostChildNodeWithTokens(children, i); + return candidate && findRightmostToken(candidate); + } + else { + return find(child); + } + } + } + } + ts.Debug.assert(startNode !== undefined || n.kind === 210); + if (children.length) { + var candidate = findRightmostChildNodeWithTokens(children, children.length); + return candidate && findRightmostToken(candidate); + } + } + function findRightmostChildNodeWithTokens(children, exclusiveStartPosition) { + for (var i = exclusiveStartPosition - 1; i >= 0; --i) { + if (nodeHasTokens(children[i])) { + return children[i]; + } + } + } + } + ts.findPrecedingToken = findPrecedingToken; + function nodeHasTokens(n) { + return n.getWidth() !== 0; + } + function getNodeModifiers(node) { + var flags = ts.getCombinedNodeFlags(node); + var result = []; + if (flags & 32) + result.push(ts.ScriptElementKindModifier.privateMemberModifier); + if (flags & 64) + result.push(ts.ScriptElementKindModifier.protectedMemberModifier); + if (flags & 16) + result.push(ts.ScriptElementKindModifier.publicMemberModifier); + if (flags & 128) + result.push(ts.ScriptElementKindModifier.staticModifier); + if (flags & 1) + result.push(ts.ScriptElementKindModifier.exportedModifier); + if (ts.isInAmbientContext(node)) + result.push(ts.ScriptElementKindModifier.ambientModifier); + return result.length > 0 ? result.join(',') : ts.ScriptElementKindModifier.none; + } + ts.getNodeModifiers = getNodeModifiers; + function getTypeArgumentOrTypeParameterList(node) { + if (node.kind === 137 || node.kind === 153) { + return node.typeArguments; + } + if (ts.isAnyFunction(node) || node.kind === 194 || node.kind === 195) { + return node.typeParameters; + } + return undefined; + } + ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; + function isToken(n) { + return n.kind >= 0 && n.kind <= 122; + } + ts.isToken = isToken; + function isWord(kind) { + return kind === 64 || ts.isKeyword(kind); + } + function isPropertyName(kind) { + return kind === 8 || kind === 7 || isWord(kind); + } + function isComment(kind) { + return kind === 2 || kind === 3; + } + ts.isComment = isComment; + function isPunctuation(kind) { + return 14 <= kind && kind <= 63; + } + ts.isPunctuation = isPunctuation; + function isInsideTemplateLiteral(node, position) { + return ts.isTemplateLiteralKind(node.kind) && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd()); + } + ts.isInsideTemplateLiteral = isInsideTemplateLiteral; + function compareDataObjects(dst, src) { + for (var e in dst) { + if (typeof dst[e] === "object") { + if (!compareDataObjects(dst[e], src[e])) { + return false; + } + } + else if (typeof dst[e] !== "function") { + if (dst[e] !== src[e]) { + return false; + } + } + } + return true; + } + ts.compareDataObjects = compareDataObjects; +})(ts || (ts = {})); +var ts; +(function (ts) { + function isFirstDeclarationOfSymbolParameter(symbol) { + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 126; + } + ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; + var displayPartWriter = getDisplayPartWriter(); + function getDisplayPartWriter() { + var displayParts; + var lineStart; + var indent; + resetWriter(); + return { + displayParts: function () { return displayParts; }, + writeKeyword: function (text) { return writeKind(text, 5); }, + writeOperator: function (text) { return writeKind(text, 12); }, + writePunctuation: function (text) { return writeKind(text, 15); }, + writeSpace: function (text) { return writeKind(text, 16); }, + writeStringLiteral: function (text) { return writeKind(text, 8); }, + writeParameter: function (text) { return writeKind(text, 13); }, + writeSymbol: writeSymbol, + writeLine: writeLine, + increaseIndent: function () { indent++; }, + decreaseIndent: function () { indent--; }, + clear: resetWriter, + trackSymbol: function () { } + }; + function writeIndent() { + if (lineStart) { + var indentString = ts.getIndentString(indent); + if (indentString) { + displayParts.push(displayPart(indentString, 16)); + } + lineStart = false; + } + } + function writeKind(text, kind) { + writeIndent(); + displayParts.push(displayPart(text, kind)); + } + function writeSymbol(text, symbol) { + writeIndent(); + displayParts.push(symbolPart(text, symbol)); + } + function writeLine() { + displayParts.push(lineBreakPart()); + lineStart = true; + } + function resetWriter() { + displayParts = []; + lineStart = true; + indent = 0; + } + } + function symbolPart(text, symbol) { + return displayPart(text, displayPartKind(symbol), symbol); + function displayPartKind(symbol) { + var flags = symbol.flags; + if (flags & 3) { + return isFirstDeclarationOfSymbolParameter(symbol) ? 13 : 9; + } + else if (flags & 4) { + return 14; + } + else if (flags & 32768) { + return 14; + } + else if (flags & 65536) { + return 14; + } + else if (flags & 8) { + return 19; + } + else if (flags & 16) { + return 20; + } + else if (flags & 32) { + return 1; + } + else if (flags & 64) { + return 4; + } + else if (flags & 384) { + return 2; + } + else if (flags & 1536) { + return 11; + } + else if (flags & 8192) { + return 10; + } + else if (flags & 262144) { + return 18; + } + else if (flags & 524288) { + return 0; + } + else if (flags & 8388608) { + return 0; + } + return 17; + } + } + ts.symbolPart = symbolPart; + function displayPart(text, kind, symbol) { + return { + text: text, + kind: ts.SymbolDisplayPartKind[kind] + }; + } + ts.displayPart = displayPart; + function spacePart() { + return displayPart(" ", 16); + } + ts.spacePart = spacePart; + function keywordPart(kind) { + return displayPart(ts.tokenToString(kind), 5); + } + ts.keywordPart = keywordPart; + function punctuationPart(kind) { + return displayPart(ts.tokenToString(kind), 15); + } + ts.punctuationPart = punctuationPart; + function operatorPart(kind) { + return displayPart(ts.tokenToString(kind), 12); + } + ts.operatorPart = operatorPart; + function textPart(text) { + return displayPart(text, 17); + } + ts.textPart = textPart; + function lineBreakPart() { + return displayPart("\n", 6); + } + ts.lineBreakPart = lineBreakPart; + function mapToDisplayParts(writeDisplayParts) { + writeDisplayParts(displayPartWriter); + var result = displayPartWriter.displayParts(); + displayPartWriter.clear(); + return result; + } + ts.mapToDisplayParts = mapToDisplayParts; + function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags) { + return mapToDisplayParts(function (writer) { + typechecker.getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); + }); + } + ts.typeToDisplayParts = typeToDisplayParts; + function symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration, meaning, flags) { + return mapToDisplayParts(function (writer) { + typeChecker.getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags); + }); + } + ts.symbolToDisplayParts = symbolToDisplayParts; + function signatureToDisplayParts(typechecker, signature, enclosingDeclaration, flags) { + return mapToDisplayParts(function (writer) { + typechecker.getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags); + }); + } + ts.signatureToDisplayParts = signatureToDisplayParts; +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var scanner = ts.createScanner(2, false); + var ScanAction; + (function (ScanAction) { + ScanAction[ScanAction["Scan"] = 0] = "Scan"; + ScanAction[ScanAction["RescanGreaterThanToken"] = 1] = "RescanGreaterThanToken"; + ScanAction[ScanAction["RescanSlashToken"] = 2] = "RescanSlashToken"; + ScanAction[ScanAction["RescanTemplateToken"] = 3] = "RescanTemplateToken"; + })(ScanAction || (ScanAction = {})); + function getFormattingScanner(sourceFile, startPos, endPos) { + scanner.setText(sourceFile.text); + scanner.setTextPos(startPos); + var wasNewLine = true; + var leadingTrivia; + var trailingTrivia; + var savedPos; + var lastScanAction; + var lastTokenInfo; + return { + advance: advance, + readTokenInfo: readTokenInfo, + isOnToken: isOnToken, + lastTrailingTriviaWasNewLine: function () { return wasNewLine; }, + close: function () { + lastTokenInfo = undefined; + scanner.setText(undefined); + } + }; + function advance() { + lastTokenInfo = undefined; + var isStarted = scanner.getStartPos() !== startPos; + if (isStarted) { + if (trailingTrivia) { + ts.Debug.assert(trailingTrivia.length !== 0); + wasNewLine = trailingTrivia[trailingTrivia.length - 1].kind === 4; + } + else { + wasNewLine = false; + } + } + leadingTrivia = undefined; + trailingTrivia = undefined; + if (!isStarted) { + scanner.scan(); + } + var t; + var pos = scanner.getStartPos(); + while (pos < endPos) { + var t = scanner.getToken(); + if (!ts.isTrivia(t)) { + break; + } + scanner.scan(); + var item = { + pos: pos, + end: scanner.getStartPos(), + kind: t + }; + pos = scanner.getStartPos(); + if (!leadingTrivia) { + leadingTrivia = []; + } + leadingTrivia.push(item); + } + savedPos = scanner.getStartPos(); + } + function shouldRescanGreaterThanToken(node) { + if (node) { + switch (node.kind) { + case 27: + case 59: + case 60: + case 42: + case 41: + return true; + } + } + return false; + } + function shouldRescanSlashToken(container) { + return container.kind === 9; + } + function shouldRescanTemplateToken(container) { + return container.kind === 12 || + container.kind === 13; + } + function startsWithSlashToken(t) { + return t === 36 || t === 56; + } + function readTokenInfo(n) { + if (!isOnToken()) { + return { + leadingTrivia: leadingTrivia, + trailingTrivia: undefined, + token: undefined + }; + } + var expectedScanAction = shouldRescanGreaterThanToken(n) ? 1 : shouldRescanSlashToken(n) ? 2 : shouldRescanTemplateToken(n) ? 3 : 0; + if (lastTokenInfo && expectedScanAction === lastScanAction) { + return fixTokenKind(lastTokenInfo, n); + } + if (scanner.getStartPos() !== savedPos) { + ts.Debug.assert(lastTokenInfo !== undefined); + scanner.setTextPos(savedPos); + scanner.scan(); + } + var currentToken = scanner.getToken(); + if (expectedScanAction === 1 && currentToken === 25) { + currentToken = scanner.reScanGreaterToken(); + ts.Debug.assert(n.kind === currentToken); + lastScanAction = 1; + } + else if (expectedScanAction === 2 && startsWithSlashToken(currentToken)) { + currentToken = scanner.reScanSlashToken(); + ts.Debug.assert(n.kind === currentToken); + lastScanAction = 2; + } + else if (expectedScanAction === 3 && currentToken === 15) { + currentToken = scanner.reScanTemplateToken(); + lastScanAction = 3; + } + else { + lastScanAction = 0; + } + var token = { + pos: scanner.getStartPos(), + end: scanner.getTextPos(), + kind: currentToken + }; + if (trailingTrivia) { + trailingTrivia = undefined; + } + while (scanner.getStartPos() < endPos) { + currentToken = scanner.scan(); + if (!ts.isTrivia(currentToken)) { + break; + } + var trivia = { + pos: scanner.getStartPos(), + end: scanner.getTextPos(), + kind: currentToken + }; + if (!trailingTrivia) { + trailingTrivia = []; + } + trailingTrivia.push(trivia); + if (currentToken === 4) { + scanner.scan(); + break; + } + } + lastTokenInfo = { + leadingTrivia: leadingTrivia, + trailingTrivia: trailingTrivia, + token: token + }; + return fixTokenKind(lastTokenInfo, n); + } + function isOnToken() { + var current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken(); + var startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos(); + return startPos < endPos && current !== 1 && !ts.isTrivia(current); + } + function fixTokenKind(tokenInfo, container) { + if (ts.isToken(container) && tokenInfo.token.kind !== container.kind) { + tokenInfo.token.kind = container.kind; + } + return tokenInfo; + } + } + formatting.getFormattingScanner = getFormattingScanner; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var FormattingContext = (function () { + function FormattingContext(sourceFile, formattingRequestKind) { + this.sourceFile = sourceFile; + this.formattingRequestKind = formattingRequestKind; + } + FormattingContext.prototype.updateContext = function (currentRange, currentTokenParent, nextRange, nextTokenParent, commonParent) { + ts.Debug.assert(currentRange !== undefined, "currentTokenSpan is null"); + ts.Debug.assert(currentTokenParent !== undefined, "currentTokenParent is null"); + ts.Debug.assert(nextRange !== undefined, "nextTokenSpan is null"); + ts.Debug.assert(nextTokenParent !== undefined, "nextTokenParent is null"); + ts.Debug.assert(commonParent !== undefined, "commonParent is null"); + this.currentTokenSpan = currentRange; + this.currentTokenParent = currentTokenParent; + this.nextTokenSpan = nextRange; + this.nextTokenParent = nextTokenParent; + this.contextNode = commonParent; + this.contextNodeAllOnSameLine = undefined; + this.nextNodeAllOnSameLine = undefined; + this.tokensAreOnSameLine = undefined; + this.contextNodeBlockIsOnOneLine = undefined; + this.nextNodeBlockIsOnOneLine = undefined; + }; + FormattingContext.prototype.ContextNodeAllOnSameLine = function () { + if (this.contextNodeAllOnSameLine === undefined) { + this.contextNodeAllOnSameLine = this.NodeIsOnOneLine(this.contextNode); + } + return this.contextNodeAllOnSameLine; + }; + FormattingContext.prototype.NextNodeAllOnSameLine = function () { + if (this.nextNodeAllOnSameLine === undefined) { + this.nextNodeAllOnSameLine = this.NodeIsOnOneLine(this.nextTokenParent); + } + return this.nextNodeAllOnSameLine; + }; + FormattingContext.prototype.TokensAreOnSameLine = function () { + if (this.tokensAreOnSameLine === undefined) { + var startLine = this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(this.nextTokenSpan.pos).line; + this.tokensAreOnSameLine = (startLine == endLine); + } + return this.tokensAreOnSameLine; + }; + FormattingContext.prototype.ContextNodeBlockIsOnOneLine = function () { + if (this.contextNodeBlockIsOnOneLine === undefined) { + this.contextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.contextNode); + } + return this.contextNodeBlockIsOnOneLine; + }; + FormattingContext.prototype.NextNodeBlockIsOnOneLine = function () { + if (this.nextNodeBlockIsOnOneLine === undefined) { + this.nextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.nextTokenParent); + } + return this.nextNodeBlockIsOnOneLine; + }; + FormattingContext.prototype.NodeIsOnOneLine = function (node) { + var startLine = this.sourceFile.getLineAndCharacterOfPosition(node.getStart(this.sourceFile)).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(node.getEnd()).line; + return startLine == endLine; + }; + FormattingContext.prototype.BlockIsOnOneLine = function (node) { + var openBrace = ts.findChildOfKind(node, 14, this.sourceFile); + var closeBrace = ts.findChildOfKind(node, 15, this.sourceFile); + if (openBrace && closeBrace) { + var startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line; + return startLine === endLine; + } + return false; + }; + return FormattingContext; + })(); + formatting.FormattingContext = FormattingContext; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + (function (FormattingRequestKind) { + FormattingRequestKind[FormattingRequestKind["FormatDocument"] = 0] = "FormatDocument"; + FormattingRequestKind[FormattingRequestKind["FormatSelection"] = 1] = "FormatSelection"; + FormattingRequestKind[FormattingRequestKind["FormatOnEnter"] = 2] = "FormatOnEnter"; + FormattingRequestKind[FormattingRequestKind["FormatOnSemicolon"] = 3] = "FormatOnSemicolon"; + FormattingRequestKind[FormattingRequestKind["FormatOnClosingCurlyBrace"] = 4] = "FormatOnClosingCurlyBrace"; + })(formatting.FormattingRequestKind || (formatting.FormattingRequestKind = {})); + var FormattingRequestKind = formatting.FormattingRequestKind; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var Rule = (function () { + function Rule(Descriptor, Operation, Flag) { + if (Flag === void 0) { Flag = 0; } + this.Descriptor = Descriptor; + this.Operation = Operation; + this.Flag = Flag; + } + Rule.prototype.toString = function () { + return "[desc=" + this.Descriptor + "," + + "operation=" + this.Operation + "," + + "flag=" + this.Flag + "]"; + }; + return Rule; + })(); + formatting.Rule = Rule; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + (function (RuleAction) { + RuleAction[RuleAction["Ignore"] = 1] = "Ignore"; + RuleAction[RuleAction["Space"] = 2] = "Space"; + RuleAction[RuleAction["NewLine"] = 4] = "NewLine"; + RuleAction[RuleAction["Delete"] = 8] = "Delete"; + })(formatting.RuleAction || (formatting.RuleAction = {})); + var RuleAction = formatting.RuleAction; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RuleDescriptor = (function () { + function RuleDescriptor(LeftTokenRange, RightTokenRange) { + this.LeftTokenRange = LeftTokenRange; + this.RightTokenRange = RightTokenRange; + } + RuleDescriptor.prototype.toString = function () { + return "[leftRange=" + this.LeftTokenRange + "," + + "rightRange=" + this.RightTokenRange + "]"; + }; + RuleDescriptor.create1 = function (left, right) { + return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), formatting.Shared.TokenRange.FromToken(right)); + }; + RuleDescriptor.create2 = function (left, right) { + return RuleDescriptor.create4(left, formatting.Shared.TokenRange.FromToken(right)); + }; + RuleDescriptor.create3 = function (left, right) { + return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), right); + }; + RuleDescriptor.create4 = function (left, right) { + return new RuleDescriptor(left, right); + }; + return RuleDescriptor; + })(); + formatting.RuleDescriptor = RuleDescriptor; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + (function (RuleFlags) { + RuleFlags[RuleFlags["None"] = 0] = "None"; + RuleFlags[RuleFlags["CanDeleteNewLines"] = 1] = "CanDeleteNewLines"; + })(formatting.RuleFlags || (formatting.RuleFlags = {})); + var RuleFlags = formatting.RuleFlags; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RuleOperation = (function () { + function RuleOperation() { + this.Context = null; + this.Action = null; + } + RuleOperation.prototype.toString = function () { + return "[context=" + this.Context + "," + + "action=" + this.Action + "]"; + }; + RuleOperation.create1 = function (action) { + return RuleOperation.create2(formatting.RuleOperationContext.Any, action); + }; + RuleOperation.create2 = function (context, action) { + var result = new RuleOperation(); + result.Context = context; + result.Action = action; + return result; + }; + return RuleOperation; + })(); + formatting.RuleOperation = RuleOperation; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RuleOperationContext = (function () { + function RuleOperationContext() { + var funcs = []; + for (var _i = 0; _i < arguments.length; _i++) { + funcs[_i - 0] = arguments[_i]; + } + this.customContextChecks = funcs; + } + RuleOperationContext.prototype.IsAny = function () { + return this == RuleOperationContext.Any; + }; + RuleOperationContext.prototype.InContext = function (context) { + if (this.IsAny()) { + return true; + } + for (var i = 0, len = this.customContextChecks.length; i < len; i++) { + if (!this.customContextChecks[i](context)) { + return false; + } + } + return true; + }; + RuleOperationContext.Any = new RuleOperationContext(); + return RuleOperationContext; + })(); + formatting.RuleOperationContext = RuleOperationContext; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var Rules = (function () { + function Rules() { + 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, 22), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 51), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceBeforeQMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 50), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(51, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2)); + this.SpaceAfterQMark = new formatting.Rule(formatting.RuleDescriptor.create3(50, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2)); + this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(22, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); + this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(15, 75), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(15, 99), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.FromTokens([17, 19, 23, 22])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(20, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(18, 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, 19), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; + this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); + this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([64, 3]); + this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); + this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([17, 3, 74, 95, 80, 75]); + this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); + this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(14, 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, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); + this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(14, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectContext), 8)); + this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(14, 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, 15), 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(38, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(39, 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, 38), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 39), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(38, 33), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(33, 33), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(33, 38), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(39, 34), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(34, 34), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(34, 39), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([97, 93, 87, 73, 89, 96]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8)); + this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(82, 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, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 8)); + this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(98, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2)); + this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(89, 22), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([17, 74, 75, 66]), 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([95, 80]), 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([114, 118]), 64), 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(112, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([115, 116]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([68, 113, 76, 77, 78, 114, 101, 84, 102, 115, 105, 107, 118, 108]), 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([78, 101])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(8, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2)); + this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(32, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(21, 64), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(50, formatting.Shared.TokenRange.FromTokens([17, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); + this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(17, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); + this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.TypeNames), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); + this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); + this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.FromTokens([16, 18, 25, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); + this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(14, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8)); + this.HighPriorityCommonRules = + [ + this.IgnoreBeforeComment, this.IgnoreAfterLineComment, + this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQMark, this.SpaceAfterQMark, + this.NoSpaceBeforeDot, this.NoSpaceAfterDot, + this.NoSpaceAfterUnaryPrefixOperator, + this.NoSpaceAfterUnaryPreincrementOperator, this.NoSpaceAfterUnaryPredecrementOperator, + this.NoSpaceBeforeUnaryPostincrementOperator, this.NoSpaceBeforeUnaryPostdecrementOperator, + this.SpaceAfterPostincrementWhenFollowedByAdd, + this.SpaceAfterAddWhenFollowedByUnaryPlus, this.SpaceAfterAddWhenFollowedByPreincrement, + this.SpaceAfterPostdecrementWhenFollowedBySubtract, + this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement, + this.NoSpaceAfterCloseBrace, + this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NewLineBeforeCloseBraceInBlockContext, + this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets, + this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember, + this.NoSpaceBetweenReturnAndSemicolon, + this.SpaceAfterCertainKeywords, + this.NoSpaceBeforeOpenParenInFuncCall, + this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, + this.SpaceAfterVoidOperator, + this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, + this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, + this.SpaceAfterModuleName, + this.SpaceAfterArrow, + this.NoSpaceAfterEllipsis, + this.NoSpaceAfterOptionalParameters, + this.NoSpaceBetweenEmptyInterfaceBraceBrackets, + this.NoSpaceBeforeOpenAngularBracket, + this.NoSpaceBetweenCloseParenAndAngularBracket, + this.NoSpaceAfterOpenAngularBracket, + this.NoSpaceBeforeCloseAngularBracket, + this.NoSpaceAfterCloseAngularBracket + ]; + this.LowPriorityCommonRules = + [ + this.NoSpaceBeforeSemicolon, + this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, + this.NoSpaceBeforeComma, + this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterOpenBracket, + this.NoSpaceBeforeCloseBracket, this.NoSpaceAfterCloseBracket, + this.SpaceAfterSemicolon, + this.NoSpaceBeforeOpenParenInFuncDecl, + this.SpaceBetweenStatements, this.SpaceAfterTryFinally + ]; + this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.NoSpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 8)); + this.NoSpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 8)); + this.SpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 2)); + this.NoSpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 8)); + this.NewLineBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeMultilineBlockContext), 4), 1); + this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsBeforeMultilineBlockContext), 4), 1); + this.NewLineBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), 4), 1); + this.SpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(22, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 2)); + this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(22, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 8)); + this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(16, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(82, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(82, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8)); + } + Rules.prototype.getRuleName = function (rule) { + var o = this; + for (var name in o) { + if (o[name] === rule) { + return name; + } + } + throw new Error("Unknown rule"); + }; + Rules.IsForContext = function (context) { + return context.contextNode.kind === 179; + }; + Rules.IsNotForContext = function (context) { + return !Rules.IsForContext(context); + }; + Rules.IsBinaryOpContext = function (context) { + switch (context.contextNode.kind) { + case 165: + case 166: + return true; + case 200: + case 191: + case 126: + case 209: + case 128: + case 127: + return context.currentTokenSpan.kind === 52 || context.nextTokenSpan.kind === 52; + case 180: + return context.currentTokenSpan.kind === 85 || context.nextTokenSpan.kind === 85; + case 181: + return context.currentTokenSpan.kind === 122 || context.nextTokenSpan.kind === 122; + } + return false; + }; + Rules.IsNotBinaryOpContext = function (context) { + return !Rules.IsBinaryOpContext(context); + }; + Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { + return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); + }; + Rules.IsBeforeMultilineBlockContext = function (context) { + return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); + }; + Rules.IsMultilineBlockContext = function (context) { + return Rules.IsBlockContext(context) && !(context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine()); + }; + Rules.IsSingleLineBlockContext = function (context) { + return Rules.IsBlockContext(context) && (context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine()); + }; + Rules.IsBlockContext = function (context) { + return Rules.NodeIsBlockContext(context.contextNode); + }; + Rules.IsBeforeBlockContext = function (context) { + return Rules.NodeIsBlockContext(context.nextTokenParent); + }; + Rules.NodeIsBlockContext = function (node) { + if (Rules.NodeIsTypeScriptDeclWithBlockContext(node)) { + return true; + } + switch (node.kind) { + case 172: + case 186: + case 150: + case 199: + return true; + } + return false; + }; + Rules.IsFunctionDeclContext = function (context) { + switch (context.contextNode.kind) { + case 193: + case 130: + case 129: + case 132: + case 133: + case 134: + case 158: + case 131: + case 159: + case 195: + return true; + } + return false; + }; + Rules.IsTypeScriptDeclWithBlockContext = function (context) { + return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); + }; + Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { + switch (node.kind) { + case 194: + case 195: + case 197: + case 141: + case 198: + return true; + } + return false; + }; + Rules.IsAfterCodeBlockContext = function (context) { + switch (context.currentTokenParent.kind) { + case 194: + case 198: + case 197: + case 172: + case 206: + case 199: + case 186: + return true; + } + return false; + }; + Rules.IsControlDeclContext = function (context) { + switch (context.contextNode.kind) { + case 176: + case 186: + case 179: + case 180: + case 181: + case 178: + case 189: + case 177: + case 185: + case 206: + return true; + default: + return false; + } + }; + Rules.IsObjectContext = function (context) { + return context.contextNode.kind === 150; + }; + Rules.IsFunctionCallContext = function (context) { + return context.contextNode.kind === 153; + }; + Rules.IsNewContext = function (context) { + return context.contextNode.kind === 154; + }; + Rules.IsFunctionCallOrNewContext = function (context) { + return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); + }; + Rules.IsPreviousTokenNotComma = function (context) { + return context.currentTokenSpan.kind !== 23; + }; + Rules.IsSameLineTokenContext = function (context) { + return context.TokensAreOnSameLine(); + }; + Rules.IsNotFormatOnEnter = function (context) { + return context.formattingRequestKind != 2; + }; + Rules.IsModuleDeclContext = function (context) { + return context.contextNode.kind === 198; + }; + Rules.IsObjectTypeContext = function (context) { + return context.contextNode.kind === 141; + }; + Rules.IsTypeArgumentOrParameter = function (token, parent) { + if (token.kind !== 24 && token.kind !== 25) { + return false; + } + switch (parent.kind) { + case 137: + case 194: + case 195: + case 193: + case 158: + case 159: + case 130: + case 129: + case 134: + case 135: + case 153: + case 154: + return true; + default: + return false; + } + }; + Rules.IsTypeArgumentOrParameterContext = function (context) { + return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || + Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); + }; + Rules.IsVoidOpContext = function (context) { + return context.currentTokenSpan.kind === 98 && context.currentTokenParent.kind === 162; + }; + return Rules; + })(); + formatting.Rules = Rules; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RulesMap = (function () { + function RulesMap() { + this.map = []; + this.mapRowLength = 0; + } + RulesMap.create = function (rules) { + var result = new RulesMap(); + result.Initialize(rules); + return result; + }; + RulesMap.prototype.Initialize = function (rules) { + this.mapRowLength = 122 + 1; + this.map = new Array(this.mapRowLength * this.mapRowLength); + var rulesBucketConstructionStateList = new Array(this.map.length); + this.FillRules(rules, rulesBucketConstructionStateList); + return this.map; + }; + RulesMap.prototype.FillRules = function (rules, rulesBucketConstructionStateList) { + var _this = this; + rules.forEach(function (rule) { + _this.FillRule(rule, rulesBucketConstructionStateList); + }); + }; + RulesMap.prototype.GetRuleBucketIndex = function (row, column) { + var rulesBucketIndex = (row * this.mapRowLength) + column; + return rulesBucketIndex; + }; + RulesMap.prototype.FillRule = function (rule, rulesBucketConstructionStateList) { + var _this = this; + var specificRule = rule.Descriptor.LeftTokenRange != formatting.Shared.TokenRange.Any && + rule.Descriptor.RightTokenRange != formatting.Shared.TokenRange.Any; + rule.Descriptor.LeftTokenRange.GetTokens().forEach(function (left) { + rule.Descriptor.RightTokenRange.GetTokens().forEach(function (right) { + var rulesBucketIndex = _this.GetRuleBucketIndex(left, right); + var rulesBucket = _this.map[rulesBucketIndex]; + if (rulesBucket == undefined) { + rulesBucket = _this.map[rulesBucketIndex] = new RulesBucket(); + } + rulesBucket.AddRule(rule, specificRule, rulesBucketConstructionStateList, rulesBucketIndex); + }); + }); + }; + RulesMap.prototype.GetRule = function (context) { + var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); + var bucket = this.map[bucketIndex]; + if (bucket != null) { + for (var i = 0, len = bucket.Rules().length; i < len; i++) { + var rule = bucket.Rules()[i]; + if (rule.Operation.Context.InContext(context)) + return rule; + } + } + return null; + }; + return RulesMap; + })(); + formatting.RulesMap = RulesMap; + var MaskBitSize = 5; + var Mask = 0x1f; + (function (RulesPosition) { + RulesPosition[RulesPosition["IgnoreRulesSpecific"] = 0] = "IgnoreRulesSpecific"; + RulesPosition[RulesPosition["IgnoreRulesAny"] = MaskBitSize * 1] = "IgnoreRulesAny"; + RulesPosition[RulesPosition["ContextRulesSpecific"] = MaskBitSize * 2] = "ContextRulesSpecific"; + RulesPosition[RulesPosition["ContextRulesAny"] = MaskBitSize * 3] = "ContextRulesAny"; + RulesPosition[RulesPosition["NoContextRulesSpecific"] = MaskBitSize * 4] = "NoContextRulesSpecific"; + RulesPosition[RulesPosition["NoContextRulesAny"] = MaskBitSize * 5] = "NoContextRulesAny"; + })(formatting.RulesPosition || (formatting.RulesPosition = {})); + var RulesPosition = formatting.RulesPosition; + var RulesBucketConstructionState = (function () { + function RulesBucketConstructionState() { + this.rulesInsertionIndexBitmap = 0; + } + RulesBucketConstructionState.prototype.GetInsertionIndex = function (maskPosition) { + var index = 0; + var pos = 0; + var indexBitmap = this.rulesInsertionIndexBitmap; + while (pos <= maskPosition) { + index += (indexBitmap & Mask); + indexBitmap >>= MaskBitSize; + pos += MaskBitSize; + } + return index; + }; + RulesBucketConstructionState.prototype.IncreaseInsertionIndex = function (maskPosition) { + var value = (this.rulesInsertionIndexBitmap >> maskPosition) & Mask; + value++; + ts.Debug.assert((value & Mask) == value, "Adding more rules into the sub-bucket than allowed. Maximum allowed is 32 rules."); + var temp = this.rulesInsertionIndexBitmap & ~(Mask << maskPosition); + temp |= value << maskPosition; + this.rulesInsertionIndexBitmap = temp; + }; + return RulesBucketConstructionState; + })(); + formatting.RulesBucketConstructionState = RulesBucketConstructionState; + var RulesBucket = (function () { + function RulesBucket() { + this.rules = []; + } + RulesBucket.prototype.Rules = function () { + return this.rules; + }; + RulesBucket.prototype.AddRule = function (rule, specificTokens, constructionState, rulesBucketIndex) { + var position; + if (rule.Operation.Action == 1) { + position = specificTokens ? 0 : RulesPosition.IgnoreRulesAny; + } + else if (!rule.Operation.Context.IsAny()) { + position = specificTokens ? RulesPosition.ContextRulesSpecific : RulesPosition.ContextRulesAny; + } + else { + position = specificTokens ? RulesPosition.NoContextRulesSpecific : RulesPosition.NoContextRulesAny; + } + var state = constructionState[rulesBucketIndex]; + if (state === undefined) { + state = constructionState[rulesBucketIndex] = new RulesBucketConstructionState(); + } + var index = state.GetInsertionIndex(position); + this.rules.splice(index, 0, rule); + state.IncreaseInsertionIndex(position); + }; + return RulesBucket; + })(); + formatting.RulesBucket = RulesBucket; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var Shared; + (function (Shared) { + var TokenRangeAccess = (function () { + function TokenRangeAccess(from, to, except) { + this.tokens = []; + for (var token = from; token <= to; token++) { + if (except.indexOf(token) < 0) { + this.tokens.push(token); + } + } + } + TokenRangeAccess.prototype.GetTokens = function () { + return this.tokens; + }; + TokenRangeAccess.prototype.Contains = function (token) { + return this.tokens.indexOf(token) >= 0; + }; + return TokenRangeAccess; + })(); + Shared.TokenRangeAccess = TokenRangeAccess; + var TokenValuesAccess = (function () { + function TokenValuesAccess(tks) { + this.tokens = tks && tks.length ? tks : []; + } + TokenValuesAccess.prototype.GetTokens = function () { + return this.tokens; + }; + TokenValuesAccess.prototype.Contains = function (token) { + return this.tokens.indexOf(token) >= 0; + }; + return TokenValuesAccess; + })(); + Shared.TokenValuesAccess = TokenValuesAccess; + var TokenSingleValueAccess = (function () { + function TokenSingleValueAccess(token) { + this.token = token; + } + TokenSingleValueAccess.prototype.GetTokens = function () { + return [this.token]; + }; + TokenSingleValueAccess.prototype.Contains = function (tokenValue) { + return tokenValue == this.token; + }; + return TokenSingleValueAccess; + })(); + Shared.TokenSingleValueAccess = TokenSingleValueAccess; + var TokenAllAccess = (function () { + function TokenAllAccess() { + } + TokenAllAccess.prototype.GetTokens = function () { + var result = []; + for (var token = 0; token <= 122; token++) { + result.push(token); + } + return result; + }; + TokenAllAccess.prototype.Contains = function (tokenValue) { + return true; + }; + TokenAllAccess.prototype.toString = function () { + return "[allTokens]"; + }; + return TokenAllAccess; + })(); + Shared.TokenAllAccess = TokenAllAccess; + var TokenRange = (function () { + function TokenRange(tokenAccess) { + this.tokenAccess = tokenAccess; + } + TokenRange.FromToken = function (token) { + return new TokenRange(new TokenSingleValueAccess(token)); + }; + TokenRange.FromTokens = function (tokens) { + return new TokenRange(new TokenValuesAccess(tokens)); + }; + TokenRange.FromRange = function (f, to, except) { + if (except === void 0) { except = []; } + return new TokenRange(new TokenRangeAccess(f, to, except)); + }; + TokenRange.AllTokens = function () { + return new TokenRange(new TokenAllAccess()); + }; + TokenRange.prototype.GetTokens = function () { + return this.tokenAccess.GetTokens(); + }; + TokenRange.prototype.Contains = function (token) { + return this.tokenAccess.Contains(token); + }; + TokenRange.prototype.toString = function () { + return this.tokenAccess.toString(); + }; + TokenRange.Any = TokenRange.AllTokens(); + TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3])); + TokenRange.Keywords = TokenRange.FromRange(65, 122); + TokenRange.BinaryOperators = TokenRange.FromRange(24, 63); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([85, 86, 122]); + TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([38, 39, 47, 46]); + TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([7, 64, 16, 18, 14, 92, 87]); + TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([64, 16, 92, 87]); + TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([64, 17, 19, 87]); + TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([64, 16, 92, 87]); + TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([64, 17, 19, 87]); + TokenRange.Comments = TokenRange.FromTokens([2, 3]); + TokenRange.TypeNames = TokenRange.FromTokens([64, 117, 119, 111, 120, 98, 110]); + return TokenRange; + })(); + Shared.TokenRange = TokenRange; + })(Shared = formatting.Shared || (formatting.Shared = {})); + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RulesProvider = (function () { + function RulesProvider() { + this.globalRules = new formatting.Rules(); + } + RulesProvider.prototype.getRuleName = function (rule) { + return this.globalRules.getRuleName(rule); + }; + RulesProvider.prototype.getRuleByName = function (name) { + return this.globalRules[name]; + }; + RulesProvider.prototype.getRulesMap = function () { + return this.rulesMap; + }; + RulesProvider.prototype.ensureUpToDate = function (options) { + if (this.options == null || !ts.compareDataObjects(this.options, options)) { + var activeRules = this.createActiveRules(options); + var rulesMap = formatting.RulesMap.create(activeRules); + this.activeRules = activeRules; + this.rulesMap = rulesMap; + this.options = ts.clone(options); + } + }; + RulesProvider.prototype.createActiveRules = function (options) { + var rules = this.globalRules.HighPriorityCommonRules.slice(0); + if (options.InsertSpaceAfterCommaDelimiter) { + rules.push(this.globalRules.SpaceAfterComma); + } + else { + rules.push(this.globalRules.NoSpaceAfterComma); + } + if (options.InsertSpaceAfterFunctionKeywordForAnonymousFunctions) { + rules.push(this.globalRules.SpaceAfterAnonymousFunctionKeyword); + } + else { + rules.push(this.globalRules.NoSpaceAfterAnonymousFunctionKeyword); + } + if (options.InsertSpaceAfterKeywordsInControlFlowStatements) { + rules.push(this.globalRules.SpaceAfterKeywordInControl); + } + else { + rules.push(this.globalRules.NoSpaceAfterKeywordInControl); + } + if (options.InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis) { + rules.push(this.globalRules.SpaceAfterOpenParen); + rules.push(this.globalRules.SpaceBeforeCloseParen); + rules.push(this.globalRules.NoSpaceBetweenParens); + } + else { + rules.push(this.globalRules.NoSpaceAfterOpenParen); + rules.push(this.globalRules.NoSpaceBeforeCloseParen); + rules.push(this.globalRules.NoSpaceBetweenParens); + } + if (options.InsertSpaceAfterSemicolonInForStatements) { + rules.push(this.globalRules.SpaceAfterSemicolonInFor); + } + else { + rules.push(this.globalRules.NoSpaceAfterSemicolonInFor); + } + if (options.InsertSpaceBeforeAndAfterBinaryOperators) { + rules.push(this.globalRules.SpaceBeforeBinaryOperator); + rules.push(this.globalRules.SpaceAfterBinaryOperator); + } + else { + rules.push(this.globalRules.NoSpaceBeforeBinaryOperator); + rules.push(this.globalRules.NoSpaceAfterBinaryOperator); + } + if (options.PlaceOpenBraceOnNewLineForControlBlocks) { + rules.push(this.globalRules.NewLineBeforeOpenBraceInControl); + } + if (options.PlaceOpenBraceOnNewLineForFunctions) { + rules.push(this.globalRules.NewLineBeforeOpenBraceInFunction); + rules.push(this.globalRules.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock); + } + rules = rules.concat(this.globalRules.LowPriorityCommonRules); + return rules; + }; + return RulesProvider; + })(); + formatting.RulesProvider = RulesProvider; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var Constants; + (function (Constants) { + Constants[Constants["Unknown"] = -1] = "Unknown"; + })(Constants || (Constants = {})); + function formatOnEnter(position, sourceFile, rulesProvider, options) { + var line = sourceFile.getLineAndCharacterOfPosition(position).line; + if (line === 0) { + return []; + } + var span = { + pos: ts.getStartPositionOfLine(line - 1, sourceFile), + end: ts.getEndLinePosition(line, sourceFile) + 1 + }; + return formatSpan(span, sourceFile, options, rulesProvider, 2); + } + formatting.formatOnEnter = formatOnEnter; + function formatOnSemicolon(position, sourceFile, rulesProvider, options) { + return formatOutermostParent(position, 22, sourceFile, options, rulesProvider, 3); + } + formatting.formatOnSemicolon = formatOnSemicolon; + function formatOnClosingCurly(position, sourceFile, rulesProvider, options) { + return formatOutermostParent(position, 15, sourceFile, options, rulesProvider, 4); + } + formatting.formatOnClosingCurly = formatOnClosingCurly; + function formatDocument(sourceFile, rulesProvider, options) { + var span = { + pos: 0, + end: sourceFile.text.length + }; + return formatSpan(span, sourceFile, options, rulesProvider, 0); + } + formatting.formatDocument = formatDocument; + function formatSelection(start, end, sourceFile, rulesProvider, options) { + var span = { + pos: ts.getLineStartPositionForPosition(start, sourceFile), + end: end + }; + return formatSpan(span, sourceFile, options, rulesProvider, 1); + } + formatting.formatSelection = formatSelection; + function formatOutermostParent(position, expectedLastToken, sourceFile, options, rulesProvider, requestKind) { + var parent = findOutermostParent(position, expectedLastToken, sourceFile); + if (!parent) { + return []; + } + var span = { + pos: ts.getLineStartPositionForPosition(parent.getStart(sourceFile), sourceFile), + end: parent.end + }; + return formatSpan(span, sourceFile, options, rulesProvider, requestKind); + } + function findOutermostParent(position, expectedTokenKind, sourceFile) { + var precedingToken = ts.findPrecedingToken(position, sourceFile); + if (!precedingToken || + precedingToken.kind !== expectedTokenKind || + position !== precedingToken.getEnd()) { + return undefined; + } + var current = precedingToken; + while (current && + current.parent && + current.parent.end === precedingToken.end && + !isListElement(current.parent, current)) { + current = current.parent; + } + return current; + } + function isListElement(parent, node) { + switch (parent.kind) { + case 194: + case 195: + return ts.rangeContainsRange(parent.members, node); + case 198: + var body = parent.body; + return body && body.kind === 172 && ts.rangeContainsRange(body.statements, node); + case 210: + case 172: + case 199: + return ts.rangeContainsRange(parent.statements, node); + case 206: + return ts.rangeContainsRange(parent.block.statements, node); + } + return false; + } + function findEnclosingNode(range, sourceFile) { + return find(sourceFile); + function find(n) { + var candidate = ts.forEachChild(n, function (c) { return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c; }); + if (candidate) { + var result = find(candidate); + if (result) { + return result; + } + } + return n; + } + } + function prepareRangeContainsErrorFunction(errors, originalRange) { + if (!errors.length) { + return rangeHasNoErrors; + } + var sorted = errors.filter(function (d) { return ts.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length); }).sort(function (e1, e2) { return e1.start - e2.start; }); + if (!sorted.length) { + return rangeHasNoErrors; + } + var index = 0; + return function (r) { + while (true) { + if (index >= sorted.length) { + return false; + } + var error = sorted[index]; + if (r.end <= error.start) { + return false; + } + if (ts.startEndOverlapsWithStartEnd(r.pos, r.end, error.start, error.start + error.length)) { + return true; + } + index++; + } + }; + function rangeHasNoErrors(r) { + return false; + } + } + function getScanStartPosition(enclosingNode, originalRange, sourceFile) { + var start = enclosingNode.getStart(sourceFile); + if (start === originalRange.pos && enclosingNode.end === originalRange.end) { + return start; + } + var precedingToken = ts.findPrecedingToken(originalRange.pos, sourceFile); + if (!precedingToken) { + return enclosingNode.pos; + } + if (precedingToken.end >= originalRange.pos) { + return enclosingNode.pos; + } + return precedingToken.end; + } + function getOwnOrInheritedDelta(n, options, sourceFile) { + var previousLine = -1; + var childKind = 0; + while (n) { + var line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line; + if (previousLine !== -1 && line !== previousLine) { + break; + } + if (formatting.SmartIndenter.shouldIndentChildNode(n.kind, childKind)) { + return options.IndentSize; + } + previousLine = line; + childKind = n.kind; + n = n.parent; + } + return 0; + } + function formatSpan(originalRange, sourceFile, options, rulesProvider, requestKind) { + var rangeContainsError = prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange); + var formattingContext = new formatting.FormattingContext(sourceFile, requestKind); + var enclosingNode = findEnclosingNode(originalRange, sourceFile); + var formattingScanner = formatting.getFormattingScanner(sourceFile, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end); + var initialIndentation = formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, options); + var previousRangeHasError; + var previousRange; + var previousParent; + var previousRangeStartLine; + var edits = []; + formattingScanner.advance(); + if (formattingScanner.isOnToken()) { + var startLine = sourceFile.getLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line; + var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile); + processNode(enclosingNode, enclosingNode, startLine, initialIndentation, delta); + } + formattingScanner.close(); + return edits; + function tryComputeIndentationForListItem(startPos, endPos, parentStartLine, range, inheritedIndentation) { + if (ts.rangeOverlapsWithStartEnd(range, startPos, endPos)) { + if (inheritedIndentation !== -1) { + return inheritedIndentation; + } + } + else { + var startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line; + var startLinePosition = ts.getLineStartPositionForPosition(startPos, sourceFile); + var column = formatting.SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options); + if (startLine !== parentStartLine || startPos === column) { + return column; + } + } + return -1; + } + function computeIndentation(node, startLine, inheritedIndentation, parent, parentDynamicIndentation, effectiveParentStartLine) { + var indentation = inheritedIndentation; + if (indentation === -1) { + if (isSomeBlock(node.kind)) { + if (isSomeBlock(parent.kind) || + parent.kind === 210 || + parent.kind === 203 || + parent.kind === 204) { + indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); + } + else { + indentation = parentDynamicIndentation.getIndentation(); + } + } + else { + if (formatting.SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) { + indentation = parentDynamicIndentation.getIndentation(); + } + else { + indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); + } + } + } + var delta = formatting.SmartIndenter.shouldIndentChildNode(node.kind, 0) ? options.IndentSize : 0; + if (effectiveParentStartLine === startLine) { + indentation = parentDynamicIndentation.getIndentation(); + delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta() + delta); + } + return { + indentation: indentation, + delta: delta + }; + } + function getDynamicIndentation(node, nodeStartLine, indentation, delta) { + return { + getIndentationForComment: function (kind) { + switch (kind) { + case 15: + case 19: + return indentation + delta; + } + return indentation; + }, + getIndentationForToken: function (line, kind) { + switch (kind) { + case 14: + case 15: + case 18: + case 19: + case 75: + case 99: + return indentation; + default: + return nodeStartLine !== line ? indentation + delta : indentation; + } + }, + getIndentation: function () { return indentation; }, + getDelta: function () { return delta; }, + recomputeIndentation: function (lineAdded) { + if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent.kind, node.kind)) { + if (lineAdded) { + indentation += options.IndentSize; + } + else { + indentation -= options.IndentSize; + } + if (formatting.SmartIndenter.shouldIndentChildNode(node.kind, 0)) { + delta = options.IndentSize; + } + else { + delta = 0; + } + } + } + }; + } + function processNode(node, contextNode, nodeStartLine, indentation, delta) { + if (!ts.rangeOverlapsWithStartEnd(originalRange, node.getStart(sourceFile), node.getEnd())) { + return; + } + var nodeDynamicIndentation = getDynamicIndentation(node, nodeStartLine, indentation, delta); + var childContextNode = contextNode; + ts.forEachChild(node, function (child) { + processChildNode(child, -1, node, nodeDynamicIndentation, nodeStartLine, false); + }, function (nodes) { + processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation); + }); + while (formattingScanner.isOnToken()) { + var tokenInfo = formattingScanner.readTokenInfo(node); + if (tokenInfo.token.end > node.end) { + break; + } + consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation); + } + function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, isListItem) { + var childStartPos = child.getStart(sourceFile); + var childStart = sourceFile.getLineAndCharacterOfPosition(childStartPos); + var childIndentationAmount = -1; + if (isListItem) { + childIndentationAmount = tryComputeIndentationForListItem(childStartPos, child.end, parentStartLine, originalRange, inheritedIndentation); + if (childIndentationAmount !== -1) { + inheritedIndentation = childIndentationAmount; + } + } + if (!ts.rangeOverlapsWithStartEnd(originalRange, child.pos, child.end)) { + return inheritedIndentation; + } + if (child.getFullWidth() === 0) { + return inheritedIndentation; + } + while (formattingScanner.isOnToken()) { + var tokenInfo = formattingScanner.readTokenInfo(node); + if (tokenInfo.token.end > childStartPos) { + break; + } + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + } + if (!formattingScanner.isOnToken()) { + return inheritedIndentation; + } + if (ts.isToken(child)) { + var tokenInfo = formattingScanner.readTokenInfo(child); + ts.Debug.assert(tokenInfo.token.end === child.end); + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + return inheritedIndentation; + } + var childIndentation = computeIndentation(child, childStart.line, childIndentationAmount, node, parentDynamicIndentation, parentStartLine); + processNode(child, childContextNode, childStart.line, childIndentation.indentation, childIndentation.delta); + childContextNode = node; + return inheritedIndentation; + } + function processChildNodes(nodes, parent, parentStartLine, parentDynamicIndentation) { + var listStartToken = getOpenTokenForList(parent, nodes); + var listEndToken = getCloseTokenForOpenToken(listStartToken); + var listDynamicIndentation = parentDynamicIndentation; + var startLine = parentStartLine; + if (listStartToken !== 0) { + while (formattingScanner.isOnToken()) { + var tokenInfo = formattingScanner.readTokenInfo(parent); + if (tokenInfo.token.end > nodes.pos) { + break; + } + else if (tokenInfo.token.kind === listStartToken) { + startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; + var indentation = computeIndentation(tokenInfo.token, startLine, -1, parent, parentDynamicIndentation, startLine); + listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation.indentation, indentation.delta); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + } + else { + consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation); + } + } + } + var inheritedIndentation = -1; + for (var i = 0, len = nodes.length; i < len; ++i) { + inheritedIndentation = processChildNode(nodes[i], inheritedIndentation, node, listDynamicIndentation, startLine, true); + } + if (listEndToken !== 0) { + if (formattingScanner.isOnToken()) { + var tokenInfo = formattingScanner.readTokenInfo(parent); + if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) { + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + } + } + } + } + function consumeTokenAndAdvanceScanner(currentTokenInfo, parent, dynamicIndentation) { + ts.Debug.assert(ts.rangeContainsRange(parent, currentTokenInfo.token)); + var lastTriviaWasNewLine = formattingScanner.lastTrailingTriviaWasNewLine(); + var indentToken = false; + if (currentTokenInfo.leadingTrivia) { + processTrivia(currentTokenInfo.leadingTrivia, parent, childContextNode, dynamicIndentation); + } + var lineAdded; + var isTokenInRange = ts.rangeContainsRange(originalRange, currentTokenInfo.token); + var tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos); + if (isTokenInRange) { + var rangeHasError = rangeContainsError(currentTokenInfo.token); + var prevStartLine = previousRangeStartLine; + lineAdded = processRange(currentTokenInfo.token, tokenStart, parent, childContextNode, dynamicIndentation); + if (rangeHasError) { + indentToken = false; + } + else { + if (lineAdded !== undefined) { + indentToken = lineAdded; + } + else { + indentToken = lastTriviaWasNewLine && tokenStart.line !== prevStartLine; + } + } + } + if (currentTokenInfo.trailingTrivia) { + processTrivia(currentTokenInfo.trailingTrivia, parent, childContextNode, dynamicIndentation); + } + if (indentToken) { + var indentNextTokenOrTrivia = true; + if (currentTokenInfo.leadingTrivia) { + for (var i = 0, len = currentTokenInfo.leadingTrivia.length; i < len; ++i) { + var triviaItem = currentTokenInfo.leadingTrivia[i]; + if (!ts.rangeContainsRange(originalRange, triviaItem)) { + continue; + } + var triviaStartLine = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos).line; + switch (triviaItem.kind) { + case 3: + var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); + indentMultilineComment(triviaItem, commentIndentation, !indentNextTokenOrTrivia); + indentNextTokenOrTrivia = false; + break; + case 2: + if (indentNextTokenOrTrivia) { + var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); + insertIndentation(triviaItem.pos, commentIndentation, false); + indentNextTokenOrTrivia = false; + } + break; + case 4: + indentNextTokenOrTrivia = true; + break; + } + } + } + if (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) { + var tokenIndentation = dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind); + insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded); + } + } + formattingScanner.advance(); + childContextNode = parent; + } + } + function processTrivia(trivia, parent, contextNode, dynamicIndentation) { + for (var i = 0, len = trivia.length; i < len; ++i) { + var triviaItem = trivia[i]; + if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { + var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); + processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation); + } + } + } + function processRange(range, rangeStart, parent, contextNode, dynamicIndentation) { + var rangeHasError = rangeContainsError(range); + var lineAdded; + if (!rangeHasError && !previousRangeHasError) { + if (!previousRange) { + var originalStart = sourceFile.getLineAndCharacterOfPosition(originalRange.pos); + trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); + } + else { + lineAdded = + processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); + } + } + previousRange = range; + previousParent = parent; + previousRangeStartLine = rangeStart.line; + previousRangeHasError = rangeHasError; + return lineAdded; + } + function processPair(currentItem, currentStartLine, currentParent, previousItem, previousStartLine, previousParent, contextNode, dynamicIndentation) { + formattingContext.updateContext(previousItem, previousParent, currentItem, currentParent, contextNode); + var rule = rulesProvider.getRulesMap().GetRule(formattingContext); + var trimTrailingWhitespaces; + var lineAdded; + if (rule) { + applyRuleEdits(rule, previousItem, previousStartLine, currentItem, currentStartLine); + if (rule.Operation.Action & (2 | 8) && currentStartLine !== previousStartLine) { + lineAdded = false; + if (currentParent.getStart(sourceFile) === currentItem.pos) { + dynamicIndentation.recomputeIndentation(false); + } + } + else if (rule.Operation.Action & 4 && currentStartLine === previousStartLine) { + lineAdded = true; + if (currentParent.getStart(sourceFile) === currentItem.pos) { + dynamicIndentation.recomputeIndentation(true); + } + } + trimTrailingWhitespaces = + (rule.Operation.Action & (4 | 2)) && + rule.Flag !== 1; + } + else { + trimTrailingWhitespaces = true; + } + if (currentStartLine !== previousStartLine && trimTrailingWhitespaces) { + trimTrailingWhitespacesForLines(previousStartLine, currentStartLine, previousItem); + } + return lineAdded; + } + function insertIndentation(pos, indentation, lineAdded) { + var indentationString = getIndentationString(indentation, options); + if (lineAdded) { + recordReplace(pos, 0, indentationString); + } + else { + var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos); + if (indentation !== tokenStart.character) { + var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile); + recordReplace(startLinePosition, tokenStart.character, indentationString); + } + } + } + function indentMultilineComment(commentRange, indentation, firstLineIsIndented) { + var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; + var endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line; + if (startLine === endLine) { + if (!firstLineIsIndented) { + insertIndentation(commentRange.pos, indentation, false); + } + return; + } + else { + var parts = []; + var startPos = commentRange.pos; + for (var line = startLine; line < endLine; ++line) { + var endOfLine = ts.getEndLinePosition(line, sourceFile); + parts.push({ pos: startPos, end: endOfLine }); + startPos = ts.getStartPositionOfLine(line + 1, sourceFile); + } + parts.push({ pos: startPos, end: commentRange.end }); + } + var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile); + var nonWhitespaceColumnInFirstPart = formatting.SmartIndenter.findFirstNonWhitespaceColumn(startLinePos, parts[0].pos, sourceFile, options); + if (indentation === nonWhitespaceColumnInFirstPart) { + return; + } + var startIndex = 0; + if (firstLineIsIndented) { + startIndex = 1; + startLine++; + } + var delta = indentation - nonWhitespaceColumnInFirstPart; + for (var i = startIndex, len = parts.length; i < len; ++i, ++startLine) { + var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile); + var nonWhitespaceColumn = i === 0 ? nonWhitespaceColumnInFirstPart : formatting.SmartIndenter.findFirstNonWhitespaceColumn(parts[i].pos, parts[i].end, sourceFile, options); + var newIndentation = nonWhitespaceColumn + delta; + if (newIndentation > 0) { + var indentationString = getIndentationString(newIndentation, options); + recordReplace(startLinePos, nonWhitespaceColumn, indentationString); + } + else { + recordDelete(startLinePos, nonWhitespaceColumn); + } + } + } + function trimTrailingWhitespacesForLines(line1, line2, range) { + 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) { + continue; + } + var pos = lineEndPosition; + while (pos >= lineStartPosition && ts.isWhiteSpace(sourceFile.text.charCodeAt(pos))) { + pos--; + } + if (pos !== lineEndPosition) { + ts.Debug.assert(pos === lineStartPosition || !ts.isWhiteSpace(sourceFile.text.charCodeAt(pos))); + recordDelete(pos + 1, lineEndPosition - pos); + } + } + } + function newTextChange(start, len, newText) { + return { span: ts.createTextSpan(start, len), newText: newText }; + } + function recordDelete(start, len) { + if (len) { + edits.push(newTextChange(start, len, "")); + } + } + function recordReplace(start, len, newText) { + if (len || newText) { + edits.push(newTextChange(start, len, newText)); + } + } + function applyRuleEdits(rule, previousRange, previousStartLine, currentRange, currentStartLine) { + var between; + switch (rule.Operation.Action) { + case 1: + return; + case 8: + if (previousRange.end !== currentRange.pos) { + recordDelete(previousRange.end, currentRange.pos - previousRange.end); + } + break; + case 4: + if (rule.Flag !== 1 && previousStartLine !== currentStartLine) { + return; + } + var lineDelta = currentStartLine - previousStartLine; + if (lineDelta !== 1) { + recordReplace(previousRange.end, currentRange.pos - previousRange.end, options.NewLineCharacter); + } + break; + case 2: + if (rule.Flag !== 1 && previousStartLine !== currentStartLine) { + return; + } + var posDelta = currentRange.pos - previousRange.end; + if (posDelta !== 1 || sourceFile.text.charCodeAt(previousRange.end) !== 32) { + recordReplace(previousRange.end, currentRange.pos - previousRange.end, " "); + } + break; + } + } + } + function isSomeBlock(kind) { + switch (kind) { + case 172: + case 199: + return true; + } + return false; + } + function getOpenTokenForList(node, list) { + switch (node.kind) { + case 131: + case 193: + case 158: + case 130: + case 129: + case 159: + if (node.typeParameters === list) { + return 24; + } + else if (node.parameters === list) { + return 16; + } + break; + case 153: + case 154: + if (node.typeArguments === list) { + return 24; + } + else if (node.arguments === list) { + return 16; + } + break; + case 137: + if (node.typeArguments === list) { + return 24; + } + } + return 0; + } + function getCloseTokenForOpenToken(kind) { + switch (kind) { + case 16: + return 17; + case 24: + return 25; + } + return 0; + } + var internedTabsIndentation; + var internedSpacesIndentation; + function getIndentationString(indentation, options) { + if (!options.ConvertTabsToSpaces) { + var tabs = Math.floor(indentation / options.TabSize); + var spaces = indentation - tabs * options.TabSize; + var tabString; + if (!internedTabsIndentation) { + internedTabsIndentation = []; + } + if (internedTabsIndentation[tabs] === undefined) { + internedTabsIndentation[tabs] = tabString = repeat('\t', tabs); + } + else { + tabString = internedTabsIndentation[tabs]; + } + return spaces ? tabString + repeat(" ", spaces) : tabString; + } + else { + var spacesString; + var quotient = Math.floor(indentation / options.IndentSize); + var remainder = indentation % options.IndentSize; + if (!internedSpacesIndentation) { + internedSpacesIndentation = []; + } + if (internedSpacesIndentation[quotient] === undefined) { + spacesString = repeat(" ", options.IndentSize * quotient); + internedSpacesIndentation[quotient] = spacesString; + } + else { + spacesString = internedSpacesIndentation[quotient]; + } + return remainder ? spacesString + repeat(" ", remainder) : spacesString; + } + function repeat(value, count) { + var s = ""; + for (var i = 0; i < count; ++i) { + s += value; + } + return s; + } + } + formatting.getIndentationString = getIndentationString; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var SmartIndenter; + (function (SmartIndenter) { + function getIndentation(position, sourceFile, options) { + if (position > sourceFile.text.length) { + return 0; + } + var precedingToken = ts.findPrecedingToken(position, sourceFile); + if (!precedingToken) { + return 0; + } + var precedingTokenIsLiteral = precedingToken.kind === 8 || + precedingToken.kind === 9 || + precedingToken.kind === 10 || + precedingToken.kind === 11 || + precedingToken.kind === 12 || + precedingToken.kind === 13; + if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) { + return 0; + } + var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; + if (precedingToken.kind === 23 && precedingToken.parent.kind !== 165) { + var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation; + } + } + var previous; + var current = precedingToken; + var currentStart; + var indentationDelta; + while (current) { + if (positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current.kind, previous ? previous.kind : 0)) { + currentStart = getStartLineAndCharacterForNode(current, sourceFile); + if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) { + indentationDelta = 0; + } + else { + indentationDelta = lineAtPosition !== currentStart.line ? options.IndentSize : 0; + } + break; + } + var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation; + } + previous = current; + current = current.parent; + } + if (!current) { + return 0; + } + return getIndentationForNodeWorker(current, currentStart, undefined, indentationDelta, sourceFile, options); + } + SmartIndenter.getIndentation = getIndentation; + function getIndentationForNode(n, ignoreActualIndentationRange, sourceFile, options) { + var start = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); + return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, 0, sourceFile, options); + } + SmartIndenter.getIndentationForNode = getIndentationForNode; + function getIndentationForNodeWorker(current, currentStart, ignoreActualIndentationRange, indentationDelta, sourceFile, options) { + var parent = current.parent; + var parentStart; + while (parent) { + var useActualIndentation = true; + if (ignoreActualIndentationRange) { + var start = current.getStart(sourceFile); + useActualIndentation = start < ignoreActualIndentationRange.pos || start > ignoreActualIndentationRange.end; + } + if (useActualIndentation) { + var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation + indentationDelta; + } + } + parentStart = getParentStart(parent, current, sourceFile); + var parentAndChildShareLine = parentStart.line === currentStart.line || + childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); + if (useActualIndentation) { + var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation + indentationDelta; + } + } + if (shouldIndentChildNode(parent.kind, current.kind) && !parentAndChildShareLine) { + indentationDelta += options.IndentSize; + } + current = parent; + currentStart = parentStart; + parent = current.parent; + } + return indentationDelta; + } + function getParentStart(parent, child, sourceFile) { + var containingList = getContainingList(child, sourceFile); + if (containingList) { + return sourceFile.getLineAndCharacterOfPosition(containingList.pos); + } + return sourceFile.getLineAndCharacterOfPosition(parent.getStart(sourceFile)); + } + function getActualIndentationForListItemBeforeComma(commaToken, sourceFile, options) { + var commaItemInfo = ts.findListItemInfo(commaToken); + ts.Debug.assert(commaItemInfo && commaItemInfo.listItemIndex > 0); + return deriveActualIndentationFromList(commaItemInfo.list.getChildren(), commaItemInfo.listItemIndex - 1, sourceFile, options); + } + function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { + var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && + (parent.kind === 210 || !parentAndChildShareLine); + if (!useActualIndentation) { + return -1; + } + return findColumnForFirstNonWhitespaceCharacterInLine(currentLineAndChar, sourceFile, options); + } + function nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile) { + var nextToken = ts.findNextToken(precedingToken, current); + if (!nextToken) { + return false; + } + if (nextToken.kind === 14) { + return true; + } + else if (nextToken.kind === 15) { + var nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line; + return lineAtPosition === nextTokenStartLine; + } + return false; + } + function getStartLineAndCharacterForNode(n, sourceFile) { + return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); + } + function positionBelongsToNode(candidate, position, sourceFile) { + return candidate.end > position || !isCompletedNode(candidate, sourceFile); + } + function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { + if (parent.kind === 176 && parent.elseStatement === child) { + var elseKeyword = ts.findChildOfKind(parent, 75, sourceFile); + ts.Debug.assert(elseKeyword !== undefined); + var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; + return elseKeywordStartLine === childStartLine; + } + return false; + } + SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement = childStartsOnTheSameLineWithElseInIfStatement; + function getContainingList(node, sourceFile) { + if (node.parent) { + switch (node.parent.kind) { + case 137: + if (node.parent.typeArguments && + ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { + return node.parent.typeArguments; + } + break; + case 150: + return node.parent.properties; + case 149: + return node.parent.elements; + case 193: + case 158: + case 159: + case 130: + case 129: + case 134: + case 135: + var start = node.getStart(sourceFile); + if (node.parent.typeParameters && + ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { + return node.parent.typeParameters; + } + if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { + return node.parent.parameters; + } + break; + case 154: + case 153: + var start = node.getStart(sourceFile); + if (node.parent.typeArguments && + ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { + return node.parent.typeArguments; + } + if (node.parent.arguments && + ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) { + return node.parent.arguments; + } + break; + } + } + return undefined; + } + function getActualIndentationForListItem(node, sourceFile, options) { + var containingList = getContainingList(node, sourceFile); + return containingList ? getActualIndentationFromList(containingList) : -1; + function getActualIndentationFromList(list) { + var index = ts.indexOf(list, node); + return index !== -1 ? deriveActualIndentationFromList(list, index, sourceFile, options) : -1; + } + } + function deriveActualIndentationFromList(list, index, sourceFile, options) { + ts.Debug.assert(index >= 0 && index < list.length); + var node = list[index]; + var lineAndCharacter = getStartLineAndCharacterForNode(node, sourceFile); + for (var i = index - 1; i >= 0; --i) { + if (list[i].kind === 23) { + continue; + } + var prevEndLine = sourceFile.getLineAndCharacterOfPosition(list[i].end).line; + if (prevEndLine !== lineAndCharacter.line) { + return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options); + } + lineAndCharacter = getStartLineAndCharacterForNode(list[i], sourceFile); + } + return -1; + } + function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options) { + var lineStart = sourceFile.getPositionOfLineAndCharacter(lineAndCharacter.line, 0); + return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options); + } + function findFirstNonWhitespaceColumn(startPos, endPos, sourceFile, options) { + var column = 0; + for (var pos = startPos; pos < endPos; ++pos) { + var ch = sourceFile.text.charCodeAt(pos); + if (!ts.isWhiteSpace(ch)) { + return column; + } + if (ch === 9) { + column += options.TabSize + (column % options.TabSize); + } + else { + column++; + } + } + return column; + } + SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; + function nodeContentIsAlwaysIndented(kind) { + switch (kind) { + case 194: + case 195: + case 197: + case 149: + case 172: + case 199: + case 150: + case 141: + case 186: + case 204: + case 203: + case 157: + case 153: + case 154: + case 173: + case 191: + case 201: + case 184: + case 166: + return true; + } + return false; + } + function shouldIndentChildNode(parent, child) { + if (nodeContentIsAlwaysIndented(parent)) { + return true; + } + switch (parent) { + case 177: + case 178: + case 180: + case 181: + case 179: + case 176: + case 193: + case 158: + case 130: + case 129: + case 159: + case 131: + case 132: + case 133: + return child !== 172; + default: + return false; + } + } + SmartIndenter.shouldIndentChildNode = shouldIndentChildNode; + function nodeEndsWith(n, expectedLastToken, sourceFile) { + var children = n.getChildren(sourceFile); + if (children.length) { + var last = children[children.length - 1]; + if (last.kind === expectedLastToken) { + return true; + } + else if (last.kind === 22 && children.length !== 1) { + return children[children.length - 2].kind === expectedLastToken; + } + } + return false; + } + function isCompletedNode(n, sourceFile) { + if (n.getFullWidth() === 0) { + return false; + } + switch (n.kind) { + case 194: + case 195: + case 197: + case 150: + case 172: + case 199: + case 186: + return nodeEndsWith(n, 15, sourceFile); + case 206: + return isCompletedNode(n.block, sourceFile); + case 157: + case 134: + case 153: + case 135: + return nodeEndsWith(n, 17, sourceFile); + case 193: + case 158: + case 130: + case 129: + case 159: + return !n.body || isCompletedNode(n.body, sourceFile); + case 198: + return n.body && isCompletedNode(n.body, sourceFile); + case 176: + if (n.elseStatement) { + return isCompletedNode(n.elseStatement, sourceFile); + } + return isCompletedNode(n.thenStatement, sourceFile); + case 175: + return isCompletedNode(n.expression, sourceFile); + case 149: + return nodeEndsWith(n, 19, sourceFile); + case 203: + case 204: + return false; + case 178: + return isCompletedNode(n.statement, sourceFile); + case 177: + var hasWhileKeyword = ts.findChildOfKind(n, 99, sourceFile); + if (hasWhileKeyword) { + return nodeEndsWith(n, 17, sourceFile); + } + return isCompletedNode(n.statement, sourceFile); + default: + return true; + } + } + })(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {})); + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var ts; +(function (ts) { + ts.servicesVersion = "0.4"; + var ScriptSnapshot; + (function (ScriptSnapshot) { + var StringScriptSnapshot = (function () { + function StringScriptSnapshot(text) { + this.text = text; + this._lineStartPositions = undefined; + } + StringScriptSnapshot.prototype.getText = function (start, end) { + return this.text.substring(start, end); + }; + StringScriptSnapshot.prototype.getLength = function () { + return this.text.length; + }; + StringScriptSnapshot.prototype.getChangeRange = function (oldSnapshot) { + return undefined; + }; + return StringScriptSnapshot; + })(); + function fromString(text) { + return new StringScriptSnapshot(text); + } + ScriptSnapshot.fromString = fromString; + })(ScriptSnapshot = ts.ScriptSnapshot || (ts.ScriptSnapshot = {})); + var scanner = ts.createScanner(2, true); + var emptyArray = []; + function createNode(kind, pos, end, flags, parent) { + var node = new (ts.getNodeConstructor(kind))(); + node.pos = pos; + node.end = end; + node.flags = flags; + node.parent = parent; + return node; + } + var NodeObject = (function () { + function NodeObject() { + } + NodeObject.prototype.getSourceFile = function () { + return ts.getSourceFileOfNode(this); + }; + NodeObject.prototype.getStart = function (sourceFile) { + return ts.getTokenPosOfNode(this, sourceFile); + }; + NodeObject.prototype.getFullStart = function () { + return this.pos; + }; + NodeObject.prototype.getEnd = function () { + return this.end; + }; + NodeObject.prototype.getWidth = function (sourceFile) { + return this.getEnd() - this.getStart(sourceFile); + }; + NodeObject.prototype.getFullWidth = function () { + return this.end - this.getFullStart(); + }; + NodeObject.prototype.getLeadingTriviaWidth = function (sourceFile) { + return this.getStart(sourceFile) - this.pos; + }; + NodeObject.prototype.getFullText = function (sourceFile) { + return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); + }; + NodeObject.prototype.getText = function (sourceFile) { + return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd()); + }; + NodeObject.prototype.addSyntheticNodes = function (nodes, pos, end) { + scanner.setTextPos(pos); + while (pos < end) { + var token = scanner.scan(); + var textPos = scanner.getTextPos(); + nodes.push(createNode(token, pos, textPos, 512, this)); + pos = textPos; + } + return pos; + }; + NodeObject.prototype.createSyntaxList = function (nodes) { + var list = createNode(211, nodes.pos, nodes.end, 512, this); + list._children = []; + var pos = nodes.pos; + for (var i = 0, len = nodes.length; i < len; i++) { + var node = nodes[i]; + if (pos < node.pos) { + pos = this.addSyntheticNodes(list._children, pos, node.pos); + } + list._children.push(node); + pos = node.end; + } + if (pos < nodes.end) { + this.addSyntheticNodes(list._children, pos, nodes.end); + } + return list; + }; + NodeObject.prototype.createChildren = function (sourceFile) { + var _this = this; + if (this.kind >= 123) { + scanner.setText((sourceFile || this.getSourceFile()).text); + var children = []; + var pos = this.pos; + var processNode = function (node) { + if (pos < node.pos) { + pos = _this.addSyntheticNodes(children, pos, node.pos); + } + children.push(node); + pos = node.end; + }; + var processNodes = function (nodes) { + if (pos < nodes.pos) { + pos = _this.addSyntheticNodes(children, pos, nodes.pos); + } + children.push(_this.createSyntaxList(nodes)); + pos = nodes.end; + }; + ts.forEachChild(this, processNode, processNodes); + if (pos < this.end) { + this.addSyntheticNodes(children, pos, this.end); + } + scanner.setText(undefined); + } + this._children = children || emptyArray; + }; + NodeObject.prototype.getChildCount = function (sourceFile) { + if (!this._children) + this.createChildren(sourceFile); + return this._children.length; + }; + NodeObject.prototype.getChildAt = function (index, sourceFile) { + if (!this._children) + this.createChildren(sourceFile); + return this._children[index]; + }; + NodeObject.prototype.getChildren = function (sourceFile) { + if (!this._children) + this.createChildren(sourceFile); + return this._children; + }; + NodeObject.prototype.getFirstToken = function (sourceFile) { + var children = this.getChildren(); + for (var i = 0; i < children.length; i++) { + var child = children[i]; + if (child.kind < 123) { + return child; + } + return child.getFirstToken(sourceFile); + } + }; + NodeObject.prototype.getLastToken = function (sourceFile) { + var children = this.getChildren(sourceFile); + for (var i = children.length - 1; i >= 0; i--) { + var child = children[i]; + if (child.kind < 123) { + return child; + } + return child.getLastToken(sourceFile); + } + }; + return NodeObject; + })(); + var SymbolObject = (function () { + function SymbolObject(flags, name) { + this.flags = flags; + this.name = name; + } + SymbolObject.prototype.getFlags = function () { + return this.flags; + }; + SymbolObject.prototype.getName = function () { + return this.name; + }; + SymbolObject.prototype.getDeclarations = function () { + return this.declarations; + }; + SymbolObject.prototype.getDocumentationComment = function () { + if (this.documentationComment === undefined) { + this.documentationComment = getJsDocCommentsFromDeclarations(this.declarations, this.name, !(this.flags & 4)); + } + return this.documentationComment; + }; + return SymbolObject; + })(); + function getJsDocCommentsFromDeclarations(declarations, name, canUseParsedParamTagComments) { + var documentationComment = []; + var docComments = getJsDocCommentsSeparatedByNewLines(); + ts.forEach(docComments, function (docComment) { + if (documentationComment.length) { + documentationComment.push(ts.lineBreakPart()); + } + documentationComment.push(docComment); + }); + return documentationComment; + function getJsDocCommentsSeparatedByNewLines() { + var paramTag = "@param"; + var jsDocCommentParts = []; + ts.forEach(declarations, function (declaration, indexOfDeclaration) { + if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { + var sourceFileOfDeclaration = ts.getSourceFileOfNode(declaration); + if (canUseParsedParamTagComments && declaration.kind === 126) { + ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); + if (cleanedParamJsDocComment) { + jsDocCommentParts.push.apply(jsDocCommentParts, cleanedParamJsDocComment); + } + }); + } + if (declaration.kind === 198 && declaration.body.kind === 198) { + return; + } + while (declaration.kind === 198 && declaration.parent.kind === 198) { + declaration = declaration.parent; + } + ts.forEach(getJsDocCommentTextRange(declaration.kind === 191 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); + if (cleanedJsDocComment) { + jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment); + } + }); + } + }); + return jsDocCommentParts; + function getJsDocCommentTextRange(node, sourceFile) { + return ts.map(ts.getJsDocComments(node, sourceFile), function (jsDocComment) { + return { + pos: jsDocComment.pos + "/*".length, + end: jsDocComment.end - "*/".length + }; + }); + } + function consumeWhiteSpacesOnTheLine(pos, end, sourceFile, maxSpacesToRemove) { + if (maxSpacesToRemove !== undefined) { + end = Math.min(end, pos + maxSpacesToRemove); + } + for (; pos < end; pos++) { + var ch = sourceFile.text.charCodeAt(pos); + if (!ts.isWhiteSpace(ch) || ts.isLineBreak(ch)) { + return pos; + } + } + return end; + } + function consumeLineBreaks(pos, end, sourceFile) { + while (pos < end && ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { + pos++; + } + return pos; + } + function isName(pos, end, sourceFile, name) { + return pos + name.length < end && + sourceFile.text.substr(pos, name.length) === name && + (ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)) || + ts.isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); + } + function isParamTag(pos, end, sourceFile) { + return isName(pos, end, sourceFile, paramTag); + } + function pushDocCommentLineText(docComments, text, blankLineCount) { + while (blankLineCount--) + docComments.push(ts.textPart("")); + docComments.push(ts.textPart(text)); + } + function getCleanedJsDocComment(pos, end, sourceFile) { + var spacesToRemoveAfterAsterisk; + var docComments = []; + var blankLineCount = 0; + var isInParamTag = false; + while (pos < end) { + var docCommentTextOfLine = ""; + pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile); + if (pos < end && sourceFile.text.charCodeAt(pos) === 42) { + var lineStartPos = pos + 1; + pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, spacesToRemoveAfterAsterisk); + if (spacesToRemoveAfterAsterisk === undefined && pos < end && !ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { + spacesToRemoveAfterAsterisk = pos - lineStartPos; + } + } + else if (spacesToRemoveAfterAsterisk === undefined) { + spacesToRemoveAfterAsterisk = 0; + } + while (pos < end && !ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { + var ch = sourceFile.text.charAt(pos); + if (ch === "@") { + if (isParamTag(pos, end, sourceFile)) { + isInParamTag = true; + pos += paramTag.length; + continue; + } + else { + isInParamTag = false; + } + } + if (!isInParamTag) { + docCommentTextOfLine += ch; + } + pos++; + } + pos = consumeLineBreaks(pos, end, sourceFile); + if (docCommentTextOfLine) { + pushDocCommentLineText(docComments, docCommentTextOfLine, blankLineCount); + blankLineCount = 0; + } + else if (!isInParamTag && docComments.length) { + blankLineCount++; + } + } + return docComments; + } + function getCleanedParamJsDocComment(pos, end, sourceFile) { + var paramHelpStringMargin; + var paramDocComments = []; + while (pos < end) { + if (isParamTag(pos, end, sourceFile)) { + var blankLineCount = 0; + var recordedParamTag = false; + pos = consumeWhiteSpaces(pos + paramTag.length); + if (pos >= end) { + break; + } + if (sourceFile.text.charCodeAt(pos) === 123) { + pos++; + for (var curlies = 1; pos < end; pos++) { + var charCode = sourceFile.text.charCodeAt(pos); + if (charCode === 123) { + curlies++; + continue; + } + if (charCode === 125) { + curlies--; + if (curlies === 0) { + pos++; + break; + } + else { + continue; + } + } + if (charCode === 64) { + break; + } + } + pos = consumeWhiteSpaces(pos); + if (pos >= end) { + break; + } + } + if (isName(pos, end, sourceFile, name)) { + pos = consumeWhiteSpaces(pos + name.length); + if (pos >= end) { + break; + } + var paramHelpString = ""; + var firstLineParamHelpStringPos = pos; + while (pos < end) { + var ch = sourceFile.text.charCodeAt(pos); + if (ts.isLineBreak(ch)) { + if (paramHelpString) { + pushDocCommentLineText(paramDocComments, paramHelpString, blankLineCount); + paramHelpString = ""; + blankLineCount = 0; + recordedParamTag = true; + } + else if (recordedParamTag) { + blankLineCount++; + } + setPosForParamHelpStringOnNextLine(firstLineParamHelpStringPos); + continue; + } + if (ch === 64) { + break; + } + paramHelpString += sourceFile.text.charAt(pos); + pos++; + } + if (paramHelpString) { + pushDocCommentLineText(paramDocComments, paramHelpString, blankLineCount); + } + paramHelpStringMargin = undefined; + } + if (sourceFile.text.charCodeAt(pos) === 64) { + continue; + } + } + pos++; + } + return paramDocComments; + function consumeWhiteSpaces(pos) { + while (pos < end && ts.isWhiteSpace(sourceFile.text.charCodeAt(pos))) { + pos++; + } + return pos; + } + function setPosForParamHelpStringOnNextLine(firstLineParamHelpStringPos) { + pos = consumeLineBreaks(pos, end, sourceFile); + if (pos >= end) { + return; + } + if (paramHelpStringMargin === undefined) { + paramHelpStringMargin = sourceFile.getLineAndCharacterOfPosition(firstLineParamHelpStringPos).character; + } + var startOfLinePos = pos; + pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile, paramHelpStringMargin); + if (pos >= end) { + return; + } + var consumedSpaces = pos - startOfLinePos; + if (consumedSpaces < paramHelpStringMargin) { + var ch = sourceFile.text.charCodeAt(pos); + if (ch === 42) { + pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, paramHelpStringMargin - consumedSpaces - 1); + } + } + } + } + } + } + var TypeObject = (function () { + function TypeObject(checker, flags) { + this.checker = checker; + this.flags = flags; + } + TypeObject.prototype.getFlags = function () { + return this.flags; + }; + TypeObject.prototype.getSymbol = function () { + return this.symbol; + }; + TypeObject.prototype.getProperties = function () { + return this.checker.getPropertiesOfType(this); + }; + TypeObject.prototype.getProperty = function (propertyName) { + return this.checker.getPropertyOfType(this, propertyName); + }; + TypeObject.prototype.getApparentProperties = function () { + return this.checker.getAugmentedPropertiesOfType(this); + }; + TypeObject.prototype.getCallSignatures = function () { + return this.checker.getSignaturesOfType(this, 0); + }; + TypeObject.prototype.getConstructSignatures = function () { + return this.checker.getSignaturesOfType(this, 1); + }; + TypeObject.prototype.getStringIndexType = function () { + return this.checker.getIndexTypeOfType(this, 0); + }; + TypeObject.prototype.getNumberIndexType = function () { + return this.checker.getIndexTypeOfType(this, 1); + }; + return TypeObject; + })(); + var SignatureObject = (function () { + function SignatureObject(checker) { + this.checker = checker; + } + SignatureObject.prototype.getDeclaration = function () { + return this.declaration; + }; + SignatureObject.prototype.getTypeParameters = function () { + return this.typeParameters; + }; + SignatureObject.prototype.getParameters = function () { + return this.parameters; + }; + SignatureObject.prototype.getReturnType = function () { + return this.checker.getReturnTypeOfSignature(this); + }; + SignatureObject.prototype.getDocumentationComment = function () { + if (this.documentationComment === undefined) { + this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([this.declaration], undefined, false) : []; + } + return this.documentationComment; + }; + return SignatureObject; + })(); + var SourceFileObject = (function (_super) { + __extends(SourceFileObject, _super); + function SourceFileObject() { + _super.apply(this, arguments); + } + SourceFileObject.prototype.update = function (newText, textChangeRange) { + return ts.updateSourceFile(this, newText, textChangeRange); + }; + SourceFileObject.prototype.getLineAndCharacterOfPosition = function (position) { + return ts.getLineAndCharacterOfPosition(this, position); + }; + SourceFileObject.prototype.getLineStarts = function () { + return ts.getLineStarts(this); + }; + SourceFileObject.prototype.getPositionOfLineAndCharacter = function (line, character) { + return ts.getPositionOfLineAndCharacter(this, line, character); + }; + SourceFileObject.prototype.getNamedDeclarations = function () { + if (!this.namedDeclarations) { + var sourceFile = this; + var namedDeclarations = []; + ts.forEachChild(sourceFile, function visit(node) { + switch (node.kind) { + case 193: + case 130: + case 129: + var functionDeclaration = node; + if (functionDeclaration.name && functionDeclaration.name.getFullWidth() > 0) { + var lastDeclaration = namedDeclarations.length > 0 ? namedDeclarations[namedDeclarations.length - 1] : undefined; + if (lastDeclaration && functionDeclaration.symbol === lastDeclaration.symbol) { + if (functionDeclaration.body && !lastDeclaration.body) { + namedDeclarations[namedDeclarations.length - 1] = functionDeclaration; + } + } + else { + namedDeclarations.push(functionDeclaration); + } + ts.forEachChild(node, visit); + } + break; + case 194: + case 195: + case 196: + case 197: + case 198: + case 200: + case 132: + case 133: + case 141: + if (node.name) { + namedDeclarations.push(node); + } + case 131: + case 173: + case 192: + case 146: + case 147: + case 199: + ts.forEachChild(node, visit); + break; + case 172: + if (ts.isFunctionBlock(node)) { + ts.forEachChild(node, visit); + } + break; + case 126: + if (!(node.flags & 112)) { + break; + } + case 191: + case 148: + if (ts.isBindingPattern(node.name)) { + ts.forEachChild(node.name, visit); + break; + } + case 209: + case 128: + case 127: + namedDeclarations.push(node); + break; + } + }); + this.namedDeclarations = namedDeclarations; + } + return this.namedDeclarations; + }; + return SourceFileObject; + })(NodeObject); + var TextChange = (function () { + function TextChange() { + } + return TextChange; + })(); + ts.TextChange = TextChange; + (function (SymbolDisplayPartKind) { + SymbolDisplayPartKind[SymbolDisplayPartKind["aliasName"] = 0] = "aliasName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["className"] = 1] = "className"; + SymbolDisplayPartKind[SymbolDisplayPartKind["enumName"] = 2] = "enumName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["fieldName"] = 3] = "fieldName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["interfaceName"] = 4] = "interfaceName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["keyword"] = 5] = "keyword"; + SymbolDisplayPartKind[SymbolDisplayPartKind["lineBreak"] = 6] = "lineBreak"; + SymbolDisplayPartKind[SymbolDisplayPartKind["numericLiteral"] = 7] = "numericLiteral"; + SymbolDisplayPartKind[SymbolDisplayPartKind["stringLiteral"] = 8] = "stringLiteral"; + SymbolDisplayPartKind[SymbolDisplayPartKind["localName"] = 9] = "localName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["methodName"] = 10] = "methodName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["moduleName"] = 11] = "moduleName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["operator"] = 12] = "operator"; + SymbolDisplayPartKind[SymbolDisplayPartKind["parameterName"] = 13] = "parameterName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["propertyName"] = 14] = "propertyName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["punctuation"] = 15] = "punctuation"; + SymbolDisplayPartKind[SymbolDisplayPartKind["space"] = 16] = "space"; + SymbolDisplayPartKind[SymbolDisplayPartKind["text"] = 17] = "text"; + SymbolDisplayPartKind[SymbolDisplayPartKind["typeParameterName"] = 18] = "typeParameterName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["enumMemberName"] = 19] = "enumMemberName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["functionName"] = 20] = "functionName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["regularExpressionLiteral"] = 21] = "regularExpressionLiteral"; + })(ts.SymbolDisplayPartKind || (ts.SymbolDisplayPartKind = {})); + var SymbolDisplayPartKind = ts.SymbolDisplayPartKind; + (function (OutputFileType) { + OutputFileType[OutputFileType["JavaScript"] = 0] = "JavaScript"; + OutputFileType[OutputFileType["SourceMap"] = 1] = "SourceMap"; + OutputFileType[OutputFileType["Declaration"] = 2] = "Declaration"; + })(ts.OutputFileType || (ts.OutputFileType = {})); + var OutputFileType = ts.OutputFileType; + (function (EndOfLineState) { + EndOfLineState[EndOfLineState["Start"] = 0] = "Start"; + EndOfLineState[EndOfLineState["InMultiLineCommentTrivia"] = 1] = "InMultiLineCommentTrivia"; + EndOfLineState[EndOfLineState["InSingleQuoteStringLiteral"] = 2] = "InSingleQuoteStringLiteral"; + EndOfLineState[EndOfLineState["InDoubleQuoteStringLiteral"] = 3] = "InDoubleQuoteStringLiteral"; + EndOfLineState[EndOfLineState["InTemplateHeadOrNoSubstitutionTemplate"] = 4] = "InTemplateHeadOrNoSubstitutionTemplate"; + EndOfLineState[EndOfLineState["InTemplateMiddleOrTail"] = 5] = "InTemplateMiddleOrTail"; + EndOfLineState[EndOfLineState["InTemplateSubstitutionPosition"] = 6] = "InTemplateSubstitutionPosition"; + })(ts.EndOfLineState || (ts.EndOfLineState = {})); + var EndOfLineState = ts.EndOfLineState; + (function (TokenClass) { + TokenClass[TokenClass["Punctuation"] = 0] = "Punctuation"; + TokenClass[TokenClass["Keyword"] = 1] = "Keyword"; + TokenClass[TokenClass["Operator"] = 2] = "Operator"; + TokenClass[TokenClass["Comment"] = 3] = "Comment"; + TokenClass[TokenClass["Whitespace"] = 4] = "Whitespace"; + TokenClass[TokenClass["Identifier"] = 5] = "Identifier"; + TokenClass[TokenClass["NumberLiteral"] = 6] = "NumberLiteral"; + TokenClass[TokenClass["StringLiteral"] = 7] = "StringLiteral"; + TokenClass[TokenClass["RegExpLiteral"] = 8] = "RegExpLiteral"; + })(ts.TokenClass || (ts.TokenClass = {})); + var TokenClass = ts.TokenClass; + var ScriptElementKind = (function () { + function ScriptElementKind() { + } + ScriptElementKind.unknown = ""; + ScriptElementKind.keyword = "keyword"; + ScriptElementKind.scriptElement = "script"; + ScriptElementKind.moduleElement = "module"; + ScriptElementKind.classElement = "class"; + ScriptElementKind.interfaceElement = "interface"; + ScriptElementKind.typeElement = "type"; + ScriptElementKind.enumElement = "enum"; + ScriptElementKind.variableElement = "var"; + ScriptElementKind.localVariableElement = "local var"; + ScriptElementKind.functionElement = "function"; + ScriptElementKind.localFunctionElement = "local function"; + ScriptElementKind.memberFunctionElement = "method"; + ScriptElementKind.memberGetAccessorElement = "getter"; + ScriptElementKind.memberSetAccessorElement = "setter"; + ScriptElementKind.memberVariableElement = "property"; + ScriptElementKind.constructorImplementationElement = "constructor"; + ScriptElementKind.callSignatureElement = "call"; + ScriptElementKind.indexSignatureElement = "index"; + ScriptElementKind.constructSignatureElement = "construct"; + ScriptElementKind.parameterElement = "parameter"; + ScriptElementKind.typeParameterElement = "type parameter"; + ScriptElementKind.primitiveType = "primitive type"; + ScriptElementKind.label = "label"; + ScriptElementKind.alias = "alias"; + ScriptElementKind.constElement = "const"; + ScriptElementKind.letElement = "let"; + return ScriptElementKind; + })(); + ts.ScriptElementKind = ScriptElementKind; + var ScriptElementKindModifier = (function () { + function ScriptElementKindModifier() { + } + ScriptElementKindModifier.none = ""; + ScriptElementKindModifier.publicMemberModifier = "public"; + ScriptElementKindModifier.privateMemberModifier = "private"; + ScriptElementKindModifier.protectedMemberModifier = "protected"; + ScriptElementKindModifier.exportedModifier = "export"; + ScriptElementKindModifier.ambientModifier = "declare"; + ScriptElementKindModifier.staticModifier = "static"; + return ScriptElementKindModifier; + })(); + ts.ScriptElementKindModifier = ScriptElementKindModifier; + var ClassificationTypeNames = (function () { + function ClassificationTypeNames() { + } + ClassificationTypeNames.comment = "comment"; + ClassificationTypeNames.identifier = "identifier"; + ClassificationTypeNames.keyword = "keyword"; + ClassificationTypeNames.numericLiteral = "number"; + ClassificationTypeNames.operator = "operator"; + ClassificationTypeNames.stringLiteral = "string"; + ClassificationTypeNames.whiteSpace = "whitespace"; + ClassificationTypeNames.text = "text"; + ClassificationTypeNames.punctuation = "punctuation"; + ClassificationTypeNames.className = "class name"; + ClassificationTypeNames.enumName = "enum name"; + ClassificationTypeNames.interfaceName = "interface name"; + ClassificationTypeNames.moduleName = "module name"; + ClassificationTypeNames.typeParameterName = "type parameter name"; + ClassificationTypeNames.typeAlias = "type alias name"; + return ClassificationTypeNames; + })(); + ts.ClassificationTypeNames = ClassificationTypeNames; + function displayPartsToString(displayParts) { + if (displayParts) { + return ts.map(displayParts, function (displayPart) { return displayPart.text; }).join(""); + } + return ""; + } + ts.displayPartsToString = displayPartsToString; + function isLocalVariableOrFunction(symbol) { + if (symbol.parent) { + return false; + } + return ts.forEach(symbol.declarations, function (declaration) { + if (declaration.kind === 158) { + return true; + } + if (declaration.kind !== 191 && declaration.kind !== 193) { + return false; + } + for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { + if (parent.kind === 210 || parent.kind === 199) { + return false; + } + } + return true; + }); + } + function getDefaultCompilerOptions() { + return { + target: 1, + module: 0 + }; + } + ts.getDefaultCompilerOptions = getDefaultCompilerOptions; + var OperationCanceledException = (function () { + function OperationCanceledException() { + } + return OperationCanceledException; + })(); + ts.OperationCanceledException = OperationCanceledException; + var CancellationTokenObject = (function () { + function CancellationTokenObject(cancellationToken) { + this.cancellationToken = cancellationToken; + } + CancellationTokenObject.prototype.isCancellationRequested = function () { + return this.cancellationToken && this.cancellationToken.isCancellationRequested(); + }; + CancellationTokenObject.prototype.throwIfCancellationRequested = function () { + if (this.isCancellationRequested()) { + throw new OperationCanceledException(); + } + }; + CancellationTokenObject.None = new CancellationTokenObject(null); + return CancellationTokenObject; + })(); + ts.CancellationTokenObject = CancellationTokenObject; + var HostCache = (function () { + function HostCache(host) { + this.host = host; + this.fileNameToEntry = {}; + var rootFileNames = host.getScriptFileNames(); + for (var i = 0, n = rootFileNames.length; i < n; i++) { + this.createEntry(rootFileNames[i]); + } + this._compilationSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); + } + HostCache.prototype.compilationSettings = function () { + return this._compilationSettings; + }; + HostCache.prototype.createEntry = function (fileName) { + var entry; + var scriptSnapshot = this.host.getScriptSnapshot(fileName); + if (scriptSnapshot) { + entry = { + hostFileName: fileName, + version: this.host.getScriptVersion(fileName), + scriptSnapshot: scriptSnapshot + }; + } + return this.fileNameToEntry[ts.normalizeSlashes(fileName)] = entry; + }; + HostCache.prototype.getEntry = function (fileName) { + return ts.lookUp(this.fileNameToEntry, ts.normalizeSlashes(fileName)); + }; + HostCache.prototype.contains = function (fileName) { + return ts.hasProperty(this.fileNameToEntry, ts.normalizeSlashes(fileName)); + }; + HostCache.prototype.getOrCreateEntry = function (fileName) { + if (this.contains(fileName)) { + return this.getEntry(fileName); + } + return this.createEntry(fileName); + }; + HostCache.prototype.getRootFileNames = function () { + var _this = this; + var fileNames = []; + ts.forEachKey(this.fileNameToEntry, function (key) { + if (ts.hasProperty(_this.fileNameToEntry, key) && _this.fileNameToEntry[key]) + fileNames.push(key); + }); + return fileNames; + }; + HostCache.prototype.getVersion = function (fileName) { + var file = this.getEntry(fileName); + return file && file.version; + }; + HostCache.prototype.getScriptSnapshot = function (fileName) { + var file = this.getEntry(fileName); + return file && file.scriptSnapshot; + }; + HostCache.prototype.getChangeRange = function (fileName, lastKnownVersion, oldScriptSnapshot) { + var currentVersion = this.getVersion(fileName); + if (lastKnownVersion === currentVersion) { + return ts.unchangedTextChangeRange; + } + var scriptSnapshot = this.getScriptSnapshot(fileName); + return scriptSnapshot.getChangeRange(oldScriptSnapshot); + }; + return HostCache; + })(); + var SyntaxTreeCache = (function () { + function SyntaxTreeCache(host) { + this.host = host; + this.currentFileName = ""; + this.currentFileVersion = null; + this.currentSourceFile = null; + } + SyntaxTreeCache.prototype.log = function (message) { + if (this.host.log) { + this.host.log(message); + } + }; + SyntaxTreeCache.prototype.initialize = function (fileName) { + var start = new Date().getTime(); + this.hostCache = new HostCache(this.host); + this.log("SyntaxTreeCache.Initialize: new HostCache: " + (new Date().getTime() - start)); + var version = this.hostCache.getVersion(fileName); + var sourceFile; + if (this.currentFileName !== fileName) { + var scriptSnapshot = this.hostCache.getScriptSnapshot(fileName); + var start = new Date().getTime(); + sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 2, version, true); + this.log("SyntaxTreeCache.Initialize: createSourceFile: " + (new Date().getTime() - start)); + } + else if (this.currentFileVersion !== version) { + var scriptSnapshot = this.hostCache.getScriptSnapshot(fileName); + var editRange = this.hostCache.getChangeRange(fileName, this.currentFileVersion, this.currentSourceFile.scriptSnapshot); + var start = new Date().getTime(); + sourceFile = updateLanguageServiceSourceFile(this.currentSourceFile, scriptSnapshot, version, editRange); + this.log("SyntaxTreeCache.Initialize: updateSourceFile: " + (new Date().getTime() - start)); + } + if (sourceFile) { + this.currentFileVersion = version; + this.currentFileName = fileName; + this.currentSourceFile = sourceFile; + } + }; + SyntaxTreeCache.prototype.getCurrentSourceFile = function (fileName) { + this.initialize(fileName); + return this.currentSourceFile; + }; + SyntaxTreeCache.prototype.getCurrentScriptSnapshot = function (fileName) { + return this.getCurrentSourceFile(fileName).scriptSnapshot; + }; + return SyntaxTreeCache; + })(); + function setSourceFileFields(sourceFile, scriptSnapshot, version) { + sourceFile.version = version; + sourceFile.scriptSnapshot = scriptSnapshot; + } + function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents) { + var sourceFile = ts.createSourceFile(fileName, scriptSnapshot.getText(0, scriptSnapshot.getLength()), scriptTarget, setNodeParents); + setSourceFileFields(sourceFile, scriptSnapshot, version); + sourceFile.nameTable = sourceFile.identifiers; + return sourceFile; + } + ts.createLanguageServiceSourceFile = createLanguageServiceSourceFile; + ts.disableIncrementalParsing = false; + function updateLanguageServiceSourceFile(sourceFile, scriptSnapshot, version, textChangeRange, aggressiveChecks) { + if (textChangeRange) { + if (version !== sourceFile.version) { + if (!ts.disableIncrementalParsing) { + var newSourceFile = ts.updateSourceFile(sourceFile, scriptSnapshot.getText(0, scriptSnapshot.getLength()), textChangeRange, aggressiveChecks); + setSourceFileFields(newSourceFile, scriptSnapshot, version); + newSourceFile.nameTable = undefined; + return newSourceFile; + } + } + } + return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, true); + } + ts.updateLanguageServiceSourceFile = updateLanguageServiceSourceFile; + function createDocumentRegistry() { + var buckets = {}; + function getKeyFromCompilationSettings(settings) { + return "_" + settings.target; + } + function getBucketForCompilationSettings(settings, createIfMissing) { + var key = getKeyFromCompilationSettings(settings); + var bucket = ts.lookUp(buckets, key); + if (!bucket && createIfMissing) { + buckets[key] = bucket = {}; + } + return bucket; + } + function reportStats() { + var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === '_'; }).map(function (name) { + var entries = ts.lookUp(buckets, name); + var sourceFiles = []; + for (var i in entries) { + var entry = entries[i]; + sourceFiles.push({ + name: i, + refCount: entry.refCount, + references: entry.owners.slice(0) + }); + } + sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; }); + return { + bucket: name, + sourceFiles: sourceFiles + }; + }); + return JSON.stringify(bucketInfoArray, null, 2); + } + function acquireDocument(fileName, compilationSettings, scriptSnapshot, version) { + var bucket = getBucketForCompilationSettings(compilationSettings, true); + var entry = ts.lookUp(bucket, fileName); + if (!entry) { + var sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, false); + bucket[fileName] = entry = { + sourceFile: sourceFile, + refCount: 0, + owners: [] + }; + } + entry.refCount++; + return entry.sourceFile; + } + function updateDocument(sourceFile, fileName, compilationSettings, scriptSnapshot, version, textChangeRange) { + var bucket = getBucketForCompilationSettings(compilationSettings, false); + ts.Debug.assert(bucket !== undefined); + var entry = ts.lookUp(bucket, fileName); + ts.Debug.assert(entry !== undefined); + entry.sourceFile = updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, textChangeRange); + return entry.sourceFile; + } + function releaseDocument(fileName, compilationSettings) { + var bucket = getBucketForCompilationSettings(compilationSettings, false); + ts.Debug.assert(bucket !== undefined); + var entry = ts.lookUp(bucket, fileName); + entry.refCount--; + ts.Debug.assert(entry.refCount >= 0); + if (entry.refCount === 0) { + delete bucket[fileName]; + } + } + return { + acquireDocument: acquireDocument, + updateDocument: updateDocument, + releaseDocument: releaseDocument, + reportStats: reportStats + }; + } + ts.createDocumentRegistry = createDocumentRegistry; + function preProcessFile(sourceText, readImportFiles) { + if (readImportFiles === void 0) { readImportFiles = true; } + var referencedFiles = []; + var importedFiles = []; + var isNoDefaultLib = false; + function processTripleSlashDirectives() { + var commentRanges = ts.getLeadingCommentRanges(sourceText, 0); + ts.forEach(commentRanges, function (commentRange) { + var comment = sourceText.substring(commentRange.pos, commentRange.end); + var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, commentRange); + if (referencePathMatchResult) { + isNoDefaultLib = referencePathMatchResult.isNoDefaultLib; + var fileReference = referencePathMatchResult.fileReference; + if (fileReference) { + referencedFiles.push(fileReference); + } + } + }); + } + function processImport() { + scanner.setText(sourceText); + var token = scanner.scan(); + while (token !== 1) { + if (token === 84) { + token = scanner.scan(); + if (token === 64) { + token = scanner.scan(); + if (token === 52) { + token = scanner.scan(); + if (token === 116) { + token = scanner.scan(); + if (token === 16) { + token = scanner.scan(); + if (token === 8) { + var importPath = scanner.getTokenValue(); + var pos = scanner.getTokenPos(); + importedFiles.push({ + fileName: importPath, + pos: pos, + end: pos + importPath.length + }); + } + } + } + } + } + } + token = scanner.scan(); + } + scanner.setText(undefined); + } + if (readImportFiles) { + processImport(); + } + processTripleSlashDirectives(); + return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib }; + } + ts.preProcessFile = preProcessFile; + function getTargetLabel(referenceNode, labelName) { + while (referenceNode) { + if (referenceNode.kind === 187 && referenceNode.label.text === labelName) { + return referenceNode.label; + } + referenceNode = referenceNode.parent; + } + return undefined; + } + function isJumpStatementTarget(node) { + return node.kind === 64 && + (node.parent.kind === 183 || node.parent.kind === 182) && + node.parent.label === node; + } + function isLabelOfLabeledStatement(node) { + return node.kind === 64 && + node.parent.kind === 187 && + node.parent.label === node; + } + function isLabeledBy(node, labelName) { + for (var owner = node.parent; owner.kind === 187; owner = owner.parent) { + if (owner.label.text === labelName) { + return true; + } + } + return false; + } + function isLabelName(node) { + return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); + } + function isRightSideOfQualifiedName(node) { + return node.parent.kind === 123 && node.parent.right === node; + } + function isRightSideOfPropertyAccess(node) { + return node && node.parent && node.parent.kind === 151 && node.parent.name === node; + } + function isCallExpressionTarget(node) { + if (isRightSideOfPropertyAccess(node)) { + node = node.parent; + } + return node && node.parent && node.parent.kind === 153 && node.parent.expression === node; + } + function isNewExpressionTarget(node) { + if (isRightSideOfPropertyAccess(node)) { + node = node.parent; + } + return node && node.parent && node.parent.kind === 154 && node.parent.expression === node; + } + function isNameOfModuleDeclaration(node) { + return node.parent.kind === 198 && node.parent.name === node; + } + function isNameOfFunctionDeclaration(node) { + return node.kind === 64 && + ts.isAnyFunction(node.parent) && node.parent.name === node; + } + function isNameOfPropertyAssignment(node) { + return (node.kind === 64 || node.kind === 8 || node.kind === 7) && + (node.parent.kind === 207 || node.parent.kind === 208) && node.parent.name === node; + } + function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { + if (node.kind === 8 || node.kind === 7) { + switch (node.parent.kind) { + case 128: + case 127: + case 207: + case 209: + case 130: + case 129: + case 132: + case 133: + case 198: + return node.parent.name === node; + case 152: + return node.parent.argumentExpression === node; + } + } + return false; + } + function isNameOfExternalModuleImportOrDeclaration(node) { + if (node.kind === 8) { + return isNameOfModuleDeclaration(node) || + (ts.isExternalModuleImportDeclaration(node.parent.parent) && ts.getExternalModuleImportDeclarationExpression(node.parent.parent) === node); + } + return false; + } + function isInsideComment(sourceFile, token, position) { + return position <= token.getStart(sourceFile) && + (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || + isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); + function isInsideCommentRange(comments) { + return ts.forEach(comments, function (comment) { + if (comment.pos < position && position < comment.end) { + return true; + } + else if (position === comment.end) { + var text = sourceFile.text; + var width = comment.end - comment.pos; + if (width <= 2 || text.charCodeAt(comment.pos + 1) === 47) { + return true; + } + else { + return !(text.charCodeAt(comment.end - 1) === 47 && + text.charCodeAt(comment.end - 2) === 42); + } + } + return false; + }); + } + } + var SemanticMeaning; + (function (SemanticMeaning) { + SemanticMeaning[SemanticMeaning["None"] = 0] = "None"; + SemanticMeaning[SemanticMeaning["Value"] = 1] = "Value"; + SemanticMeaning[SemanticMeaning["Type"] = 2] = "Type"; + SemanticMeaning[SemanticMeaning["Namespace"] = 4] = "Namespace"; + SemanticMeaning[SemanticMeaning["All"] = 7] = "All"; + })(SemanticMeaning || (SemanticMeaning = {})); + var BreakContinueSearchType; + (function (BreakContinueSearchType) { + BreakContinueSearchType[BreakContinueSearchType["None"] = 0] = "None"; + BreakContinueSearchType[BreakContinueSearchType["Unlabeled"] = 1] = "Unlabeled"; + BreakContinueSearchType[BreakContinueSearchType["Labeled"] = 2] = "Labeled"; + BreakContinueSearchType[BreakContinueSearchType["All"] = 3] = "All"; + })(BreakContinueSearchType || (BreakContinueSearchType = {})); + var keywordCompletions = []; + for (var i = 65; i <= 122; i++) { + keywordCompletions.push({ + name: ts.tokenToString(i), + kind: ScriptElementKind.keyword, + kindModifiers: ScriptElementKindModifier.none + }); + } + function getContainerNode(node) { + while (true) { + node = node.parent; + if (!node) { + return undefined; + } + switch (node.kind) { + case 210: + case 130: + case 129: + case 193: + case 158: + case 132: + case 133: + case 194: + case 195: + case 197: + case 198: + return node; + } + } + } + ts.getContainerNode = getContainerNode; + function getNodeKind(node) { + switch (node.kind) { + case 198: return ScriptElementKind.moduleElement; + case 194: return ScriptElementKind.classElement; + case 195: return ScriptElementKind.interfaceElement; + case 196: return ScriptElementKind.typeElement; + case 197: return ScriptElementKind.enumElement; + case 191: + return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; + case 193: return ScriptElementKind.functionElement; + case 132: return ScriptElementKind.memberGetAccessorElement; + case 133: return ScriptElementKind.memberSetAccessorElement; + case 130: + case 129: + return ScriptElementKind.memberFunctionElement; + case 128: + case 127: + return ScriptElementKind.memberVariableElement; + case 136: return ScriptElementKind.indexSignatureElement; + case 135: return ScriptElementKind.constructSignatureElement; + case 134: return ScriptElementKind.callSignatureElement; + case 131: return ScriptElementKind.constructorImplementationElement; + case 125: return ScriptElementKind.typeParameterElement; + case 209: return ScriptElementKind.variableElement; + case 126: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + } + return ScriptElementKind.unknown; + } + ts.getNodeKind = getNodeKind; + function createLanguageService(host, documentRegistry) { + if (documentRegistry === void 0) { documentRegistry = createDocumentRegistry(); } + var syntaxTreeCache = new SyntaxTreeCache(host); + var ruleProvider; + var program; + var typeInfoResolver; + var useCaseSensitivefileNames = false; + var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken()); + var activeCompletionSession; + if (!ts.localizedDiagnosticMessages && host.getLocalizedDiagnosticMessages) { + ts.localizedDiagnosticMessages = host.getLocalizedDiagnosticMessages(); + } + function log(message) { + if (host.log) { + host.log(message); + } + } + function getCanonicalFileName(fileName) { + return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); + } + function getValidSourceFile(fileName) { + var sourceFile = program.getSourceFile(getCanonicalFileName(fileName)); + if (!sourceFile) { + throw new Error("Could not find file: '" + fileName + "'."); + } + return sourceFile; + } + function getRuleProvider(options) { + if (!ruleProvider) { + ruleProvider = new ts.formatting.RulesProvider(); + } + ruleProvider.ensureUpToDate(options); + return ruleProvider; + } + function synchronizeHostData() { + var hostCache = new HostCache(host); + if (programUpToDate()) { + return; + } + var oldSettings = program && program.getCompilerOptions(); + var newSettings = hostCache.compilationSettings(); + var changesInCompilationSettingsAffectSyntax = oldSettings && oldSettings.target !== newSettings.target; + var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, { + getSourceFile: getOrCreateSourceFile, + getCancellationToken: function () { return cancellationToken; }, + getCanonicalFileName: function (fileName) { return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); }, + useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, + getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; }, + getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, + writeFile: function (fileName, data, writeByteOrderMark) { }, + getCurrentDirectory: function () { return host.getCurrentDirectory(); } + }); + if (program) { + var oldSourceFiles = program.getSourceFiles(); + for (var i = 0, n = oldSourceFiles.length; i < n; i++) { + var fileName = oldSourceFiles[i].fileName; + if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { + documentRegistry.releaseDocument(fileName, oldSettings); + } + } + } + program = newProgram; + typeInfoResolver = program.getTypeChecker(); + return; + function getOrCreateSourceFile(fileName) { + var hostFileInformation = hostCache.getOrCreateEntry(fileName); + if (!hostFileInformation) { + return undefined; + } + if (!changesInCompilationSettingsAffectSyntax) { + var oldSourceFile = program && program.getSourceFile(fileName); + if (oldSourceFile) { + if (sourceFileUpToDate(oldSourceFile)) { + return oldSourceFile; + } + var textChangeRange = hostCache.getChangeRange(fileName, oldSourceFile.version, oldSourceFile.scriptSnapshot); + return documentRegistry.updateDocument(oldSourceFile, fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version, textChangeRange); + } + } + return documentRegistry.acquireDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); + } + function sourceFileUpToDate(sourceFile) { + return sourceFile && sourceFile.version === hostCache.getVersion(sourceFile.fileName); + } + function programUpToDate() { + if (!program) { + return false; + } + var rootFileNames = hostCache.getRootFileNames(); + if (program.getSourceFiles().length !== rootFileNames.length) { + return false; + } + for (var i = 0, n = rootFileNames.length; i < n; i++) { + if (!sourceFileUpToDate(program.getSourceFile(rootFileNames[i]))) { + return false; + } + } + return ts.compareDataObjects(program.getCompilerOptions(), hostCache.compilationSettings()); + } + } + function getProgram() { + synchronizeHostData(); + return program; + } + function cleanupSemanticCache() { + if (program) { + typeInfoResolver = program.getTypeChecker(); + } + } + function dispose() { + if (program) { + ts.forEach(program.getSourceFiles(), function (f) { documentRegistry.releaseDocument(f.fileName, program.getCompilerOptions()); }); + } + } + function getSyntacticDiagnostics(fileName) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + return program.getSyntacticDiagnostics(getValidSourceFile(fileName)); + } + function getSemanticDiagnostics(fileName) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var targetSourceFile = getValidSourceFile(fileName); + var semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile); + if (!program.getCompilerOptions().declaration) { + return semanticDiagnostics; + } + var declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile); + return semanticDiagnostics.concat(declarationDiagnostics); + } + function getCompilerOptionsDiagnostics() { + synchronizeHostData(); + return program.getGlobalDiagnostics(); + } + function getValidCompletionEntryDisplayName(symbol, target) { + var displayName = symbol.getName(); + if (displayName && displayName.length > 0) { + var firstCharCode = displayName.charCodeAt(0); + if ((symbol.flags & 1536) && (firstCharCode === 39 || firstCharCode === 34)) { + return undefined; + } + if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) && + (firstCharCode === 39 || firstCharCode === 34)) { + displayName = displayName.substring(1, displayName.length - 1); + } + var isValid = ts.isIdentifierStart(displayName.charCodeAt(0), target); + for (var i = 1, n = displayName.length; isValid && i < n; i++) { + isValid = ts.isIdentifierPart(displayName.charCodeAt(i), target); + } + if (isValid) { + return ts.unescapeIdentifier(displayName); + } + } + return undefined; + } + function createCompletionEntry(symbol, typeChecker, location) { + var displayName = getValidCompletionEntryDisplayName(symbol, program.getCompilerOptions().target); + if (!displayName) { + return undefined; + } + return { + name: displayName, + kind: getSymbolKind(symbol, typeChecker, location), + kindModifiers: getSymbolModifiers(symbol) + }; + } + function getCompletionsAtPosition(fileName, position) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var syntacticStart = new Date().getTime(); + var sourceFile = getValidSourceFile(fileName); + var start = new Date().getTime(); + var currentToken = ts.getTokenAtPosition(sourceFile, position); + log("getCompletionsAtPosition: Get current token: " + (new Date().getTime() - start)); + var start = new Date().getTime(); + var insideComment = isInsideComment(sourceFile, currentToken, position); + log("getCompletionsAtPosition: Is inside comment: " + (new Date().getTime() - start)); + if (insideComment) { + log("Returning an empty list because completion was inside a comment."); + return undefined; + } + var start = new Date().getTime(); + var previousToken = ts.findPrecedingToken(position, sourceFile); + log("getCompletionsAtPosition: Get previous token 1: " + (new Date().getTime() - start)); + if (previousToken && position <= previousToken.end && previousToken.kind === 64) { + var start = new Date().getTime(); + previousToken = ts.findPrecedingToken(previousToken.pos, sourceFile); + log("getCompletionsAtPosition: Get previous token 2: " + (new Date().getTime() - start)); + } + if (previousToken && isCompletionListBlocker(previousToken)) { + log("Returning an empty list because completion was requested in an invalid position."); + return undefined; + } + var node; + var isRightOfDot; + if (previousToken && previousToken.kind === 20 && previousToken.parent.kind === 151) { + node = previousToken.parent.expression; + isRightOfDot = true; + } + else if (previousToken && previousToken.kind === 20 && previousToken.parent.kind === 123) { + node = previousToken.parent.left; + isRightOfDot = true; + } + else { + node = currentToken; + isRightOfDot = false; + } + activeCompletionSession = { + fileName: fileName, + position: position, + entries: [], + symbols: {}, + typeChecker: typeInfoResolver + }; + log("getCompletionsAtPosition: Syntactic work: " + (new Date().getTime() - syntacticStart)); + var location = ts.getTouchingPropertyName(sourceFile, position); + var semanticStart = new Date().getTime(); + if (isRightOfDot) { + var symbols = []; + var isMemberCompletion = true; + var isNewIdentifierLocation = false; + if (node.kind === 64 || node.kind === 123 || node.kind === 151) { + var symbol = typeInfoResolver.getSymbolAtLocation(node); + if (symbol && symbol.flags & 8388608) { + symbol = typeInfoResolver.getAliasedSymbol(symbol); + } + if (symbol && symbol.flags & 1952) { + ts.forEachValue(symbol.exports, function (symbol) { + if (typeInfoResolver.isValidPropertyAccess((node.parent), symbol.name)) { + symbols.push(symbol); + } + }); + } + } + var type = typeInfoResolver.getTypeAtLocation(node); + if (type) { + ts.forEach(type.getApparentProperties(), function (symbol) { + if (typeInfoResolver.isValidPropertyAccess((node.parent), symbol.name)) { + symbols.push(symbol); + } + }); + } + getCompletionEntriesFromSymbols(symbols, activeCompletionSession); + } + else { + var containingObjectLiteral = getContainingObjectLiteralApplicableForCompletion(previousToken); + if (containingObjectLiteral) { + isMemberCompletion = true; + isNewIdentifierLocation = true; + var contextualType = typeInfoResolver.getContextualType(containingObjectLiteral); + if (!contextualType) { + return undefined; + } + var contextualTypeMembers = typeInfoResolver.getPropertiesOfType(contextualType); + if (contextualTypeMembers && contextualTypeMembers.length > 0) { + var filteredMembers = filterContextualMembersList(contextualTypeMembers, containingObjectLiteral.properties); + getCompletionEntriesFromSymbols(filteredMembers, activeCompletionSession); + } + } + else { + isMemberCompletion = false; + isNewIdentifierLocation = isNewIdentifierDefinitionLocation(previousToken); + var symbolMeanings = 793056 | 107455 | 1536 | 8388608; + var symbols = typeInfoResolver.getSymbolsInScope(node, symbolMeanings); + getCompletionEntriesFromSymbols(symbols, activeCompletionSession); + } + } + if (!isMemberCompletion) { + Array.prototype.push.apply(activeCompletionSession.entries, keywordCompletions); + } + log("getCompletionsAtPosition: Semantic work: " + (new Date().getTime() - semanticStart)); + return { + isMemberCompletion: isMemberCompletion, + isNewIdentifierLocation: isNewIdentifierLocation, + isBuilder: isNewIdentifierDefinitionLocation, + entries: activeCompletionSession.entries + }; + function getCompletionEntriesFromSymbols(symbols, session) { + var start = new Date().getTime(); + ts.forEach(symbols, function (symbol) { + var entry = createCompletionEntry(symbol, session.typeChecker, location); + if (entry) { + var id = ts.escapeIdentifier(entry.name); + if (!ts.lookUp(session.symbols, id)) { + session.entries.push(entry); + session.symbols[id] = symbol; + } + } + }); + log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - start)); + } + function isCompletionListBlocker(previousToken) { + var start = new Date().getTime(); + var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || + isIdentifierDefinitionLocation(previousToken) || + isRightOfIllegalDot(previousToken); + log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start)); + return result; + } + function isNewIdentifierDefinitionLocation(previousToken) { + if (previousToken) { + var containingNodeKind = previousToken.parent.kind; + switch (previousToken.kind) { + case 23: + return containingNodeKind === 153 || containingNodeKind === 131 || containingNodeKind === 154 || containingNodeKind === 149 || containingNodeKind === 165; + case 16: + return containingNodeKind === 153 || containingNodeKind === 131 || containingNodeKind === 154 || containingNodeKind === 157; + case 18: + return containingNodeKind === 149; + case 115: + return true; + case 20: + return containingNodeKind === 198; + case 14: + return containingNodeKind === 194; + case 52: + return containingNodeKind === 191 || containingNodeKind === 165; + case 11: + return containingNodeKind === 167; + case 12: + return containingNodeKind === 171; + case 107: + case 105: + case 106: + return containingNodeKind === 128; + } + switch (previousToken.getText()) { + case "public": + case "protected": + case "private": + return true; + } + } + return false; + } + function isInStringOrRegularExpressionOrTemplateLiteral(previousToken) { + if (previousToken.kind === 8 || previousToken.kind === 9 || ts.isTemplateLiteralKind(previousToken.kind)) { + var start = previousToken.getStart(); + var end = previousToken.getEnd(); + if (start < position && position < end) { + return true; + } + else if (position === end) { + return !!previousToken.isUnterminated; + } + } + return false; + } + function getContainingObjectLiteralApplicableForCompletion(previousToken) { + if (previousToken) { + var parent = previousToken.parent; + switch (previousToken.kind) { + case 14: + case 23: + if (parent && parent.kind === 150) { + return parent; + } + break; + } + } + return undefined; + } + function isFunction(kind) { + switch (kind) { + case 158: + case 159: + case 193: + case 130: + case 129: + case 132: + case 133: + case 134: + case 135: + case 136: + return true; + } + return false; + } + function isIdentifierDefinitionLocation(previousToken) { + if (previousToken) { + var containingNodeKind = previousToken.parent.kind; + switch (previousToken.kind) { + case 23: + return containingNodeKind === 191 || + containingNodeKind === 192 || + containingNodeKind === 173 || + containingNodeKind === 197 || + isFunction(containingNodeKind) || + containingNodeKind === 194 || + containingNodeKind === 193 || + containingNodeKind === 195 || + containingNodeKind === 147 || + containingNodeKind === 146; + case 20: + return containingNodeKind === 147; + case 18: + return containingNodeKind === 147; + case 16: + return containingNodeKind === 206 || + isFunction(containingNodeKind); + case 14: + return containingNodeKind === 197 || + containingNodeKind === 195 || + containingNodeKind === 141 || + containingNodeKind === 146; + case 22: + return containingNodeKind === 127 && + (previousToken.parent.parent.kind === 195 || + previousToken.parent.parent.kind === 141); + case 24: + return containingNodeKind === 194 || + containingNodeKind === 193 || + containingNodeKind === 195 || + isFunction(containingNodeKind); + case 108: + return containingNodeKind === 128; + case 21: + return containingNodeKind === 126 || + containingNodeKind === 131 || + (previousToken.parent.parent.kind === 147); + case 107: + case 105: + case 106: + return containingNodeKind === 126; + case 68: + case 76: + case 102: + case 82: + case 97: + case 114: + case 118: + case 84: + case 103: + case 69: + case 109: + return true; + } + switch (previousToken.getText()) { + case "class": + case "interface": + case "enum": + case "function": + case "var": + case "static": + case "let": + case "const": + case "yield": + return true; + } + } + return false; + } + function isRightOfIllegalDot(previousToken) { + if (previousToken && previousToken.kind === 7) { + var text = previousToken.getFullText(); + return text.charAt(text.length - 1) === "."; + } + return false; + } + function filterContextualMembersList(contextualMemberSymbols, existingMembers) { + if (!existingMembers || existingMembers.length === 0) { + return contextualMemberSymbols; + } + var existingMemberNames = {}; + ts.forEach(existingMembers, function (m) { + if (m.kind !== 207 && m.kind !== 208) { + return; + } + if (m.getStart() <= position && position <= m.getEnd()) { + return; + } + existingMemberNames[m.name.text] = true; + }); + var filteredMembers = []; + ts.forEach(contextualMemberSymbols, function (s) { + if (!existingMemberNames[s.name]) { + filteredMembers.push(s); + } + }); + return filteredMembers; + } + } + function getCompletionEntryDetails(fileName, position, entryName) { + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); + var session = activeCompletionSession; + if (!session || session.fileName !== fileName || session.position !== position) { + return undefined; + } + var symbol = ts.lookUp(activeCompletionSession.symbols, ts.escapeIdentifier(entryName)); + if (symbol) { + var location = ts.getTouchingPropertyName(sourceFile, position); + var completionEntry = createCompletionEntry(symbol, session.typeChecker, location); + ts.Debug.assert(session.typeChecker.getTypeOfSymbolAtLocation(symbol, location) !== undefined, "Could not find type for symbol"); + var displayPartsDocumentationsAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getValidSourceFile(fileName), location, session.typeChecker, location, 7); + return { + name: entryName, + kind: displayPartsDocumentationsAndSymbolKind.symbolKind, + kindModifiers: completionEntry.kindModifiers, + displayParts: displayPartsDocumentationsAndSymbolKind.displayParts, + documentation: displayPartsDocumentationsAndSymbolKind.documentation + }; + } + else { + return { + name: entryName, + kind: ScriptElementKind.keyword, + kindModifiers: ScriptElementKindModifier.none, + displayParts: [ts.displayPart(entryName, 5)], + documentation: undefined + }; + } + } + function getSymbolKind(symbol, typeResolver, location) { + var flags = symbol.getFlags(); + if (flags & 32) + return ScriptElementKind.classElement; + if (flags & 384) + return ScriptElementKind.enumElement; + if (flags & 524288) + return ScriptElementKind.typeElement; + if (flags & 64) + return ScriptElementKind.interfaceElement; + if (flags & 262144) + return ScriptElementKind.typeParameterElement; + var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, flags, typeResolver, location); + if (result === ScriptElementKind.unknown) { + if (flags & 262144) + return ScriptElementKind.typeParameterElement; + if (flags & 8) + return ScriptElementKind.variableElement; + if (flags & 8388608) + return ScriptElementKind.alias; + if (flags & 1536) + return ScriptElementKind.moduleElement; + } + return result; + } + function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, flags, typeResolver, location) { + if (typeResolver.isUndefinedSymbol(symbol)) { + return ScriptElementKind.variableElement; + } + if (typeResolver.isArgumentsSymbol(symbol)) { + return ScriptElementKind.localVariableElement; + } + if (flags & 3) { + if (ts.isFirstDeclarationOfSymbolParameter(symbol)) { + return ScriptElementKind.parameterElement; + } + else if (symbol.valueDeclaration && ts.isConst(symbol.valueDeclaration)) { + return ScriptElementKind.constElement; + } + else if (ts.forEach(symbol.declarations, ts.isLet)) { + return ScriptElementKind.letElement; + } + return isLocalVariableOrFunction(symbol) ? ScriptElementKind.localVariableElement : ScriptElementKind.variableElement; + } + if (flags & 16) + return isLocalVariableOrFunction(symbol) ? ScriptElementKind.localFunctionElement : ScriptElementKind.functionElement; + if (flags & 32768) + return ScriptElementKind.memberGetAccessorElement; + if (flags & 65536) + return ScriptElementKind.memberSetAccessorElement; + if (flags & 8192) + return ScriptElementKind.memberFunctionElement; + if (flags & 16384) + return ScriptElementKind.constructorImplementationElement; + if (flags & 4) { + if (flags & 268435456) { + var unionPropertyKind = ts.forEach(typeInfoResolver.getRootSymbols(symbol), function (rootSymbol) { + var rootSymbolFlags = rootSymbol.getFlags(); + if (rootSymbolFlags & (98308 | 3)) { + return ScriptElementKind.memberVariableElement; + } + ts.Debug.assert(!!(rootSymbolFlags & 8192)); + }); + if (!unionPropertyKind) { + var typeOfUnionProperty = typeInfoResolver.getTypeOfSymbolAtLocation(symbol, location); + if (typeOfUnionProperty.getCallSignatures().length) { + return ScriptElementKind.memberFunctionElement; + } + return ScriptElementKind.memberVariableElement; + } + return unionPropertyKind; + } + return ScriptElementKind.memberVariableElement; + } + return ScriptElementKind.unknown; + } + function getTypeKind(type) { + var flags = type.getFlags(); + if (flags & 128) + return ScriptElementKind.enumElement; + if (flags & 1024) + return ScriptElementKind.classElement; + if (flags & 2048) + return ScriptElementKind.interfaceElement; + if (flags & 512) + return ScriptElementKind.typeParameterElement; + if (flags & 1048703) + return ScriptElementKind.primitiveType; + if (flags & 256) + return ScriptElementKind.primitiveType; + return ScriptElementKind.unknown; + } + function getSymbolModifiers(symbol) { + return symbol && symbol.declarations && symbol.declarations.length > 0 ? ts.getNodeModifiers(symbol.declarations[0]) : ScriptElementKindModifier.none; + } + function getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, sourceFile, enclosingDeclaration, typeResolver, location, semanticMeaning) { + if (semanticMeaning === void 0) { semanticMeaning = getMeaningFromLocation(location); } + var displayParts = []; + var documentation; + var symbolFlags = symbol.flags; + var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags, typeResolver, location); + var hasAddedSymbolInfo; + if (symbolKind !== ScriptElementKind.unknown || symbolFlags & 32 || symbolFlags & 8388608) { + if (symbolKind === ScriptElementKind.memberGetAccessorElement || symbolKind === ScriptElementKind.memberSetAccessorElement) { + symbolKind = ScriptElementKind.memberVariableElement; + } + var type = typeResolver.getTypeOfSymbolAtLocation(symbol, location); + if (type) { + if (location.parent && location.parent.kind === 151) { + var right = location.parent.name; + if (right === location || (right && right.getFullWidth() === 0)) { + location = location.parent; + } + } + var callExpression; + if (location.kind === 153 || location.kind === 154) { + callExpression = location; + } + else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { + callExpression = location.parent; + } + if (callExpression) { + var candidateSignatures = []; + signature = typeResolver.getResolvedSignature(callExpression, candidateSignatures); + if (!signature && candidateSignatures.length) { + signature = candidateSignatures[0]; + } + var useConstructSignatures = callExpression.kind === 154 || callExpression.expression.kind === 90; + var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); + if (!ts.contains(allSignatures, signature.target || signature)) { + signature = allSignatures.length ? allSignatures[0] : undefined; + } + if (signature) { + if (useConstructSignatures && (symbolFlags & 32)) { + symbolKind = ScriptElementKind.constructorImplementationElement; + addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); + } + else if (symbolFlags & 8388608) { + symbolKind = ScriptElementKind.alias; + displayParts.push(ts.punctuationPart(16)); + displayParts.push(ts.textPart(symbolKind)); + displayParts.push(ts.punctuationPart(17)); + displayParts.push(ts.spacePart()); + if (useConstructSignatures) { + displayParts.push(ts.keywordPart(87)); + displayParts.push(ts.spacePart()); + } + addFullSymbolName(symbol); + } + else { + addPrefixForAnyFunctionOrVar(symbol, symbolKind); + } + switch (symbolKind) { + case ScriptElementKind.memberVariableElement: + case ScriptElementKind.variableElement: + case ScriptElementKind.constElement: + case ScriptElementKind.letElement: + case ScriptElementKind.parameterElement: + case ScriptElementKind.localVariableElement: + displayParts.push(ts.punctuationPart(51)); + displayParts.push(ts.spacePart()); + if (useConstructSignatures) { + displayParts.push(ts.keywordPart(87)); + displayParts.push(ts.spacePart()); + } + if (!(type.flags & 32768)) { + displayParts.push.apply(displayParts, ts.symbolToDisplayParts(typeResolver, type.symbol, enclosingDeclaration, undefined, 1)); + } + addSignatureDisplayParts(signature, allSignatures, 8); + break; + default: + addSignatureDisplayParts(signature, allSignatures); + } + hasAddedSymbolInfo = true; + } + } + else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || + (location.kind === 112 && location.parent.kind === 131)) { + var signature; + var functionDeclaration = location.parent; + var allSignatures = functionDeclaration.kind === 131 ? type.getConstructSignatures() : type.getCallSignatures(); + if (!typeResolver.isImplementationOfOverload(functionDeclaration)) { + signature = typeResolver.getSignatureFromDeclaration(functionDeclaration); + } + else { + signature = allSignatures[0]; + } + if (functionDeclaration.kind === 131) { + symbolKind = ScriptElementKind.constructorImplementationElement; + addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); + } + else { + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 134 && + !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); + } + addSignatureDisplayParts(signature, allSignatures); + hasAddedSymbolInfo = true; + } + } + } + if (symbolFlags & 32 && !hasAddedSymbolInfo) { + displayParts.push(ts.keywordPart(68)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + writeTypeParametersOfSymbol(symbol, sourceFile); + } + if ((symbolFlags & 64) && (semanticMeaning & 2)) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(102)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + writeTypeParametersOfSymbol(symbol, sourceFile); + } + if (symbolFlags & 524288) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(121)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + displayParts.push(ts.spacePart()); + displayParts.push(ts.operatorPart(52)); + displayParts.push(ts.spacePart()); + displayParts.push.apply(displayParts, ts.typeToDisplayParts(typeResolver, typeResolver.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration)); + } + if (symbolFlags & 384) { + addNewLineIfDisplayPartsExist(); + if (ts.forEach(symbol.declarations, ts.isConstEnumDeclaration)) { + displayParts.push(ts.keywordPart(69)); + displayParts.push(ts.spacePart()); + } + displayParts.push(ts.keywordPart(76)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + } + if (symbolFlags & 1536) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(115)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + } + if ((symbolFlags & 262144) && (semanticMeaning & 2)) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.punctuationPart(16)); + displayParts.push(ts.textPart("type parameter")); + displayParts.push(ts.punctuationPart(17)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + displayParts.push(ts.spacePart()); + displayParts.push(ts.keywordPart(85)); + displayParts.push(ts.spacePart()); + if (symbol.parent) { + addFullSymbolName(symbol.parent, enclosingDeclaration); + writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); + } + else { + var signatureDeclaration = ts.getDeclarationOfKind(symbol, 125).parent; + var signature = typeResolver.getSignatureFromDeclaration(signatureDeclaration); + if (signatureDeclaration.kind === 135) { + displayParts.push(ts.keywordPart(87)); + displayParts.push(ts.spacePart()); + } + else if (signatureDeclaration.kind !== 134 && signatureDeclaration.name) { + addFullSymbolName(signatureDeclaration.symbol); + } + displayParts.push.apply(displayParts, ts.signatureToDisplayParts(typeResolver, signature, sourceFile, 32)); + } + } + if (symbolFlags & 8) { + addPrefixForAnyFunctionOrVar(symbol, "enum member"); + var declaration = symbol.declarations[0]; + if (declaration.kind === 209) { + var constantValue = typeResolver.getConstantValue(declaration); + if (constantValue !== undefined) { + displayParts.push(ts.spacePart()); + displayParts.push(ts.operatorPart(52)); + displayParts.push(ts.spacePart()); + displayParts.push(ts.displayPart(constantValue.toString(), 7)); + } + } + } + if (symbolFlags & 8388608) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(84)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + ts.forEach(symbol.declarations, function (declaration) { + if (declaration.kind === 200) { + var importDeclaration = declaration; + if (ts.isExternalModuleImportDeclaration(importDeclaration)) { + displayParts.push(ts.spacePart()); + displayParts.push(ts.operatorPart(52)); + displayParts.push(ts.spacePart()); + displayParts.push(ts.keywordPart(116)); + displayParts.push(ts.punctuationPart(16)); + displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportDeclarationExpression(importDeclaration)), 8)); + displayParts.push(ts.punctuationPart(17)); + } + else { + var internalAliasSymbol = typeResolver.getSymbolAtLocation(importDeclaration.moduleReference); + if (internalAliasSymbol) { + displayParts.push(ts.spacePart()); + displayParts.push(ts.operatorPart(52)); + displayParts.push(ts.spacePart()); + addFullSymbolName(internalAliasSymbol, enclosingDeclaration); + } + } + return true; + } + }); + } + if (!hasAddedSymbolInfo) { + if (symbolKind !== ScriptElementKind.unknown) { + if (type) { + addPrefixForAnyFunctionOrVar(symbol, symbolKind); + if (symbolKind === ScriptElementKind.memberVariableElement || + symbolFlags & 3 || + symbolKind === ScriptElementKind.localVariableElement) { + displayParts.push(ts.punctuationPart(51)); + displayParts.push(ts.spacePart()); + if (type.symbol && type.symbol.flags & 262144) { + var typeParameterParts = ts.mapToDisplayParts(function (writer) { + typeResolver.getSymbolDisplayBuilder().buildTypeParameterDisplay(type, writer, enclosingDeclaration); + }); + displayParts.push.apply(displayParts, typeParameterParts); + } + else { + displayParts.push.apply(displayParts, ts.typeToDisplayParts(typeResolver, type, enclosingDeclaration)); + } + } + else if (symbolFlags & 16 || + symbolFlags & 8192 || + symbolFlags & 16384 || + symbolFlags & 131072 || + symbolFlags & 98304 || + symbolKind === ScriptElementKind.memberFunctionElement) { + var allSignatures = type.getCallSignatures(); + addSignatureDisplayParts(allSignatures[0], allSignatures); + } + } + } + else { + symbolKind = getSymbolKind(symbol, typeResolver, location); + } + } + if (!documentation) { + documentation = symbol.getDocumentationComment(); + } + return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind }; + function addNewLineIfDisplayPartsExist() { + if (displayParts.length) { + displayParts.push(ts.lineBreakPart()); + } + } + function addFullSymbolName(symbol, enclosingDeclaration) { + var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeResolver, symbol, enclosingDeclaration || sourceFile, undefined, 1 | 2); + displayParts.push.apply(displayParts, fullSymbolDisplayParts); + } + function addPrefixForAnyFunctionOrVar(symbol, symbolKind) { + addNewLineIfDisplayPartsExist(); + if (symbolKind) { + displayParts.push(ts.punctuationPart(16)); + displayParts.push(ts.textPart(symbolKind)); + displayParts.push(ts.punctuationPart(17)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + } + } + function addSignatureDisplayParts(signature, allSignatures, flags) { + displayParts.push.apply(displayParts, ts.signatureToDisplayParts(typeResolver, signature, enclosingDeclaration, flags | 32)); + if (allSignatures.length > 1) { + displayParts.push(ts.spacePart()); + displayParts.push(ts.punctuationPart(16)); + displayParts.push(ts.operatorPart(33)); + displayParts.push(ts.displayPart((allSignatures.length - 1).toString(), 7)); + displayParts.push(ts.spacePart()); + displayParts.push(ts.textPart(allSignatures.length === 2 ? "overload" : "overloads")); + displayParts.push(ts.punctuationPart(17)); + } + documentation = signature.getDocumentationComment(); + } + function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) { + var typeParameterParts = ts.mapToDisplayParts(function (writer) { + typeResolver.getSymbolDisplayBuilder().buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration); + }); + displayParts.push.apply(displayParts, typeParameterParts); + } + } + function getQuickInfoAtPosition(fileName, position) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); + var node = ts.getTouchingPropertyName(sourceFile, position); + if (!node) { + return undefined; + } + var symbol = typeInfoResolver.getSymbolAtLocation(node); + if (!symbol) { + switch (node.kind) { + case 64: + case 151: + case 123: + case 92: + case 90: + var type = typeInfoResolver.getTypeAtLocation(node); + if (type) { + return { + kind: ScriptElementKind.unknown, + kindModifiers: ScriptElementKindModifier.none, + textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), + displayParts: ts.typeToDisplayParts(typeInfoResolver, type, getContainerNode(node)), + documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined + }; + } + } + return undefined; + } + var displayPartsDocumentationsAndKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, sourceFile, getContainerNode(node), typeInfoResolver, node); + return { + kind: displayPartsDocumentationsAndKind.symbolKind, + kindModifiers: getSymbolModifiers(symbol), + textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), + displayParts: displayPartsDocumentationsAndKind.displayParts, + documentation: displayPartsDocumentationsAndKind.documentation + }; + } + function getDefinitionAtPosition(fileName, position) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); + var node = ts.getTouchingPropertyName(sourceFile, position); + if (!node) { + return undefined; + } + if (isJumpStatementTarget(node)) { + var labelName = node.text; + var label = getTargetLabel(node.parent, node.text); + return label ? [getDefinitionInfo(label, ScriptElementKind.label, labelName, undefined)] : undefined; + } + var comment = ts.forEach(sourceFile.referencedFiles, function (r) { return (r.pos <= position && position < r.end) ? r : undefined; }); + if (comment) { + var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); + if (referenceFile) { + return [{ + fileName: referenceFile.fileName, + textSpan: ts.createTextSpanFromBounds(0, 0), + kind: ScriptElementKind.scriptElement, + name: comment.fileName, + containerName: undefined, + containerKind: undefined + }]; + } + return undefined; + } + var symbol = typeInfoResolver.getSymbolAtLocation(node); + if (!symbol) { + return undefined; + } + var result = []; + if (node.parent.kind === 208) { + var shorthandSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); + var shorthandDeclarations = shorthandSymbol.getDeclarations(); + var shorthandSymbolKind = getSymbolKind(shorthandSymbol, typeInfoResolver, node); + var shorthandSymbolName = typeInfoResolver.symbolToString(shorthandSymbol); + var shorthandContainerName = typeInfoResolver.symbolToString(symbol.parent, node); + ts.forEach(shorthandDeclarations, function (declaration) { + result.push(getDefinitionInfo(declaration, shorthandSymbolKind, shorthandSymbolName, shorthandContainerName)); + }); + return result; + } + var declarations = symbol.getDeclarations(); + var symbolName = typeInfoResolver.symbolToString(symbol); + var symbolKind = getSymbolKind(symbol, typeInfoResolver, node); + var containerSymbol = symbol.parent; + var containerName = containerSymbol ? typeInfoResolver.symbolToString(containerSymbol, node) : ""; + if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && + !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { + ts.forEach(declarations, function (declaration) { + result.push(getDefinitionInfo(declaration, symbolKind, symbolName, containerName)); + }); + } + return result; + function getDefinitionInfo(node, symbolKind, symbolName, containerName) { + return { + fileName: node.getSourceFile().fileName, + textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), + kind: symbolKind, + name: symbolName, + containerKind: undefined, + containerName: containerName + }; + } + function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) { + var declarations = []; + var definition; + ts.forEach(signatureDeclarations, function (d) { + if ((selectConstructors && d.kind === 131) || + (!selectConstructors && (d.kind === 193 || d.kind === 130 || d.kind === 129))) { + declarations.push(d); + if (d.body) + definition = d; + } + }); + if (definition) { + result.push(getDefinitionInfo(definition, symbolKind, symbolName, containerName)); + return true; + } + else if (declarations.length) { + result.push(getDefinitionInfo(declarations[declarations.length - 1], symbolKind, symbolName, containerName)); + return true; + } + return false; + } + function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) { + if (isNewExpressionTarget(location) || location.kind === 112) { + if (symbol.flags & 32) { + var classDeclaration = symbol.getDeclarations()[0]; + ts.Debug.assert(classDeclaration && classDeclaration.kind === 194); + return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result); + } + } + return false; + } + function tryAddCallSignature(symbol, location, symbolKind, symbolName, containerName, result) { + if (isCallExpressionTarget(location) || isNewExpressionTarget(location) || isNameOfFunctionDeclaration(location)) { + return tryAddSignature(symbol.declarations, false, symbolKind, symbolName, containerName, result); + } + return false; + } + } + function getOccurrencesAtPosition(fileName, position) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); + var node = ts.getTouchingWord(sourceFile, position); + if (!node) { + return undefined; + } + if (node.kind === 64 || node.kind === 92 || node.kind === 90 || + isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { + return getReferencesForNode(node, [sourceFile], true, false, false); + } + switch (node.kind) { + case 83: + case 75: + if (hasKind(node.parent, 176)) { + return getIfElseOccurrences(node.parent); + } + break; + case 89: + if (hasKind(node.parent, 184)) { + return getReturnOccurrences(node.parent); + } + break; + case 93: + if (hasKind(node.parent, 188)) { + return getThrowOccurrences(node.parent); + } + break; + case 67: + if (hasKind(parent(parent(node)), 189)) { + return getTryCatchFinallyOccurrences(node.parent.parent); + } + break; + case 95: + case 80: + if (hasKind(parent(node), 189)) { + return getTryCatchFinallyOccurrences(node.parent); + } + break; + case 91: + if (hasKind(node.parent, 186)) { + return getSwitchCaseDefaultOccurrences(node.parent); + } + break; + case 66: + case 72: + if (hasKind(parent(parent(node)), 186)) { + return getSwitchCaseDefaultOccurrences(node.parent.parent); + } + break; + case 65: + case 70: + if (hasKind(node.parent, 183) || hasKind(node.parent, 182)) { + return getBreakOrContinueStatementOccurences(node.parent); + } + break; + case 81: + if (hasKind(node.parent, 179) || + hasKind(node.parent, 180) || + hasKind(node.parent, 181)) { + return getLoopBreakContinueOccurrences(node.parent); + } + break; + case 99: + case 74: + if (hasKind(node.parent, 178) || hasKind(node.parent, 177)) { + return getLoopBreakContinueOccurrences(node.parent); + } + break; + case 112: + if (hasKind(node.parent, 131)) { + return getConstructorOccurrences(node.parent); + } + break; + case 114: + case 118: + if (hasKind(node.parent, 132) || hasKind(node.parent, 133)) { + return getGetAndSetOccurrences(node.parent); + } + default: + if (ts.isModifier(node.kind) && node.parent && + (ts.isDeclaration(node.parent) || node.parent.kind === 173)) { + return getModifierOccurrences(node.kind, node.parent); + } + } + return undefined; + function getIfElseOccurrences(ifStatement) { + var keywords = []; + while (hasKind(ifStatement.parent, 176) && ifStatement.parent.elseStatement === ifStatement) { + ifStatement = ifStatement.parent; + } + while (ifStatement) { + var children = ifStatement.getChildren(); + pushKeywordIf(keywords, children[0], 83); + for (var i = children.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, children[i], 75)) { + break; + } + } + if (!hasKind(ifStatement.elseStatement, 176)) { + break; + } + ifStatement = ifStatement.elseStatement; + } + var result = []; + for (var i = 0; i < keywords.length; i++) { + if (keywords[i].kind === 75 && i < keywords.length - 1) { + var elseKeyword = keywords[i]; + var ifKeyword = keywords[i + 1]; + var shouldHighlightNextKeyword = true; + for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { + if (!ts.isWhiteSpace(sourceFile.text.charCodeAt(j))) { + shouldHighlightNextKeyword = false; + break; + } + } + if (shouldHighlightNextKeyword) { + result.push({ + fileName: fileName, + textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), + isWriteAccess: false + }); + i++; + continue; + } + } + result.push(getReferenceEntryFromNode(keywords[i])); + } + return result; + } + function getReturnOccurrences(returnStatement) { + var func = ts.getContainingFunction(returnStatement); + if (!(func && hasKind(func.body, 172))) { + return undefined; + } + var keywords = []; + ts.forEachReturnStatement(func.body, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 89); + }); + ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 93); + }); + return ts.map(keywords, getReferenceEntryFromNode); + } + function getThrowOccurrences(throwStatement) { + var owner = getThrowStatementOwner(throwStatement); + if (!owner) { + return undefined; + } + var keywords = []; + ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 93); + }); + if (ts.isFunctionBlock(owner)) { + ts.forEachReturnStatement(owner, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 89); + }); + } + return ts.map(keywords, getReferenceEntryFromNode); + } + function aggregateOwnedThrowStatements(node) { + var statementAccumulator = []; + aggregate(node); + return statementAccumulator; + function aggregate(node) { + if (node.kind === 188) { + statementAccumulator.push(node); + } + else if (node.kind === 189) { + var tryStatement = node; + if (tryStatement.catchClause) { + aggregate(tryStatement.catchClause); + } + else { + aggregate(tryStatement.tryBlock); + } + if (tryStatement.finallyBlock) { + aggregate(tryStatement.finallyBlock); + } + } + else if (!ts.isAnyFunction(node)) { + ts.forEachChild(node, aggregate); + } + } + ; + } + function getThrowStatementOwner(throwStatement) { + var child = throwStatement; + while (child.parent) { + var parent = child.parent; + if (ts.isFunctionBlock(parent) || parent.kind === 210) { + return parent; + } + if (parent.kind === 189) { + var tryStatement = parent; + if (tryStatement.tryBlock === child && tryStatement.catchClause) { + return child; + } + } + child = parent; + } + return undefined; + } + function getTryCatchFinallyOccurrences(tryStatement) { + var keywords = []; + pushKeywordIf(keywords, tryStatement.getFirstToken(), 95); + if (tryStatement.catchClause) { + pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 67); + } + if (tryStatement.finallyBlock) { + var finallyKeyword = ts.findChildOfKind(tryStatement, 80, sourceFile); + pushKeywordIf(keywords, finallyKeyword, 80); + } + return ts.map(keywords, getReferenceEntryFromNode); + } + function getLoopBreakContinueOccurrences(loopNode) { + var keywords = []; + if (pushKeywordIf(keywords, loopNode.getFirstToken(), 81, 99, 74)) { + if (loopNode.kind === 177) { + var loopTokens = loopNode.getChildren(); + for (var i = loopTokens.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, loopTokens[i], 99)) { + break; + } + } + } + } + var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(loopNode, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 65, 70); + } + }); + return ts.map(keywords, getReferenceEntryFromNode); + } + function getSwitchCaseDefaultOccurrences(switchStatement) { + var keywords = []; + pushKeywordIf(keywords, switchStatement.getFirstToken(), 91); + ts.forEach(switchStatement.clauses, function (clause) { + pushKeywordIf(keywords, clause.getFirstToken(), 66, 72); + var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(switchStatement, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 65); + } + }); + }); + return ts.map(keywords, getReferenceEntryFromNode); + } + function getBreakOrContinueStatementOccurences(breakOrContinueStatement) { + var owner = getBreakOrContinueOwner(breakOrContinueStatement); + if (owner) { + switch (owner.kind) { + case 179: + case 180: + case 181: + case 177: + case 178: + return getLoopBreakContinueOccurrences(owner); + case 186: + return getSwitchCaseDefaultOccurrences(owner); + } + } + return undefined; + } + function aggregateAllBreakAndContinueStatements(node) { + var statementAccumulator = []; + aggregate(node); + return statementAccumulator; + function aggregate(node) { + if (node.kind === 183 || node.kind === 182) { + statementAccumulator.push(node); + } + else if (!ts.isAnyFunction(node)) { + ts.forEachChild(node, aggregate); + } + } + ; + } + function ownsBreakOrContinueStatement(owner, statement) { + var actualOwner = getBreakOrContinueOwner(statement); + return actualOwner && actualOwner === owner; + } + function getBreakOrContinueOwner(statement) { + for (var node = statement.parent; node; node = node.parent) { + switch (node.kind) { + case 186: + if (statement.kind === 182) { + continue; + } + case 179: + case 180: + case 181: + case 178: + case 177: + if (!statement.label || isLabeledBy(node, statement.label.text)) { + return node; + } + break; + default: + if (ts.isAnyFunction(node)) { + return undefined; + } + break; + } + } + return undefined; + } + function getConstructorOccurrences(constructorDeclaration) { + var declarations = constructorDeclaration.symbol.getDeclarations(); + var keywords = []; + ts.forEach(declarations, function (declaration) { + ts.forEach(declaration.getChildren(), function (token) { + return pushKeywordIf(keywords, token, 112); + }); + }); + return ts.map(keywords, getReferenceEntryFromNode); + } + function getGetAndSetOccurrences(accessorDeclaration) { + var keywords = []; + tryPushAccessorKeyword(accessorDeclaration.symbol, 132); + tryPushAccessorKeyword(accessorDeclaration.symbol, 133); + return ts.map(keywords, getReferenceEntryFromNode); + function tryPushAccessorKeyword(accessorSymbol, accessorKind) { + var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); + if (accessor) { + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 114, 118); }); + } + } + } + function getModifierOccurrences(modifier, declaration) { + var container = declaration.parent; + if (declaration.flags & 112) { + if (!(container.kind === 194 || + (declaration.kind === 126 && hasKind(container, 131)))) { + return undefined; + } + } + else if (declaration.flags & 128) { + if (container.kind !== 194) { + return undefined; + } + } + else if (declaration.flags & (1 | 2)) { + if (!(container.kind === 199 || container.kind === 210)) { + return undefined; + } + } + else { + return undefined; + } + var keywords = []; + var modifierFlag = getFlagFromModifier(modifier); + var nodes; + switch (container.kind) { + case 199: + case 210: + nodes = container.statements; + break; + case 131: + nodes = container.parameters.concat(container.parent.members); + break; + case 194: + nodes = container.members; + if (modifierFlag & 112) { + var constructor = ts.forEach(container.members, function (member) { + return member.kind === 131 && member; + }); + if (constructor) { + nodes = nodes.concat(constructor.parameters); + } + } + break; + default: + ts.Debug.fail("Invalid container kind."); + } + ts.forEach(nodes, function (node) { + if (node.modifiers && node.flags & modifierFlag) { + ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); }); + } + }); + return ts.map(keywords, getReferenceEntryFromNode); + function getFlagFromModifier(modifier) { + switch (modifier) { + case 107: + return 16; + case 105: + return 32; + case 106: + return 64; + case 108: + return 128; + case 77: + return 1; + case 113: + return 2; + default: + ts.Debug.fail(); + } + } + } + function hasKind(node, kind) { + return node !== undefined && node.kind === kind; + } + function parent(node) { + return node && node.parent; + } + function pushKeywordIf(keywordList, token) { + var expected = []; + for (var _i = 2; _i < arguments.length; _i++) { + expected[_i - 2] = arguments[_i]; + } + if (token && ts.contains(expected, token.kind)) { + keywordList.push(token); + return true; + } + return false; + } + } + function findRenameLocations(fileName, position, findInStrings, findInComments) { + return findReferences(fileName, position, findInStrings, findInComments); + } + function getReferencesAtPosition(fileName, position) { + return findReferences(fileName, position, false, false); + } + function findReferences(fileName, position, findInStrings, findInComments) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); + var node = ts.getTouchingPropertyName(sourceFile, position); + if (!node) { + return undefined; + } + if (node.kind !== 64 && + !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && + !isNameOfExternalModuleImportOrDeclaration(node)) { + return undefined; + } + ts.Debug.assert(node.kind === 64 || node.kind === 7 || node.kind === 8); + return getReferencesForNode(node, program.getSourceFiles(), false, findInStrings, findInComments); + } + function initializeNameTable(sourceFile) { + var nameTable = {}; + walk(sourceFile); + sourceFile.nameTable = nameTable; + function walk(node) { + switch (node.kind) { + case 64: + nameTable[node.text] = node.text; + break; + case 8: + case 7: + nameTable[node.text] = node.text; + break; + default: + ts.forEachChild(node, walk); + } + } + } + function getReferencesForNode(node, sourceFiles, searchOnlyInCurrentFile, findInStrings, findInComments) { + if (isLabelName(node)) { + if (isJumpStatementTarget(node)) { + var labelDefinition = getTargetLabel(node.parent, node.text); + return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : [getReferenceEntryFromNode(node)]; + } + else { + return getLabelReferencesInNode(node.parent, node); + } + } + if (node.kind === 92) { + return getReferencesForThisKeyword(node, sourceFiles); + } + if (node.kind === 90) { + return getReferencesForSuperKeyword(node); + } + var symbol = typeInfoResolver.getSymbolAtLocation(node); + if (!symbol) { + return [getReferenceEntryFromNode(node)]; + } + var declarations = symbol.declarations; + if (!declarations || !declarations.length) { + return undefined; + } + var result; + var searchMeaning = getIntersectingMeaningFromDeclarations(getMeaningFromLocation(node), declarations); + var declaredName = getDeclaredName(symbol); + var scope = getSymbolScope(symbol); + if (scope) { + result = []; + getReferencesInNode(scope, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result); + } + else { + if (searchOnlyInCurrentFile) { + ts.Debug.assert(sourceFiles.length === 1); + result = []; + getReferencesInNode(sourceFiles[0], symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result); + } + else { + var internedName = getInternedName(symbol, declarations); + ts.forEach(sourceFiles, function (sourceFile) { + cancellationToken.throwIfCancellationRequested(); + if (!sourceFile.nameTable) { + initializeNameTable(sourceFile); + } + ts.Debug.assert(sourceFile.nameTable !== undefined); + if (ts.lookUp(sourceFile.nameTable, internedName)) { + result = result || []; + getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result); + } + }); + } + } + return result; + function getDeclaredName(symbol) { + var name = typeInfoResolver.symbolToString(symbol); + return stripQuotes(name); + } + function getInternedName(symbol, declarations) { + var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 158 ? d : undefined; }); + if (functionExpression && functionExpression.name) { + var name = functionExpression.name.text; + } + else { + var name = symbol.name; + } + return stripQuotes(name); + } + function stripQuotes(name) { + var length = name.length; + if (length >= 2 && name.charCodeAt(0) === 34 && name.charCodeAt(length - 1) === 34) { + return name.substring(1, length - 1); + } + ; + return name; + } + function getSymbolScope(symbol) { + if (symbol.getFlags() && (4 | 8192)) { + var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32) ? d : undefined; }); + if (privateDeclaration) { + return ts.getAncestor(privateDeclaration, 194); + } + } + if (symbol.parent || (symbol.getFlags() & 268435456)) { + return undefined; + } + var scope = undefined; + var declarations = symbol.getDeclarations(); + if (declarations) { + for (var i = 0, n = declarations.length; i < n; i++) { + var container = getContainerNode(declarations[i]); + if (!container) { + return undefined; + } + if (scope && scope !== container) { + return undefined; + } + if (container.kind === 210 && !ts.isExternalModule(container)) { + return undefined; + } + scope = container; + } + } + return scope; + } + function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end) { + var positions = []; + if (!symbolName || !symbolName.length) { + return positions; + } + var text = sourceFile.text; + var sourceLength = text.length; + var symbolNameLength = symbolName.length; + var position = text.indexOf(symbolName, start); + while (position >= 0) { + cancellationToken.throwIfCancellationRequested(); + if (position > end) + break; + var endPosition = position + symbolNameLength; + if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2)) && + (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2))) { + positions.push(position); + } + position = text.indexOf(symbolName, position + symbolNameLength + 1); + } + return positions; + } + function getLabelReferencesInNode(container, targetLabel) { + var result = []; + var sourceFile = container.getSourceFile(); + var labelName = targetLabel.text; + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd()); + ts.forEach(possiblePositions, function (position) { + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || node.getWidth() !== labelName.length) { + return; + } + if (node === targetLabel || + (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) { + result.push(getReferenceEntryFromNode(node)); + } + }); + return result; + } + function isValidReferencePosition(node, searchSymbolName) { + if (node) { + switch (node.kind) { + case 64: + return node.getWidth() === searchSymbolName.length; + case 8: + if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || + isNameOfExternalModuleImportOrDeclaration(node)) { + return node.getWidth() === searchSymbolName.length + 2; + } + break; + case 7: + if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { + return node.getWidth() === searchSymbolName.length; + } + break; + } + } + return false; + } + function getReferencesInNode(container, searchSymbol, searchText, searchLocation, searchMeaning, findInStrings, findInComments, result) { + var sourceFile = container.getSourceFile(); + var tripleSlashDirectivePrefixRegex = /^\/\/\/\s*= 0) { + result.push(getReferenceEntryFromNode(referenceSymbolDeclaration.name)); + } + } + }); + } + function isInString(position) { + var token = ts.getTokenAtPosition(sourceFile, position); + return token && token.kind === 8 && position > token.getStart(); + } + function isInComment(position) { + var token = ts.getTokenAtPosition(sourceFile, position); + if (token && position < token.getStart()) { + var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); + return ts.forEach(commentRanges, function (c) { + if (c.pos < position && position < c.end) { + var commentText = sourceFile.text.substring(c.pos, c.end); + if (!tripleSlashDirectivePrefixRegex.test(commentText)) { + return true; + } + } + }); + } + return false; + } + } + function getReferencesForSuperKeyword(superKeyword) { + var searchSpaceNode = ts.getSuperContainer(superKeyword, false); + if (!searchSpaceNode) { + return undefined; + } + var staticFlag = 128; + switch (searchSpaceNode.kind) { + case 128: + case 127: + case 130: + case 129: + case 131: + case 132: + case 133: + staticFlag &= searchSpaceNode.flags; + searchSpaceNode = searchSpaceNode.parent; + break; + default: + return undefined; + } + var result = []; + var sourceFile = searchSpaceNode.getSourceFile(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); + ts.forEach(possiblePositions, function (position) { + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || node.kind !== 90) { + return; + } + var container = ts.getSuperContainer(node, false); + if (container && (128 & container.flags) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + }); + return result; + } + function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { + var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); + var staticFlag = 128; + switch (searchSpaceNode.kind) { + case 130: + case 129: + if (ts.isObjectLiteralMethod(searchSpaceNode)) { + break; + } + case 128: + case 127: + case 131: + case 132: + case 133: + staticFlag &= searchSpaceNode.flags; + searchSpaceNode = searchSpaceNode.parent; + break; + case 210: + if (ts.isExternalModule(searchSpaceNode)) { + return undefined; + } + case 193: + case 158: + break; + default: + return undefined; + } + var result = []; + if (searchSpaceNode.kind === 210) { + ts.forEach(sourceFiles, function (sourceFile) { + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); + getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, result); + }); + } + else { + var sourceFile = searchSpaceNode.getSourceFile(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); + getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result); + } + return result; + function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) { + ts.forEach(possiblePositions, function (position) { + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || node.kind !== 92) { + return; + } + var container = ts.getThisContainer(node, false); + switch (searchSpaceNode.kind) { + case 158: + case 193: + if (searchSpaceNode.symbol === container.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 130: + case 129: + if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 194: + if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128) === staticFlag) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 210: + if (container.kind === 210 && !ts.isExternalModule(container)) { + result.push(getReferenceEntryFromNode(node)); + } + break; + } + }); + } + } + function populateSearchSymbolSet(symbol, location) { + var result = [symbol]; + if (isNameOfPropertyAssignment(location)) { + ts.forEach(getPropertySymbolsFromContextualType(location), function (contextualSymbol) { + result.push.apply(result, typeInfoResolver.getRootSymbols(contextualSymbol)); + }); + var shorthandValueSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(location.parent); + if (shorthandValueSymbol) { + result.push(shorthandValueSymbol); + } + } + ts.forEach(typeInfoResolver.getRootSymbols(symbol), function (rootSymbol) { + if (rootSymbol !== symbol) { + result.push(rootSymbol); + } + if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); + } + }); + return result; + } + function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { + if (symbol && symbol.flags & (32 | 64)) { + ts.forEach(symbol.getDeclarations(), function (declaration) { + if (declaration.kind === 194) { + getPropertySymbolFromTypeReference(ts.getClassBaseTypeNode(declaration)); + ts.forEach(ts.getClassImplementedTypeNodes(declaration), getPropertySymbolFromTypeReference); + } + else if (declaration.kind === 195) { + ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); + } + }); + } + return; + function getPropertySymbolFromTypeReference(typeReference) { + if (typeReference) { + var type = typeInfoResolver.getTypeAtLocation(typeReference); + if (type) { + var propertySymbol = typeInfoResolver.getPropertyOfType(type, propertyName); + if (propertySymbol) { + result.push(propertySymbol); + } + getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result); + } + } + } + } + function isRelatableToSearchSet(searchSymbols, referenceSymbol, referenceLocation) { + if (searchSymbols.indexOf(referenceSymbol) >= 0) { + return true; + } + if (isNameOfPropertyAssignment(referenceLocation)) { + return ts.forEach(getPropertySymbolsFromContextualType(referenceLocation), function (contextualSymbol) { + return ts.forEach(typeInfoResolver.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0; }); + }); + } + return ts.forEach(typeInfoResolver.getRootSymbols(referenceSymbol), function (rootSymbol) { + if (searchSymbols.indexOf(rootSymbol) >= 0) { + return true; + } + if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { + var result = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); + return ts.forEach(result, function (s) { return searchSymbols.indexOf(s) >= 0; }); + } + return false; + }); + } + function getPropertySymbolsFromContextualType(node) { + if (isNameOfPropertyAssignment(node)) { + var objectLiteral = node.parent.parent; + var contextualType = typeInfoResolver.getContextualType(objectLiteral); + var name = node.text; + if (contextualType) { + if (contextualType.flags & 16384) { + var unionProperty = contextualType.getProperty(name); + if (unionProperty) { + return [unionProperty]; + } + else { + var result = []; + ts.forEach(contextualType.types, function (t) { + var symbol = t.getProperty(name); + if (symbol) { + result.push(symbol); + } + }); + return result; + } + } + else { + var symbol = contextualType.getProperty(name); + if (symbol) { + return [symbol]; + } + } + } + } + return undefined; + } + function getIntersectingMeaningFromDeclarations(meaning, declarations) { + if (declarations) { + do { + var lastIterationMeaning = meaning; + for (var i = 0, n = declarations.length; i < n; i++) { + var declarationMeaning = getMeaningFromDeclaration(declarations[i]); + if (declarationMeaning & meaning) { + meaning |= declarationMeaning; + } + } + } while (meaning !== lastIterationMeaning); + } + return meaning; + } + } + function getReferenceEntryFromNode(node) { + var start = node.getStart(); + var end = node.getEnd(); + if (node.kind === 8) { + start += 1; + end -= 1; + } + return { + fileName: node.getSourceFile().fileName, + textSpan: ts.createTextSpanFromBounds(start, end), + isWriteAccess: isWriteAccess(node) + }; + } + function isWriteAccess(node) { + if (node.kind === 64 && ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + return true; + } + var parent = node.parent; + if (parent) { + if (parent.kind === 164 || parent.kind === 163) { + return true; + } + else if (parent.kind === 165 && parent.left === node) { + var operator = parent.operatorToken.kind; + return 52 <= operator && operator <= 63; + } + } + return false; + } + function getNavigateToItems(searchValue, maxResultCount) { + synchronizeHostData(); + return ts.NavigateTo.getNavigateToItems(program, cancellationToken, searchValue, maxResultCount); + } + function containErrors(diagnostics) { + return ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === 1; }); + } + function getEmitOutput(fileName) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); + var outputFiles = []; + function writeFile(fileName, data, writeByteOrderMark) { + outputFiles.push({ + name: fileName, + writeByteOrderMark: writeByteOrderMark, + text: data + }); + } + var emitOutput = program.emit(sourceFile, writeFile); + return { + outputFiles: outputFiles, + emitSkipped: emitOutput.emitSkipped + }; + } + function getMeaningFromDeclaration(node) { + switch (node.kind) { + case 126: + case 191: + case 148: + case 128: + case 127: + case 207: + case 208: + case 209: + case 130: + case 129: + case 131: + case 132: + case 133: + case 193: + case 158: + case 159: + case 206: + return 1; + case 125: + case 195: + case 196: + case 141: + return 2; + case 194: + case 197: + return 1 | 2; + case 198: + if (node.name.kind === 8) { + return 4 | 1; + } + else if (ts.getModuleInstanceState(node) === 1) { + return 4 | 1; + } + else { + return 4; + } + case 200: + return 1 | 2 | 4; + case 210: + return 4 | 1; + } + ts.Debug.fail("Unknown declaration type"); + } + function isTypeReference(node) { + if (isRightSideOfQualifiedName(node)) { + node = node.parent; + } + return node.parent.kind === 137; + } + function isNamespaceReference(node) { + var root = node; + var isLastClause = true; + if (root.parent.kind === 123) { + while (root.parent && root.parent.kind === 123) + root = root.parent; + isLastClause = root.right === node; + } + return root.parent.kind === 137 && !isLastClause; + } + function isInRightSideOfImport(node) { + while (node.parent.kind === 123) { + node = node.parent; + } + return ts.isInternalModuleImportDeclaration(node.parent) && node.parent.moduleReference === node; + } + function getMeaningFromRightHandSideOfImport(node) { + ts.Debug.assert(node.kind === 64); + if (node.parent.kind === 123 && + node.parent.right === node && + node.parent.parent.kind === 200) { + return 1 | 2 | 4; + } + return 4; + } + function getMeaningFromLocation(node) { + if (node.parent.kind === 201) { + return 1 | 2 | 4; + } + else if (isInRightSideOfImport(node)) { + return getMeaningFromRightHandSideOfImport(node); + } + else if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + return getMeaningFromDeclaration(node.parent); + } + else if (isTypeReference(node)) { + return 2; + } + else if (isNamespaceReference(node)) { + return 4; + } + else { + return 1; + } + } + function getSignatureHelpItems(fileName, position) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); + return ts.SignatureHelp.getSignatureHelpItems(sourceFile, position, typeInfoResolver, cancellationToken); + } + function getCurrentSourceFile(fileName) { + fileName = ts.normalizeSlashes(fileName); + var currentSourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + return currentSourceFile; + } + function getNameOrDottedNameSpan(fileName, startPos, endPos) { + fileName = ts.normalizeSlashes(fileName); + var node = ts.getTouchingPropertyName(getCurrentSourceFile(fileName), startPos); + if (!node) { + return; + } + switch (node.kind) { + case 151: + case 123: + case 8: + case 79: + case 94: + case 88: + case 90: + case 92: + case 64: + break; + default: + return; + } + var nodeForStartPos = node; + while (true) { + if (isRightSideOfPropertyAccess(nodeForStartPos) || isRightSideOfQualifiedName(nodeForStartPos)) { + nodeForStartPos = nodeForStartPos.parent; + } + else if (isNameOfModuleDeclaration(nodeForStartPos)) { + if (nodeForStartPos.parent.parent.kind === 198 && + nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { + nodeForStartPos = nodeForStartPos.parent.parent.name; + } + else { + break; + } + } + else { + break; + } + } + return ts.createTextSpanFromBounds(nodeForStartPos.getStart(), node.getEnd()); + } + function getBreakpointStatementAtPosition(fileName, position) { + fileName = ts.normalizeSlashes(fileName); + return ts.BreakpointResolver.spanInSourceFileAtLocation(getCurrentSourceFile(fileName), position); + } + function getNavigationBarItems(fileName) { + fileName = ts.normalizeSlashes(fileName); + return ts.NavigationBar.getNavigationBarItems(getCurrentSourceFile(fileName)); + } + function getSemanticClassifications(fileName, span) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); + var result = []; + processNode(sourceFile); + return result; + function classifySymbol(symbol, meaningAtPosition) { + var flags = symbol.getFlags(); + if (flags & 32) { + return ClassificationTypeNames.className; + } + else if (flags & 384) { + return ClassificationTypeNames.enumName; + } + else if (flags & 524288) { + return ClassificationTypeNames.typeAlias; + } + else if (meaningAtPosition & 2) { + if (flags & 64) { + return ClassificationTypeNames.interfaceName; + } + else if (flags & 262144) { + return ClassificationTypeNames.typeParameterName; + } + } + else if (flags & 1536) { + if (meaningAtPosition & 4 || + (meaningAtPosition & 1 && hasValueSideModule(symbol))) { + return ClassificationTypeNames.moduleName; + } + } + return undefined; + function hasValueSideModule(symbol) { + return ts.forEach(symbol.declarations, function (declaration) { + return declaration.kind === 198 && ts.getModuleInstanceState(declaration) == 1; + }); + } + } + function processNode(node) { + if (node && ts.textSpanIntersectsWith(span, node.getStart(), node.getWidth())) { + if (node.kind === 64 && node.getWidth() > 0) { + var symbol = typeInfoResolver.getSymbolAtLocation(node); + if (symbol) { + var type = classifySymbol(symbol, getMeaningFromLocation(node)); + if (type) { + result.push({ + textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), + classificationType: type + }); + } + } + } + ts.forEachChild(node, processNode); + } + } + } + function getSyntacticClassifications(fileName, span) { + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getCurrentSourceFile(fileName); + var triviaScanner = ts.createScanner(2, false, sourceFile.text); + var mergeConflictScanner = ts.createScanner(2, false, sourceFile.text); + var result = []; + processElement(sourceFile); + return result; + function classifyLeadingTrivia(token) { + var tokenStart = ts.skipTrivia(sourceFile.text, token.pos, false); + if (tokenStart === token.pos) { + return; + } + triviaScanner.setTextPos(token.pos); + while (true) { + var start = triviaScanner.getTextPos(); + var kind = triviaScanner.scan(); + var end = triviaScanner.getTextPos(); + var width = end - start; + if (ts.textSpanIntersectsWith(span, start, width)) { + if (!ts.isTrivia(kind)) { + return; + } + if (ts.isComment(kind)) { + result.push({ + textSpan: ts.createTextSpan(start, width), + classificationType: ClassificationTypeNames.comment + }); + continue; + } + if (kind === 6) { + var text = sourceFile.text; + var ch = text.charCodeAt(start); + if (ch === 60 || ch === 62) { + result.push({ + textSpan: ts.createTextSpan(start, width), + classificationType: ClassificationTypeNames.comment + }); + continue; + } + ts.Debug.assert(ch === 61); + classifyDisabledMergeCode(text, start, end); + } + } + } + } + function classifyDisabledMergeCode(text, start, end) { + for (var i = start; i < end; i++) { + if (ts.isLineBreak(text.charCodeAt(i))) { + break; + } + } + result.push({ + textSpan: ts.createTextSpanFromBounds(start, i), + classificationType: ClassificationTypeNames.comment + }); + mergeConflictScanner.setTextPos(i); + while (mergeConflictScanner.getTextPos() < end) { + classifyDisabledCodeToken(); + } + } + function classifyDisabledCodeToken() { + var start = mergeConflictScanner.getTextPos(); + var tokenKind = mergeConflictScanner.scan(); + var end = mergeConflictScanner.getTextPos(); + var type = classifyTokenType(tokenKind); + if (type) { + result.push({ + textSpan: ts.createTextSpanFromBounds(start, end), + classificationType: type + }); + } + } + function classifyToken(token) { + classifyLeadingTrivia(token); + if (token.getWidth() > 0) { + var type = classifyTokenType(token.kind, token); + if (type) { + result.push({ + textSpan: ts.createTextSpan(token.getStart(), token.getWidth()), + classificationType: type + }); + } + } + } + function classifyTokenType(tokenKind, token) { + if (ts.isKeyword(tokenKind)) { + return ClassificationTypeNames.keyword; + } + if (tokenKind === 24 || tokenKind === 25) { + if (token && ts.getTypeArgumentOrTypeParameterList(token.parent)) { + return ClassificationTypeNames.punctuation; + } + } + if (ts.isPunctuation(tokenKind)) { + if (token) { + if (tokenKind === 52) { + if (token.parent.kind === 191 || + token.parent.kind === 128 || + token.parent.kind === 126) { + return ClassificationTypeNames.operator; + } + } + if (token.parent.kind === 165 || + token.parent.kind === 163 || + token.parent.kind === 164 || + token.parent.kind === 166) { + return ClassificationTypeNames.operator; + } + } + return ClassificationTypeNames.punctuation; + } + else if (tokenKind === 7) { + return ClassificationTypeNames.numericLiteral; + } + else if (tokenKind === 8) { + return ClassificationTypeNames.stringLiteral; + } + else if (tokenKind === 9) { + return ClassificationTypeNames.stringLiteral; + } + else if (ts.isTemplateLiteralKind(tokenKind)) { + return ClassificationTypeNames.stringLiteral; + } + else if (tokenKind === 64) { + if (token) { + switch (token.parent.kind) { + case 194: + if (token.parent.name === token) { + return ClassificationTypeNames.className; + } + return; + case 125: + if (token.parent.name === token) { + return ClassificationTypeNames.typeParameterName; + } + return; + case 195: + if (token.parent.name === token) { + return ClassificationTypeNames.interfaceName; + } + return; + case 197: + if (token.parent.name === token) { + return ClassificationTypeNames.enumName; + } + return; + case 198: + if (token.parent.name === token) { + return ClassificationTypeNames.moduleName; + } + return; + } + } + return ClassificationTypeNames.text; + } + } + function processElement(element) { + if (ts.textSpanIntersectsWith(span, element.getFullStart(), element.getFullWidth())) { + var children = element.getChildren(); + for (var i = 0, n = children.length; i < n; i++) { + var child = children[i]; + if (ts.isToken(child)) { + classifyToken(child); + } + else { + processElement(child); + } + } + } + } + } + function getOutliningSpans(fileName) { + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getCurrentSourceFile(fileName); + return ts.OutliningElementsCollector.collectElements(sourceFile); + } + function getBraceMatchingAtPosition(fileName, position) { + var sourceFile = getCurrentSourceFile(fileName); + var result = []; + var token = ts.getTouchingToken(sourceFile, position); + if (token.getStart(sourceFile) === position) { + var matchKind = getMatchingTokenKind(token); + if (matchKind) { + var parentElement = token.parent; + var childNodes = parentElement.getChildren(sourceFile); + for (var i = 0, n = childNodes.length; i < n; i++) { + var current = childNodes[i]; + if (current.kind === matchKind) { + var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); + var range2 = ts.createTextSpan(current.getStart(sourceFile), current.getWidth(sourceFile)); + if (range1.start < range2.start) { + result.push(range1, range2); + } + else { + result.push(range2, range1); + } + break; + } + } + } + } + return result; + function getMatchingTokenKind(token) { + switch (token.kind) { + case 14: return 15; + case 16: return 17; + case 18: return 19; + case 24: return 25; + case 15: return 14; + case 17: return 16; + case 19: return 18; + case 25: return 24; + } + return undefined; + } + } + function getIndentationAtPosition(fileName, position, editorOptions) { + fileName = ts.normalizeSlashes(fileName); + var start = new Date().getTime(); + var sourceFile = getCurrentSourceFile(fileName); + log("getIndentationAtPosition: getCurrentSourceFile: " + (new Date().getTime() - start)); + var start = new Date().getTime(); + var result = ts.formatting.SmartIndenter.getIndentation(position, sourceFile, editorOptions); + log("getIndentationAtPosition: computeIndentation : " + (new Date().getTime() - start)); + return result; + } + function getFormattingEditsForRange(fileName, start, end, options) { + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getCurrentSourceFile(fileName); + return ts.formatting.formatSelection(start, end, sourceFile, getRuleProvider(options), options); + } + function getFormattingEditsForDocument(fileName, options) { + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getCurrentSourceFile(fileName); + return ts.formatting.formatDocument(sourceFile, getRuleProvider(options), options); + } + function getFormattingEditsAfterKeystroke(fileName, position, key, options) { + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getCurrentSourceFile(fileName); + if (key === "}") { + return ts.formatting.formatOnClosingCurly(position, sourceFile, getRuleProvider(options), options); + } + else if (key === ";") { + return ts.formatting.formatOnSemicolon(position, sourceFile, getRuleProvider(options), options); + } + else if (key === "\n") { + return ts.formatting.formatOnEnter(position, sourceFile, getRuleProvider(options), options); + } + return []; + } + function getTodoComments(fileName, descriptors) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); + cancellationToken.throwIfCancellationRequested(); + var fileContents = sourceFile.text; + var result = []; + if (descriptors.length > 0) { + var regExp = getTodoCommentsRegExp(); + var matchArray; + while (matchArray = regExp.exec(fileContents)) { + cancellationToken.throwIfCancellationRequested(); + var firstDescriptorCaptureIndex = 3; + ts.Debug.assert(matchArray.length === descriptors.length + firstDescriptorCaptureIndex); + var preamble = matchArray[1]; + var matchPosition = matchArray.index + preamble.length; + var token = ts.getTokenAtPosition(sourceFile, matchPosition); + if (!isInsideComment(sourceFile, token, matchPosition)) { + continue; + } + var descriptor = undefined; + for (var i = 0, n = descriptors.length; i < n; i++) { + if (matchArray[i + firstDescriptorCaptureIndex]) { + descriptor = descriptors[i]; + } + } + ts.Debug.assert(descriptor !== undefined); + if (isLetterOrDigit(fileContents.charCodeAt(matchPosition + descriptor.text.length))) { + continue; + } + var message = matchArray[2]; + result.push({ + descriptor: descriptor, + message: message, + position: matchPosition + }); + } + } + return result; + function escapeRegExp(str) { + return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); + } + function getTodoCommentsRegExp() { + var singleLineCommentStart = /(?:\/\/+\s*)/.source; + var multiLineCommentStart = /(?:\/\*+\s*)/.source; + var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; + var preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; + var literals = "(?:" + ts.map(descriptors, function (d) { return "(" + escapeRegExp(d.text) + ")"; }).join("|") + ")"; + var endOfLineOrEndOfComment = /(?:$|\*\/)/.source; + var messageRemainder = /(?:.*?)/.source; + var messagePortion = "(" + literals + messageRemainder + ")"; + var regExpString = preamble + messagePortion + endOfLineOrEndOfComment; + return new RegExp(regExpString, "gim"); + } + function isLetterOrDigit(char) { + return (char >= 97 && char <= 122) || + (char >= 65 && char <= 90) || + (char >= 48 && char <= 57); + } + } + function getRenameInfo(fileName, position) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); + var node = ts.getTouchingWord(sourceFile, position); + if (node && node.kind === 64) { + var symbol = typeInfoResolver.getSymbolAtLocation(node); + if (symbol) { + var declarations = symbol.getDeclarations(); + if (declarations && declarations.length > 0) { + var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); + if (defaultLibFileName) { + for (var i = 0; i < declarations.length; i++) { + var sourceFile = declarations[i].getSourceFile(); + if (sourceFile && getCanonicalFileName(ts.normalizePath(sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { + return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key)); + } + } + } + var kind = getSymbolKind(symbol, typeInfoResolver, node); + if (kind) { + return { + canRename: true, + localizedErrorMessage: undefined, + displayName: symbol.name, + fullDisplayName: typeInfoResolver.getFullyQualifiedName(symbol), + kind: kind, + kindModifiers: getSymbolModifiers(symbol), + triggerSpan: ts.createTextSpan(node.getStart(), node.getWidth()) + }; + } + } + } + } + return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element.key)); + function getRenameInfoError(localizedErrorMessage) { + return { + canRename: false, + localizedErrorMessage: localizedErrorMessage, + displayName: undefined, + fullDisplayName: undefined, + kind: undefined, + kindModifiers: undefined, + triggerSpan: undefined + }; + } + } + return { + dispose: dispose, + cleanupSemanticCache: cleanupSemanticCache, + getSyntacticDiagnostics: getSyntacticDiagnostics, + getSemanticDiagnostics: getSemanticDiagnostics, + getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics, + getSyntacticClassifications: getSyntacticClassifications, + getSemanticClassifications: getSemanticClassifications, + getCompletionsAtPosition: getCompletionsAtPosition, + getCompletionEntryDetails: getCompletionEntryDetails, + getSignatureHelpItems: getSignatureHelpItems, + getQuickInfoAtPosition: getQuickInfoAtPosition, + getDefinitionAtPosition: getDefinitionAtPosition, + getReferencesAtPosition: getReferencesAtPosition, + getOccurrencesAtPosition: getOccurrencesAtPosition, + getNameOrDottedNameSpan: getNameOrDottedNameSpan, + getBreakpointStatementAtPosition: getBreakpointStatementAtPosition, + getNavigateToItems: getNavigateToItems, + getRenameInfo: getRenameInfo, + findRenameLocations: findRenameLocations, + getNavigationBarItems: getNavigationBarItems, + getOutliningSpans: getOutliningSpans, + getTodoComments: getTodoComments, + getBraceMatchingAtPosition: getBraceMatchingAtPosition, + getIndentationAtPosition: getIndentationAtPosition, + getFormattingEditsForRange: getFormattingEditsForRange, + getFormattingEditsForDocument: getFormattingEditsForDocument, + getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke, + getEmitOutput: getEmitOutput, + getSourceFile: getCurrentSourceFile, + getProgram: getProgram + }; + } + ts.createLanguageService = createLanguageService; + function createClassifier() { + var scanner = ts.createScanner(2, false); + var noRegexTable = []; + noRegexTable[64] = true; + noRegexTable[8] = true; + noRegexTable[7] = true; + noRegexTable[9] = true; + noRegexTable[92] = true; + noRegexTable[38] = true; + noRegexTable[39] = true; + noRegexTable[17] = true; + noRegexTable[19] = true; + noRegexTable[15] = true; + noRegexTable[94] = true; + noRegexTable[79] = true; + var templateStack = []; + function isAccessibilityModifier(kind) { + switch (kind) { + case 107: + case 105: + case 106: + return true; + } + return false; + } + function canFollow(keyword1, keyword2) { + if (isAccessibilityModifier(keyword1)) { + if (keyword2 === 114 || + keyword2 === 118 || + keyword2 === 112 || + keyword2 === 108) { + return true; + } + return false; + } + return true; + } + function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) { + var offset = 0; + var token = 0; + var lastNonTriviaToken = 0; + while (templateStack.length > 0) { + templateStack.pop(); + } + switch (lexState) { + case 3: + text = '"\\\n' + text; + offset = 3; + break; + case 2: + text = "'\\\n" + text; + offset = 3; + break; + case 1: + text = "/*\n" + text; + offset = 3; + break; + case 4: + text = "`\n" + text; + offset = 2; + break; + case 5: + text = "}\n" + text; + offset = 2; + case 6: + templateStack.push(11); + break; + } + scanner.setText(text); + var result = { + finalLexState: 0, + entries: [] + }; + var angleBracketStack = 0; + do { + token = scanner.scan(); + if (!ts.isTrivia(token)) { + if ((token === 36 || token === 56) && !noRegexTable[lastNonTriviaToken]) { + if (scanner.reScanSlashToken() === 9) { + token = 9; + } + } + else if (lastNonTriviaToken === 20 && isKeyword(token)) { + token = 64; + } + else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { + token = 64; + } + else if (lastNonTriviaToken === 64 && + token === 24) { + angleBracketStack++; + } + else if (token === 25 && angleBracketStack > 0) { + angleBracketStack--; + } + else if (token === 110 || + token === 119 || + token === 117 || + token === 111 || + token === 120) { + if (angleBracketStack > 0 && !syntacticClassifierAbsent) { + token = 64; + } + } + else if (token === 11) { + templateStack.push(token); + } + else if (token === 14) { + if (templateStack.length > 0) { + templateStack.push(token); + } + } + else if (token === 15) { + if (templateStack.length > 0) { + var lastTemplateStackToken = ts.lastOrUndefined(templateStack); + if (lastTemplateStackToken === 11) { + token = scanner.reScanTemplateToken(); + if (token === 13) { + templateStack.pop(); + } + else { + ts.Debug.assert(token === 12, "Should have been a template middle. Was " + token); + } + } + else { + ts.Debug.assert(lastTemplateStackToken === 14, "Should have been an open brace. Was: " + token); + templateStack.pop(); + } + } + } + lastNonTriviaToken = token; + } + processToken(); + } while (token !== 1); + return result; + function processToken() { + var start = scanner.getTokenPos(); + var end = scanner.getTextPos(); + addResult(end - start, classFromKind(token)); + if (end >= text.length) { + if (token === 8) { + var tokenText = scanner.getTokenText(); + if (scanner.isUnterminated()) { + var lastCharIndex = tokenText.length - 1; + var numBackslashes = 0; + while (tokenText.charCodeAt(lastCharIndex - numBackslashes) === 92) { + numBackslashes++; + } + if (numBackslashes & 1) { + var quoteChar = tokenText.charCodeAt(0); + result.finalLexState = quoteChar === 34 ? 3 : 2; + } + } + } + else if (token === 3) { + if (scanner.isUnterminated()) { + result.finalLexState = 1; + } + } + else if (ts.isTemplateLiteralKind(token)) { + if (scanner.isUnterminated()) { + if (token === 13) { + result.finalLexState = 5; + } + else if (token === 10) { + result.finalLexState = 4; + } + else { + ts.Debug.fail("Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #" + token); + } + } + } + else if (templateStack.length > 0 && ts.lastOrUndefined(templateStack) === 11) { + result.finalLexState = 6; + } + } + } + function addResult(length, classification) { + if (length > 0) { + if (result.entries.length === 0) { + length -= offset; + } + result.entries.push({ length: length, classification: classification }); + } + } + } + function isBinaryExpressionOperatorToken(token) { + switch (token) { + case 35: + case 36: + case 37: + case 33: + case 34: + case 40: + case 41: + case 42: + case 24: + case 25: + case 26: + case 27: + case 86: + case 85: + case 28: + case 29: + case 30: + case 31: + case 43: + case 45: + case 44: + case 48: + case 49: + case 62: + case 61: + case 63: + case 58: + case 59: + case 60: + case 53: + case 54: + case 55: + case 56: + case 57: + case 52: + case 23: + return true; + default: + return false; + } + } + function isPrefixUnaryExpressionOperatorToken(token) { + switch (token) { + case 33: + case 34: + case 47: + case 46: + case 38: + case 39: + return true; + default: + return false; + } + } + function isKeyword(token) { + return token >= 65 && token <= 122; + } + function classFromKind(token) { + if (isKeyword(token)) { + return 1; + } + else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) { + return 2; + } + else if (token >= 14 && token <= 63) { + return 0; + } + switch (token) { + case 7: + return 6; + case 8: + return 7; + case 9: + return 8; + case 6: + case 3: + case 2: + return 3; + case 5: + case 4: + return 4; + case 64: + default: + if (ts.isTemplateLiteralKind(token)) { + return 7; + } + return 5; + } + } + return { getClassificationsForLine: getClassificationsForLine }; + } + ts.createClassifier = createClassifier; + function getDefaultLibFilePath(options) { + if (typeof __dirname !== "undefined") { + return __dirname + ts.directorySeparator + ts.getDefaultLibFileName(options); + } + throw new Error("getDefaultLibFilePath is only supported when consumed as a node module. "); + } + ts.getDefaultLibFilePath = getDefaultLibFilePath; + function initializeServices() { + ts.objectAllocator = { + getNodeConstructor: function (kind) { + function Node() { + } + var proto = kind === 210 ? new SourceFileObject() : new NodeObject(); + proto.kind = kind; + proto.pos = 0; + proto.end = 0; + proto.flags = 0; + proto.parent = undefined; + Node.prototype = proto; + return Node; + }, + getSymbolConstructor: function () { return SymbolObject; }, + getTypeConstructor: function () { return TypeObject; }, + getSignatureConstructor: function () { return SignatureObject; } + }; + } + initializeServices(); +})(ts || (ts = {})); +var ts; +(function (ts) { + var BreakpointResolver; + (function (BreakpointResolver) { + function spanInSourceFileAtLocation(sourceFile, position) { + if (sourceFile.flags & 1024) { + return undefined; + } + var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position); + var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line; + if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart()).line > lineOfPosition) { + tokenAtLocation = ts.findPrecedingToken(tokenAtLocation.pos, sourceFile); + if (!tokenAtLocation || sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { + return undefined; + } + } + if (ts.isInAmbientContext(tokenAtLocation)) { + return undefined; + } + return spanInNode(tokenAtLocation); + function textSpan(startNode, endNode) { + return ts.createTextSpanFromBounds(startNode.getStart(), (endNode || startNode).getEnd()); + } + function spanInNodeIfStartsOnSameLine(node, otherwiseOnNode) { + if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart()).line) { + return spanInNode(node); + } + return spanInNode(otherwiseOnNode); + } + function spanInPreviousNode(node) { + return spanInNode(ts.findPrecedingToken(node.pos, sourceFile)); + } + function spanInNextNode(node) { + return spanInNode(ts.findNextToken(node, node.parent)); + } + function spanInNode(node) { + if (node) { + if (ts.isExpression(node)) { + if (node.parent.kind === 177) { + return spanInPreviousNode(node); + } + if (node.parent.kind === 179) { + return textSpan(node); + } + if (node.parent.kind === 165 && node.parent.operatorToken.kind === 23) { + return textSpan(node); + } + if (node.parent.kind == 159 && node.parent.body == node) { + return textSpan(node); + } + } + switch (node.kind) { + case 173: + return spanInVariableDeclaration(node.declarationList.declarations[0]); + case 191: + case 128: + case 127: + return spanInVariableDeclaration(node); + case 126: + return spanInParameterDeclaration(node); + case 193: + case 130: + case 129: + case 132: + case 133: + case 131: + case 158: + case 159: + return spanInFunctionDeclaration(node); + case 172: + if (ts.isFunctionBlock(node)) { + return spanInFunctionBlock(node); + } + case 199: + return spanInBlock(node); + case 206: + return spanInBlock(node.block); + case 175: + return textSpan(node.expression); + case 184: + return textSpan(node.getChildAt(0), node.expression); + case 178: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 177: + return spanInNode(node.statement); + case 190: + return textSpan(node.getChildAt(0)); + case 176: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 187: + return spanInNode(node.statement); + case 183: + case 182: + return textSpan(node.getChildAt(0), node.label); + case 179: + return spanInForStatement(node); + case 180: + case 181: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 186: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 203: + case 204: + return spanInNode(node.statements[0]); + case 189: + return spanInBlock(node.tryBlock); + case 188: + return textSpan(node, node.expression); + case 201: + return textSpan(node, node.exportName); + case 200: + return textSpan(node, node.moduleReference); + case 198: + if (ts.getModuleInstanceState(node) !== 1) { + return undefined; + } + case 194: + case 197: + case 209: + case 153: + case 154: + return textSpan(node); + case 185: + return spanInNode(node.statement); + case 195: + case 196: + return undefined; + case 22: + case 1: + return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile)); + case 23: + return spanInPreviousNode(node); + case 14: + return spanInOpenBraceToken(node); + case 15: + return spanInCloseBraceToken(node); + case 16: + return spanInOpenParenToken(node); + case 17: + return spanInCloseParenToken(node); + case 51: + return spanInColonToken(node); + case 25: + case 24: + return spanInGreaterThanOrLessThanToken(node); + case 99: + return spanInWhileKeyword(node); + case 75: + case 67: + case 80: + return spanInNextNode(node); + default: + if (node.parent.kind === 207 && node.parent.name === node) { + return spanInNode(node.parent.initializer); + } + if (node.parent.kind === 156 && node.parent.type === node) { + return spanInNode(node.parent.expression); + } + if (ts.isAnyFunction(node.parent) && node.parent.type === node) { + return spanInPreviousNode(node); + } + return spanInNode(node.parent); + } + } + function spanInVariableDeclaration(variableDeclaration) { + if (variableDeclaration.parent.parent.kind === 180 || + variableDeclaration.parent.parent.kind === 181) { + return spanInNode(variableDeclaration.parent.parent); + } + var isParentVariableStatement = variableDeclaration.parent.parent.kind === 173; + var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 179 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); + var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement ? variableDeclaration.parent.parent.initializer.declarations : undefined; + if (variableDeclaration.initializer || (variableDeclaration.flags & 1)) { + if (declarations && declarations[0] === variableDeclaration) { + if (isParentVariableStatement) { + return textSpan(variableDeclaration.parent, variableDeclaration); + } + else { + ts.Debug.assert(isDeclarationOfForStatement); + return textSpan(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration); + } + } + else { + return textSpan(variableDeclaration); + } + } + else if (declarations && declarations[0] !== variableDeclaration) { + var indexOfCurrentDeclaration = ts.indexOf(declarations, variableDeclaration); + return spanInVariableDeclaration(declarations[indexOfCurrentDeclaration - 1]); + } + } + function canHaveSpanInParameterDeclaration(parameter) { + return !!parameter.initializer || parameter.dotDotDotToken !== undefined || + !!(parameter.flags & 16) || !!(parameter.flags & 32); + } + function spanInParameterDeclaration(parameter) { + if (canHaveSpanInParameterDeclaration(parameter)) { + return textSpan(parameter); + } + else { + var functionDeclaration = parameter.parent; + var indexOfParameter = ts.indexOf(functionDeclaration.parameters, parameter); + if (indexOfParameter) { + return spanInParameterDeclaration(functionDeclaration.parameters[indexOfParameter - 1]); + } + else { + return spanInNode(functionDeclaration.body); + } + } + } + function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { + return !!(functionDeclaration.flags & 1) || + (functionDeclaration.parent.kind === 194 && functionDeclaration.kind !== 131); + } + function spanInFunctionDeclaration(functionDeclaration) { + if (!functionDeclaration.body) { + return undefined; + } + if (canFunctionHaveSpanInWholeDeclaration(functionDeclaration)) { + return textSpan(functionDeclaration); + } + return spanInNode(functionDeclaration.body); + } + function spanInFunctionBlock(block) { + var nodeForSpanInBlock = block.statements.length ? block.statements[0] : block.getLastToken(); + if (canFunctionHaveSpanInWholeDeclaration(block.parent)) { + return spanInNodeIfStartsOnSameLine(block.parent, nodeForSpanInBlock); + } + return spanInNode(nodeForSpanInBlock); + } + function spanInBlock(block) { + switch (block.parent.kind) { + case 198: + if (ts.getModuleInstanceState(block.parent) !== 1) { + return undefined; + } + case 178: + case 176: + case 180: + case 181: + return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); + case 179: + 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 === 192) { + var variableDeclarationList = forStatement.initializer; + if (variableDeclarationList.declarations.length > 0) { + return spanInNode(variableDeclarationList.declarations[0]); + } + } + else { + return spanInNode(forStatement.initializer); + } + } + if (forStatement.condition) { + return textSpan(forStatement.condition); + } + if (forStatement.iterator) { + return textSpan(forStatement.iterator); + } + } + function spanInOpenBraceToken(node) { + switch (node.parent.kind) { + case 197: + var enumDeclaration = node.parent; + return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); + case 194: + var classDeclaration = node.parent; + return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); + case 186: + return spanInNodeIfStartsOnSameLine(node.parent, node.parent.clauses[0]); + } + return spanInNode(node.parent); + } + function spanInCloseBraceToken(node) { + switch (node.parent.kind) { + case 199: + if (ts.getModuleInstanceState(node.parent.parent) !== 1) { + return undefined; + } + case 197: + case 194: + return textSpan(node); + case 172: + if (ts.isFunctionBlock(node.parent)) { + return textSpan(node); + } + case 206: + return spanInNode(node.parent.statements[node.parent.statements.length - 1]); + ; + case 186: + var switchStatement = node.parent; + var lastClause = switchStatement.clauses[switchStatement.clauses.length - 1]; + if (lastClause) { + return spanInNode(lastClause.statements[lastClause.statements.length - 1]); + } + return undefined; + default: + return spanInNode(node.parent); + } + } + function spanInOpenParenToken(node) { + if (node.parent.kind === 177) { + return spanInPreviousNode(node); + } + return spanInNode(node.parent); + } + function spanInCloseParenToken(node) { + switch (node.parent.kind) { + case 158: + case 193: + case 159: + case 130: + case 129: + case 132: + case 133: + case 131: + case 178: + case 177: + case 179: + return spanInPreviousNode(node); + default: + return spanInNode(node.parent); + } + return spanInNode(node.parent); + } + function spanInColonToken(node) { + if (ts.isAnyFunction(node.parent) || node.parent.kind === 207) { + return spanInPreviousNode(node); + } + return spanInNode(node.parent); + } + function spanInGreaterThanOrLessThanToken(node) { + if (node.parent.kind === 156) { + return spanInNode(node.parent.expression); + } + return spanInNode(node.parent); + } + function spanInWhileKeyword(node) { + if (node.parent.kind === 177) { + return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); + } + return spanInNode(node.parent); + } + } + } + BreakpointResolver.spanInSourceFileAtLocation = spanInSourceFileAtLocation; + })(BreakpointResolver = ts.BreakpointResolver || (ts.BreakpointResolver = {})); +})(ts || (ts = {})); +var debugObjectHost = this; +var ts; +(function (ts) { + function logInternalError(logger, err) { + logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message); + } + var ScriptSnapshotShimAdapter = (function () { + function ScriptSnapshotShimAdapter(scriptSnapshotShim) { + this.scriptSnapshotShim = scriptSnapshotShim; + this.lineStartPositions = null; + } + ScriptSnapshotShimAdapter.prototype.getText = function (start, end) { + return this.scriptSnapshotShim.getText(start, end); + }; + ScriptSnapshotShimAdapter.prototype.getLength = function () { + return this.scriptSnapshotShim.getLength(); + }; + ScriptSnapshotShimAdapter.prototype.getChangeRange = function (oldSnapshot) { + var oldSnapshotShim = oldSnapshot; + var encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim); + if (encoded == null) { + return null; + } + var decoded = JSON.parse(encoded); + return ts.createTextChangeRange(ts.createTextSpan(decoded.span.start, decoded.span.length), decoded.newLength); + }; + return ScriptSnapshotShimAdapter; + })(); + var LanguageServiceShimHostAdapter = (function () { + function LanguageServiceShimHostAdapter(shimHost) { + this.shimHost = shimHost; + } + LanguageServiceShimHostAdapter.prototype.log = function (s) { + this.shimHost.log(s); + }; + LanguageServiceShimHostAdapter.prototype.trace = function (s) { + this.shimHost.trace(s); + }; + LanguageServiceShimHostAdapter.prototype.error = function (s) { + this.shimHost.error(s); + }; + LanguageServiceShimHostAdapter.prototype.getCompilationSettings = function () { + var settingsJson = this.shimHost.getCompilationSettings(); + if (settingsJson == null || settingsJson == "") { + throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings"); + return null; + } + return JSON.parse(settingsJson); + }; + LanguageServiceShimHostAdapter.prototype.getScriptFileNames = function () { + var encoded = this.shimHost.getScriptFileNames(); + return this.files = JSON.parse(encoded); + }; + LanguageServiceShimHostAdapter.prototype.getScriptSnapshot = function (fileName) { + if (this.files && this.files.indexOf(fileName) < 0) { + return undefined; + } + var scriptSnapshot = this.shimHost.getScriptSnapshot(fileName); + return scriptSnapshot && new ScriptSnapshotShimAdapter(scriptSnapshot); + }; + LanguageServiceShimHostAdapter.prototype.getScriptVersion = function (fileName) { + return this.shimHost.getScriptVersion(fileName); + }; + LanguageServiceShimHostAdapter.prototype.getLocalizedDiagnosticMessages = function () { + var diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages(); + if (diagnosticMessagesJson == null || diagnosticMessagesJson == "") { + return null; + } + try { + return JSON.parse(diagnosticMessagesJson); + } + catch (e) { + this.log(e.description || "diagnosticMessages.generated.json has invalid JSON format"); + return null; + } + }; + LanguageServiceShimHostAdapter.prototype.getCancellationToken = function () { + return this.shimHost.getCancellationToken(); + }; + LanguageServiceShimHostAdapter.prototype.getCurrentDirectory = function () { + return this.shimHost.getCurrentDirectory(); + }; + LanguageServiceShimHostAdapter.prototype.getDefaultLibFileName = function (options) { + return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); + }; + return LanguageServiceShimHostAdapter; + })(); + ts.LanguageServiceShimHostAdapter = LanguageServiceShimHostAdapter; + function simpleForwardCall(logger, actionDescription, action) { + logger.log(actionDescription); + var start = Date.now(); + var result = action(); + var end = Date.now(); + logger.log(actionDescription + " completed in " + (end - start) + " msec"); + if (typeof (result) === "string") { + var str = result; + if (str.length > 128) { + str = str.substring(0, 128) + "..."; + } + logger.log(" result.length=" + str.length + ", result='" + JSON.stringify(str) + "'"); + } + return result; + } + function forwardJSONCall(logger, actionDescription, action) { + try { + var result = simpleForwardCall(logger, actionDescription, action); + return JSON.stringify({ result: result }); + } + catch (err) { + if (err instanceof ts.OperationCanceledException) { + return JSON.stringify({ canceled: true }); + } + logInternalError(logger, err); + err.description = actionDescription; + return JSON.stringify({ error: err }); + } + } + var ShimBase = (function () { + function ShimBase(factory) { + this.factory = factory; + factory.registerShim(this); + } + ShimBase.prototype.dispose = function (dummy) { + this.factory.unregisterShim(this); + }; + return ShimBase; + })(); + var LanguageServiceShimObject = (function (_super) { + __extends(LanguageServiceShimObject, _super); + function LanguageServiceShimObject(factory, host, languageService) { + _super.call(this, factory); + this.host = host; + this.languageService = languageService; + this.logger = this.host; + } + LanguageServiceShimObject.prototype.forwardJSONCall = function (actionDescription, action) { + return forwardJSONCall(this.logger, actionDescription, action); + }; + LanguageServiceShimObject.prototype.dispose = function (dummy) { + this.logger.log("dispose()"); + this.languageService.dispose(); + this.languageService = null; + if (debugObjectHost && debugObjectHost.CollectGarbage) { + debugObjectHost.CollectGarbage(); + this.logger.log("CollectGarbage()"); + } + this.logger = null; + _super.prototype.dispose.call(this, dummy); + }; + LanguageServiceShimObject.prototype.refresh = function (throwOnError) { + this.forwardJSONCall("refresh(" + throwOnError + ")", function () { + return null; + }); + }; + LanguageServiceShimObject.prototype.cleanupSemanticCache = function () { + var _this = this; + this.forwardJSONCall("cleanupSemanticCache()", function () { + _this.languageService.cleanupSemanticCache(); + return null; + }); + }; + LanguageServiceShimObject.prototype.realizeDiagnostics = function (diagnostics) { + var _this = this; + var newLine = this.getNewLine(); + return diagnostics.map(function (d) { return _this.realizeDiagnostic(d, newLine); }); + }; + LanguageServiceShimObject.prototype.realizeDiagnostic = function (diagnostic, newLine) { + return { + message: ts.flattenDiagnosticMessageText(diagnostic.messageText, newLine), + start: diagnostic.start, + length: diagnostic.length, + category: ts.DiagnosticCategory[diagnostic.category].toLowerCase(), + code: diagnostic.code + }; + }; + LanguageServiceShimObject.prototype.getSyntacticClassifications = function (fileName, start, length) { + var _this = this; + return this.forwardJSONCall("getSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { + var classifications = _this.languageService.getSyntacticClassifications(fileName, ts.createTextSpan(start, length)); + return classifications; + }); + }; + LanguageServiceShimObject.prototype.getSemanticClassifications = function (fileName, start, length) { + var _this = this; + return this.forwardJSONCall("getSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { + var classifications = _this.languageService.getSemanticClassifications(fileName, ts.createTextSpan(start, length)); + return classifications; + }); + }; + LanguageServiceShimObject.prototype.getNewLine = function () { + return this.host.getNewLine ? this.host.getNewLine() : "\r\n"; + }; + LanguageServiceShimObject.prototype.getSyntacticDiagnostics = function (fileName) { + var _this = this; + return this.forwardJSONCall("getSyntacticDiagnostics('" + fileName + "')", function () { + var diagnostics = _this.languageService.getSyntacticDiagnostics(fileName); + return _this.realizeDiagnostics(diagnostics); + }); + }; + LanguageServiceShimObject.prototype.getSemanticDiagnostics = function (fileName) { + var _this = this; + return this.forwardJSONCall("getSemanticDiagnostics('" + fileName + "')", function () { + var diagnostics = _this.languageService.getSemanticDiagnostics(fileName); + return _this.realizeDiagnostics(diagnostics); + }); + }; + LanguageServiceShimObject.prototype.getCompilerOptionsDiagnostics = function () { + var _this = this; + return this.forwardJSONCall("getCompilerOptionsDiagnostics()", function () { + var diagnostics = _this.languageService.getCompilerOptionsDiagnostics(); + return _this.realizeDiagnostics(diagnostics); + }); + }; + LanguageServiceShimObject.prototype.getQuickInfoAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getQuickInfoAtPosition('" + fileName + "', " + position + ")", function () { + var quickInfo = _this.languageService.getQuickInfoAtPosition(fileName, position); + return quickInfo; + }); + }; + LanguageServiceShimObject.prototype.getNameOrDottedNameSpan = function (fileName, startPos, endPos) { + var _this = this; + return this.forwardJSONCall("getNameOrDottedNameSpan('" + fileName + "', " + startPos + ", " + endPos + ")", function () { + var spanInfo = _this.languageService.getNameOrDottedNameSpan(fileName, startPos, endPos); + return spanInfo; + }); + }; + LanguageServiceShimObject.prototype.getBreakpointStatementAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getBreakpointStatementAtPosition('" + fileName + "', " + position + ")", function () { + var spanInfo = _this.languageService.getBreakpointStatementAtPosition(fileName, position); + return spanInfo; + }); + }; + LanguageServiceShimObject.prototype.getSignatureHelpItems = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getSignatureHelpItems('" + fileName + "', " + position + ")", function () { + var signatureInfo = _this.languageService.getSignatureHelpItems(fileName, position); + return signatureInfo; + }); + }; + LanguageServiceShimObject.prototype.getDefinitionAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getDefinitionAtPosition('" + fileName + "', " + position + ")", function () { + return _this.languageService.getDefinitionAtPosition(fileName, position); + }); + }; + LanguageServiceShimObject.prototype.getRenameInfo = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () { + return _this.languageService.getRenameInfo(fileName, position); + }); + }; + LanguageServiceShimObject.prototype.findRenameLocations = function (fileName, position, findInStrings, findInComments) { + var _this = this; + return this.forwardJSONCall("findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ")", function () { + return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments); + }); + }; + LanguageServiceShimObject.prototype.getBraceMatchingAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getBraceMatchingAtPosition('" + fileName + "', " + position + ")", function () { + var textRanges = _this.languageService.getBraceMatchingAtPosition(fileName, position); + return textRanges; + }); + }; + LanguageServiceShimObject.prototype.getIndentationAtPosition = function (fileName, position, options) { + var _this = this; + return this.forwardJSONCall("getIndentationAtPosition('" + fileName + "', " + position + ")", function () { + var localOptions = JSON.parse(options); + return _this.languageService.getIndentationAtPosition(fileName, position, localOptions); + }); + }; + LanguageServiceShimObject.prototype.getReferencesAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getReferencesAtPosition('" + fileName + "', " + position + ")", function () { + return _this.languageService.getReferencesAtPosition(fileName, position); + }); + }; + LanguageServiceShimObject.prototype.getOccurrencesAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getOccurrencesAtPosition('" + fileName + "', " + position + ")", function () { + return _this.languageService.getOccurrencesAtPosition(fileName, position); + }); + }; + LanguageServiceShimObject.prototype.getCompletionsAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getCompletionsAtPosition('" + fileName + "', " + position + ")", function () { + var completion = _this.languageService.getCompletionsAtPosition(fileName, position); + return completion; + }); + }; + LanguageServiceShimObject.prototype.getCompletionEntryDetails = function (fileName, position, entryName) { + var _this = this; + return this.forwardJSONCall("getCompletionEntryDetails('" + fileName + "', " + position + ", " + entryName + ")", function () { + var details = _this.languageService.getCompletionEntryDetails(fileName, position, entryName); + return details; + }); + }; + LanguageServiceShimObject.prototype.getFormattingEditsForRange = function (fileName, start, end, options) { + var _this = this; + return this.forwardJSONCall("getFormattingEditsForRange('" + fileName + "', " + start + ", " + end + ")", function () { + var localOptions = JSON.parse(options); + var edits = _this.languageService.getFormattingEditsForRange(fileName, start, end, localOptions); + return edits; + }); + }; + LanguageServiceShimObject.prototype.getFormattingEditsForDocument = function (fileName, options) { + var _this = this; + return this.forwardJSONCall("getFormattingEditsForDocument('" + fileName + "')", function () { + var localOptions = JSON.parse(options); + var edits = _this.languageService.getFormattingEditsForDocument(fileName, localOptions); + return edits; + }); + }; + LanguageServiceShimObject.prototype.getFormattingEditsAfterKeystroke = function (fileName, position, key, options) { + var _this = this; + return this.forwardJSONCall("getFormattingEditsAfterKeystroke('" + fileName + "', " + position + ", '" + key + "')", function () { + var localOptions = JSON.parse(options); + var edits = _this.languageService.getFormattingEditsAfterKeystroke(fileName, position, key, localOptions); + return edits; + }); + }; + LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue, maxResultCount) { + var _this = this; + return this.forwardJSONCall("getNavigateToItems('" + searchValue + "', " + maxResultCount + ")", function () { + var items = _this.languageService.getNavigateToItems(searchValue, maxResultCount); + return items; + }); + }; + LanguageServiceShimObject.prototype.getNavigationBarItems = function (fileName) { + var _this = this; + return this.forwardJSONCall("getNavigationBarItems('" + fileName + "')", function () { + var items = _this.languageService.getNavigationBarItems(fileName); + return items; + }); + }; + LanguageServiceShimObject.prototype.getOutliningSpans = function (fileName) { + var _this = this; + return this.forwardJSONCall("getOutliningSpans('" + fileName + "')", function () { + var items = _this.languageService.getOutliningSpans(fileName); + return items; + }); + }; + LanguageServiceShimObject.prototype.getTodoComments = function (fileName, descriptors) { + var _this = this; + return this.forwardJSONCall("getTodoComments('" + fileName + "')", function () { + var items = _this.languageService.getTodoComments(fileName, JSON.parse(descriptors)); + return items; + }); + }; + LanguageServiceShimObject.prototype.getEmitOutput = function (fileName) { + var _this = this; + return this.forwardJSONCall("getEmitOutput('" + fileName + "')", function () { + var output = _this.languageService.getEmitOutput(fileName); + output.emitOutputStatus = output.emitSkipped ? 1 : 0; + return output; + }); + }; + return LanguageServiceShimObject; + })(ShimBase); + var ClassifierShimObject = (function (_super) { + __extends(ClassifierShimObject, _super); + function ClassifierShimObject(factory) { + _super.call(this, factory); + this.classifier = ts.createClassifier(); + } + ClassifierShimObject.prototype.getClassificationsForLine = function (text, lexState, classifyKeywordsInGenerics) { + var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics); + var items = classification.entries; + var result = ""; + for (var i = 0; i < items.length; i++) { + result += items[i].length + "\n"; + result += items[i].classification + "\n"; + } + result += classification.finalLexState; + return result; + }; + return ClassifierShimObject; + })(ShimBase); + var CoreServicesShimObject = (function (_super) { + __extends(CoreServicesShimObject, _super); + function CoreServicesShimObject(factory, logger) { + _super.call(this, factory); + this.logger = logger; + } + CoreServicesShimObject.prototype.forwardJSONCall = function (actionDescription, action) { + return forwardJSONCall(this.logger, actionDescription, action); + }; + CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { + return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () { + var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength())); + var convertResult = { + referencedFiles: [], + importedFiles: [], + isLibFile: result.isLibFile + }; + ts.forEach(result.referencedFiles, function (refFile) { + convertResult.referencedFiles.push({ + path: ts.normalizePath(refFile.fileName), + position: refFile.pos, + length: refFile.end - refFile.pos + }); + }); + ts.forEach(result.importedFiles, function (importedFile) { + convertResult.importedFiles.push({ + path: ts.normalizeSlashes(importedFile.fileName), + position: importedFile.pos, + length: importedFile.end - importedFile.pos + }); + }); + return convertResult; + }); + }; + CoreServicesShimObject.prototype.getDefaultCompilationSettings = function () { + return this.forwardJSONCall("getDefaultCompilationSettings()", function () { + return ts.getDefaultCompilerOptions(); + }); + }; + return CoreServicesShimObject; + })(ShimBase); + var TypeScriptServicesFactory = (function () { + function TypeScriptServicesFactory() { + this._shims = []; + this.documentRegistry = ts.createDocumentRegistry(); + } + TypeScriptServicesFactory.prototype.getServicesVersion = function () { + return ts.servicesVersion; + }; + TypeScriptServicesFactory.prototype.createLanguageServiceShim = function (host) { + try { + var hostAdapter = new LanguageServiceShimHostAdapter(host); + var languageService = ts.createLanguageService(hostAdapter, this.documentRegistry); + return new LanguageServiceShimObject(this, host, languageService); + } + catch (err) { + logInternalError(host, err); + throw err; + } + }; + TypeScriptServicesFactory.prototype.createClassifierShim = function (logger) { + try { + return new ClassifierShimObject(this); + } + catch (err) { + logInternalError(logger, err); + throw err; + } + }; + TypeScriptServicesFactory.prototype.createCoreServicesShim = function (logger) { + try { + return new CoreServicesShimObject(this, logger); + } + catch (err) { + logInternalError(logger, err); + throw err; + } + }; + TypeScriptServicesFactory.prototype.close = function () { + this._shims = []; + this.documentRegistry = ts.createDocumentRegistry(); + }; + TypeScriptServicesFactory.prototype.registerShim = function (shim) { + this._shims.push(shim); + }; + TypeScriptServicesFactory.prototype.unregisterShim = function (shim) { + for (var i = 0, n = this._shims.length; i < n; i++) { + if (this._shims[i] === shim) { + delete this._shims[i]; + return; + } + } + throw new Error("Invalid operation"); + }; + return TypeScriptServicesFactory; + })(); + ts.TypeScriptServicesFactory = TypeScriptServicesFactory; + if (typeof module !== "undefined" && module.exports) { + module.exports = ts; + } +})(ts || (ts = {})); +var TypeScript; +(function (TypeScript) { + var Services; + (function (Services) { + Services.TypeScriptServicesFactory = ts.TypeScriptServicesFactory; + })(Services = TypeScript.Services || (TypeScript.Services = {})); +})(TypeScript || (TypeScript = {})); diff --git a/bin/typescriptServices.d.ts b/bin/typescriptServices.d.ts index 74624dbca81..4421c8d7255 100644 --- a/bin/typescriptServices.d.ts +++ b/bin/typescriptServices.d.ts @@ -142,110 +142,113 @@ declare module ts { NumberKeyword = 117, SetKeyword = 118, StringKeyword = 119, - TypeKeyword = 120, - QualifiedName = 121, - ComputedPropertyName = 122, - TypeParameter = 123, - Parameter = 124, - PropertySignature = 125, - PropertyDeclaration = 126, - MethodSignature = 127, - MethodDeclaration = 128, - Constructor = 129, - GetAccessor = 130, - SetAccessor = 131, - CallSignature = 132, - ConstructSignature = 133, - IndexSignature = 134, - TypeReference = 135, - FunctionType = 136, - ConstructorType = 137, - TypeQuery = 138, - TypeLiteral = 139, - ArrayType = 140, - TupleType = 141, - UnionType = 142, - ParenthesizedType = 143, - ObjectBindingPattern = 144, - ArrayBindingPattern = 145, - BindingElement = 146, - ArrayLiteralExpression = 147, - ObjectLiteralExpression = 148, - PropertyAccessExpression = 149, - ElementAccessExpression = 150, - CallExpression = 151, - NewExpression = 152, - TaggedTemplateExpression = 153, - TypeAssertionExpression = 154, - ParenthesizedExpression = 155, - FunctionExpression = 156, - ArrowFunction = 157, - DeleteExpression = 158, - TypeOfExpression = 159, - VoidExpression = 160, - PrefixUnaryExpression = 161, - PostfixUnaryExpression = 162, - BinaryExpression = 163, - ConditionalExpression = 164, - TemplateExpression = 165, - YieldExpression = 166, - SpreadElementExpression = 167, - OmittedExpression = 168, - TemplateSpan = 169, - Block = 170, - VariableStatement = 171, - EmptyStatement = 172, - ExpressionStatement = 173, - IfStatement = 174, - DoStatement = 175, - WhileStatement = 176, - ForStatement = 177, - ForInStatement = 178, - ContinueStatement = 179, - BreakStatement = 180, - ReturnStatement = 181, - WithStatement = 182, - SwitchStatement = 183, - LabeledStatement = 184, - ThrowStatement = 185, - TryStatement = 186, - DebuggerStatement = 187, - VariableDeclaration = 188, - VariableDeclarationList = 189, - FunctionDeclaration = 190, - ClassDeclaration = 191, - InterfaceDeclaration = 192, - TypeAliasDeclaration = 193, - EnumDeclaration = 194, - ModuleDeclaration = 195, - ModuleBlock = 196, - ImportDeclaration = 197, - ExportAssignment = 198, - ExternalModuleReference = 199, - CaseClause = 200, - DefaultClause = 201, - HeritageClause = 202, - CatchClause = 203, - PropertyAssignment = 204, - ShorthandPropertyAssignment = 205, - EnumMember = 206, - SourceFile = 207, - SyntaxList = 208, - Count = 209, + SymbolKeyword = 120, + TypeKeyword = 121, + OfKeyword = 122, + QualifiedName = 123, + ComputedPropertyName = 124, + TypeParameter = 125, + Parameter = 126, + PropertySignature = 127, + PropertyDeclaration = 128, + MethodSignature = 129, + MethodDeclaration = 130, + Constructor = 131, + GetAccessor = 132, + SetAccessor = 133, + CallSignature = 134, + ConstructSignature = 135, + IndexSignature = 136, + TypeReference = 137, + FunctionType = 138, + ConstructorType = 139, + TypeQuery = 140, + TypeLiteral = 141, + ArrayType = 142, + TupleType = 143, + UnionType = 144, + ParenthesizedType = 145, + ObjectBindingPattern = 146, + ArrayBindingPattern = 147, + BindingElement = 148, + ArrayLiteralExpression = 149, + ObjectLiteralExpression = 150, + PropertyAccessExpression = 151, + ElementAccessExpression = 152, + CallExpression = 153, + NewExpression = 154, + TaggedTemplateExpression = 155, + TypeAssertionExpression = 156, + ParenthesizedExpression = 157, + FunctionExpression = 158, + ArrowFunction = 159, + DeleteExpression = 160, + TypeOfExpression = 161, + VoidExpression = 162, + PrefixUnaryExpression = 163, + PostfixUnaryExpression = 164, + BinaryExpression = 165, + ConditionalExpression = 166, + TemplateExpression = 167, + YieldExpression = 168, + SpreadElementExpression = 169, + OmittedExpression = 170, + TemplateSpan = 171, + Block = 172, + VariableStatement = 173, + EmptyStatement = 174, + ExpressionStatement = 175, + IfStatement = 176, + DoStatement = 177, + WhileStatement = 178, + ForStatement = 179, + ForInStatement = 180, + ForOfStatement = 181, + ContinueStatement = 182, + BreakStatement = 183, + ReturnStatement = 184, + WithStatement = 185, + SwitchStatement = 186, + LabeledStatement = 187, + ThrowStatement = 188, + TryStatement = 189, + DebuggerStatement = 190, + VariableDeclaration = 191, + VariableDeclarationList = 192, + FunctionDeclaration = 193, + ClassDeclaration = 194, + InterfaceDeclaration = 195, + TypeAliasDeclaration = 196, + EnumDeclaration = 197, + ModuleDeclaration = 198, + ModuleBlock = 199, + ImportDeclaration = 200, + ExportAssignment = 201, + ExternalModuleReference = 202, + CaseClause = 203, + DefaultClause = 204, + HeritageClause = 205, + CatchClause = 206, + PropertyAssignment = 207, + ShorthandPropertyAssignment = 208, + EnumMember = 209, + SourceFile = 210, + SyntaxList = 211, + Count = 212, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 120, + LastKeyword = 122, FirstFutureReservedWord = 101, LastFutureReservedWord = 109, - FirstTypeNode = 135, - LastTypeNode = 143, + FirstTypeNode = 137, + LastTypeNode = 145, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 120, + LastToken = 122, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -254,7 +257,7 @@ declare module ts { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 121, + FirstNode = 123, } const enum NodeFlags { Export = 1, @@ -487,7 +490,7 @@ declare module ts { } interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } interface ConditionalExpression extends Expression { @@ -585,6 +588,10 @@ declare module ts { initializer: VariableDeclarationList | Expression; expression: Expression; } + interface ForOfStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } interface BreakOrContinueStatement extends Statement { label?: Identifier; } @@ -686,7 +693,10 @@ declare module ts { endOfFileToken: Node; fileName: string; text: string; - amdDependencies: string[]; + amdDependencies: { + path: string; + name: string; + }[]; amdModuleName: string; referencedFiles: FileReference[]; hasNoDefaultLib: boolean; @@ -991,8 +1001,9 @@ declare module ts { ObjectLiteral = 131072, ContainsUndefinedOrNull = 262144, ContainsObjectLiteral = 524288, - Intrinsic = 127, - Primitive = 510, + ESSymbol = 1048576, + Intrinsic = 1048703, + Primitive = 1049086, StringLike = 258, NumberLike = 132, ObjectType = 48128, @@ -1278,6 +1289,7 @@ declare module ts { equals = 61, exclamation = 33, greaterThan = 62, + hash = 35, lessThan = 60, minus = 45, openBrace = 123, @@ -1344,8 +1356,8 @@ declare module ts { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; @@ -1367,7 +1379,7 @@ declare module ts { function createNode(kind: SyntaxKind): Node; function forEachChild(node: Node, cbNode: (node: Node) => T, cbNodeArray?: (nodes: Node[]) => T): T; function modifierToFlag(token: SyntaxKind): NodeFlags; - function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange): SourceFile; + function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; function isEvalOrArgumentsIdentifier(node: Node): boolean; function createSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, setParentNodes?: boolean): SourceFile; function isLeftHandSideExpression(expr: Expression): boolean; @@ -1429,9 +1441,9 @@ declare module ts { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** @@ -1493,7 +1505,7 @@ declare module ts { getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; @@ -1568,6 +1580,7 @@ declare module ts { InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; + [s: string]: boolean | number | string; } interface DefinitionInfo { fileName: string; @@ -1701,6 +1714,9 @@ declare module ts { InMultiLineCommentTrivia = 1, InSingleQuoteStringLiteral = 2, InDoubleQuoteStringLiteral = 3, + InTemplateHeadOrNoSubstitutionTemplate = 4, + InTemplateMiddleOrTail = 5, + InTemplateSubstitutionPosition = 6, } enum TokenClass { Punctuation = 0, @@ -1722,7 +1738,26 @@ declare module ts { classification: TokenClass; } interface Classifier { - getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult; + /** + * Gives lexical classifications of tokens on a line without any syntactic context. + * For instance, a token consisting of the text 'string' can be either an identifier + * named 'string' or the keyword 'string', however, because this classifier is not aware, + * it relies on certain heuristics to give acceptable results. For classifications where + * speed trumps accuracy, this function is preferable; however, for true accuracy, the + * syntactic classifier is ideal. In fact, in certain editing scenarios, combining the + * lexical, syntactic, and semantic classifiers may issue the best user experience. + * + * @param text The text of a line to classify. + * @param lexState The state of the lexical classifier at the end of the previous line. + * @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier. + * If there is no syntactic classifier (syntacticClassifierAbsent=true), + * certain heuristics may be used in its place; however, if there is a + * syntactic classifier (syntacticClassifierAbsent=false), certain + * classifications which may be incorrectly categorized will be given + * back as Identifiers in order to allow the syntactic classifier to + * subsume the classification. + */ + getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; } /** * The document registry represents a store of SourceFile objects that can be shared between @@ -1858,7 +1893,7 @@ declare module ts { } function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; var disableIncrementalParsing: boolean; - function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange): SourceFile; + function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; function createDocumentRegistry(): DocumentRegistry; function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; diff --git a/bin/typescriptServices.js b/bin/typescriptServices.js index 9f532c9ae51..1d2c9f37ac8 100644 --- a/bin/typescriptServices.js +++ b/bin/typescriptServices.js @@ -136,110 +136,113 @@ var ts; SyntaxKind[SyntaxKind["NumberKeyword"] = 117] = "NumberKeyword"; SyntaxKind[SyntaxKind["SetKeyword"] = 118] = "SetKeyword"; SyntaxKind[SyntaxKind["StringKeyword"] = 119] = "StringKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 120] = "TypeKeyword"; - SyntaxKind[SyntaxKind["QualifiedName"] = 121] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 122] = "ComputedPropertyName"; - SyntaxKind[SyntaxKind["TypeParameter"] = 123] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 124] = "Parameter"; - SyntaxKind[SyntaxKind["PropertySignature"] = 125] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 126] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 127] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 128] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 129] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 130] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 131] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 132] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 133] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 134] = "IndexSignature"; - SyntaxKind[SyntaxKind["TypeReference"] = 135] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 136] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 137] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 138] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 139] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 140] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 141] = "TupleType"; - SyntaxKind[SyntaxKind["UnionType"] = 142] = "UnionType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 143] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 144] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 145] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 146] = "BindingElement"; - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 147] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 148] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 149] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 150] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 151] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 152] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 153] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 154] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 155] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 156] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 157] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 158] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 159] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 160] = "VoidExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 161] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 162] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 163] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 164] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 165] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 166] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElementExpression"] = 167] = "SpreadElementExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 168] = "OmittedExpression"; - SyntaxKind[SyntaxKind["TemplateSpan"] = 169] = "TemplateSpan"; - SyntaxKind[SyntaxKind["Block"] = 170] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 171] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 172] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 173] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 174] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 175] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 176] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 177] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 178] = "ForInStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 179] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 180] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 181] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 182] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 183] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 184] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 185] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 186] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 187] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 188] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 189] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 190] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 191] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 192] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 193] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 194] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 195] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 196] = "ModuleBlock"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 197] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 198] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 199] = "ExternalModuleReference"; - SyntaxKind[SyntaxKind["CaseClause"] = 200] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 201] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 202] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 203] = "CatchClause"; - SyntaxKind[SyntaxKind["PropertyAssignment"] = 204] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 205] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["EnumMember"] = 206] = "EnumMember"; - SyntaxKind[SyntaxKind["SourceFile"] = 207] = "SourceFile"; - SyntaxKind[SyntaxKind["SyntaxList"] = 208] = "SyntaxList"; - SyntaxKind[SyntaxKind["Count"] = 209] = "Count"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 120] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 121] = "TypeKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 122] = "OfKeyword"; + SyntaxKind[SyntaxKind["QualifiedName"] = 123] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 124] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["TypeParameter"] = 125] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 126] = "Parameter"; + SyntaxKind[SyntaxKind["PropertySignature"] = 127] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 128] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 129] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 130] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 131] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 132] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 133] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 134] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 135] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 136] = "IndexSignature"; + SyntaxKind[SyntaxKind["TypeReference"] = 137] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 138] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 139] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 140] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 141] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 142] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 143] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 144] = "UnionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 145] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 146] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 147] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 148] = "BindingElement"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 149] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 150] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 151] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 152] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 153] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 154] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 155] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 156] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 157] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 158] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 159] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 160] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 161] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 162] = "VoidExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 163] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 164] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 165] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 166] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 167] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 168] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElementExpression"] = 169] = "SpreadElementExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 170] = "OmittedExpression"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 171] = "TemplateSpan"; + SyntaxKind[SyntaxKind["Block"] = 172] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 173] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 174] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 175] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 176] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 177] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 178] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 179] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 180] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 181] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 182] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 183] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 184] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 185] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 186] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 187] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 188] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 189] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 190] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 191] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 192] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 193] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 194] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 195] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 196] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 197] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 198] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 199] = "ModuleBlock"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 200] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 201] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 202] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["CaseClause"] = 203] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 204] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 205] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 206] = "CatchClause"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 207] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 208] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["EnumMember"] = 209] = "EnumMember"; + SyntaxKind[SyntaxKind["SourceFile"] = 210] = "SourceFile"; + SyntaxKind[SyntaxKind["SyntaxList"] = 211] = "SyntaxList"; + SyntaxKind[SyntaxKind["Count"] = 212] = "Count"; SyntaxKind[SyntaxKind["FirstAssignment"] = 52] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 63] = "LastAssignment"; SyntaxKind[SyntaxKind["FirstReservedWord"] = 65] = "FirstReservedWord"; SyntaxKind[SyntaxKind["LastReservedWord"] = 100] = "LastReservedWord"; SyntaxKind[SyntaxKind["FirstKeyword"] = 65] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 120] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 122] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 101] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 109] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 135] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 143] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 137] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 145] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 14] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 63] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 120] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 122] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 6] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 7] = "FirstLiteralToken"; @@ -248,7 +251,7 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 13] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 24] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 63] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstNode"] = 121] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstNode"] = 123] = "FirstNode"; })(ts.SyntaxKind || (ts.SyntaxKind = {})); var SyntaxKind = ts.SyntaxKind; (function (NodeFlags) { @@ -414,8 +417,9 @@ var ts; TypeFlags[TypeFlags["ObjectLiteral"] = 131072] = "ObjectLiteral"; TypeFlags[TypeFlags["ContainsUndefinedOrNull"] = 262144] = "ContainsUndefinedOrNull"; TypeFlags[TypeFlags["ContainsObjectLiteral"] = 524288] = "ContainsObjectLiteral"; - TypeFlags[TypeFlags["Intrinsic"] = 127] = "Intrinsic"; - TypeFlags[TypeFlags["Primitive"] = 510] = "Primitive"; + TypeFlags[TypeFlags["ESSymbol"] = 1048576] = "ESSymbol"; + TypeFlags[TypeFlags["Intrinsic"] = 1048703] = "Intrinsic"; + TypeFlags[TypeFlags["Primitive"] = 1049086] = "Primitive"; TypeFlags[TypeFlags["StringLike"] = 258] = "StringLike"; TypeFlags[TypeFlags["NumberLike"] = 132] = "NumberLike"; TypeFlags[TypeFlags["ObjectType"] = 48128] = "ObjectType"; @@ -558,6 +562,7 @@ var ts; CharacterCodes[CharacterCodes["equals"] = 61] = "equals"; CharacterCodes[CharacterCodes["exclamation"] = 33] = "exclamation"; CharacterCodes[CharacterCodes["greaterThan"] = 62] = "greaterThan"; + CharacterCodes[CharacterCodes["hash"] = 35] = "hash"; CharacterCodes[CharacterCodes["lessThan"] = 60] = "lessThan"; CharacterCodes[CharacterCodes["minus"] = 45] = "minus"; CharacterCodes[CharacterCodes["openBrace"] = 123] = "openBrace"; @@ -878,7 +883,12 @@ var ts; return diagnostic.file ? diagnostic.file.fileName : undefined; } function compareDiagnostics(d1, d2) { - return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(d1.code, d2.code) || compareMessageText(d1.messageText, d2.messageText) || 0; + return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || + compareValues(d1.start, d2.start) || + compareValues(d1.length, d2.length) || + compareValues(d1.code, d2.code) || + compareMessageText(d1.messageText, d2.messageText) || + 0; } ts.compareDiagnostics = compareDiagnostics; function compareMessageText(text1, text2) { @@ -1381,9 +1391,7 @@ var ts; watchFile: function (fileName, callback) { _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); return { - close: function () { - _fs.unwatchFile(fileName, fileChanged); - } + close: function () { _fs.unwatchFile(fileName, fileChanged); } }; function fileChanged(curr, prev) { if (+curr.mtime <= +prev.mtime) { @@ -1560,12 +1568,12 @@ var ts; An_object_member_cannot_be_declared_optional: { code: 1162, category: 1, key: "An object member cannot be declared optional." }, yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: 1, key: "'yield' expression must be contained_within a generator declaration." }, Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: 1, key: "Computed property names are not allowed in enums." }, - Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: 1, key: "Computed property names are not allowed in an ambient context." }, - Computed_property_names_are_not_allowed_in_class_property_declarations: { code: 1166, category: 1, key: "Computed property names are not allowed in class property declarations." }, + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: 1, key: "A computed property name in an ambient context must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: 1, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: 1, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, - Computed_property_names_are_not_allowed_in_method_overloads: { code: 1168, category: 1, key: "Computed property names are not allowed in method overloads." }, - Computed_property_names_are_not_allowed_in_interfaces: { code: 1169, category: 1, key: "Computed property names are not allowed in interfaces." }, - Computed_property_names_are_not_allowed_in_type_literals: { code: 1170, category: 1, key: "Computed property names are not allowed in type literals." }, + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: 1, key: "A computed property name in a method overload must directly refer to a built-in symbol." }, + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: 1, key: "A computed property name in an interface must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: 1, key: "A computed property name in a type literal must directly refer to a built-in symbol." }, A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: 1, key: "A comma expression is not allowed in a computed property name." }, extends_clause_already_seen: { code: 1172, category: 1, key: "'extends' clause already seen." }, extends_clause_must_precede_implements_clause: { code: 1173, category: 1, key: "'extends' clause must precede 'implements' clause." }, @@ -1584,6 +1592,9 @@ var ts; Merge_conflict_marker_encountered: { code: 1185, category: 1, key: "Merge conflict marker encountered." }, A_rest_element_cannot_have_an_initializer: { code: 1186, category: 1, key: "A rest element cannot have an initializer." }, A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: 1, key: "A parameter property may not be a binding pattern." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: 1, key: "Only a single variable declaration is allowed in a 'for...of' statement." }, + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: 1, key: "The variable declaration of a 'for...in' statement cannot have an initializer." }, + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: 1, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, Duplicate_identifier_0: { code: 2300, category: 1, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1, 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: 1, key: "Static members cannot reference class type parameters." }, @@ -1603,7 +1614,7 @@ var ts; Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1, key: "Global type '{0}' must be a class or interface type." }, Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1, key: "Global type '{0}' must have {1} type parameter(s)." }, Cannot_find_global_type_0: { code: 2318, category: 1, key: "Cannot find global type '{0}'." }, - Named_properties_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1, key: "Named properties '{0}' of types '{1}' and '{2}' are not identical." }, + Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, Type_0_is_not_assignable_to_type_1: { code: 2322, category: 1, key: "Type '{0}' is not assignable to type '{1}'." }, @@ -1625,7 +1636,7 @@ var ts; Property_0_does_not_exist_on_type_1: { code: 2339, category: 1, key: "Property '{0}' does not exist on type '{1}'." }, Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_or_any: { code: 2342, category: 1, key: "An index expression argument must be of type 'string', 'number', or 'any'." }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: 1, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1, key: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1, key: "Supplied parameters do not match any signature of call target." }, @@ -1641,7 +1652,7 @@ var ts; The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, - The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number: { code: 2360, category: 1, key: "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'." }, + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: 1, key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, @@ -1736,10 +1747,26 @@ var ts; Type_0_is_not_an_array_type: { code: 2461, category: 1, key: "Type '{0}' is not an array type." }, A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: 1, key: "A rest element must be last in an array destructuring pattern" }, A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: 1, key: "A binding pattern parameter cannot be optional in an implementation signature." }, - A_computed_property_name_must_be_of_type_string_number_or_any: { code: 2464, category: 1, key: "A computed property name must be of type 'string', 'number', or 'any'." }, + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: 1, key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: 1, key: "'this' cannot be referenced in a computed property name." }, super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: 1, key: "'super' cannot be referenced in a computed property name." }, - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2466, category: 1, key: "A computed property name cannot reference a type parameter from its containing type." }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: 1, key: "A computed property name cannot reference a type parameter from its containing type." }, + Cannot_find_global_value_0: { code: 2468, category: 1, key: "Cannot find global value '{0}'." }, + The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: 1, key: "The '{0}' operator cannot be applied to type 'symbol'." }, + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: 1, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: 1, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: 1, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, + Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: 1, key: "Enum declarations must all be const or non-const." }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: 1, key: "In 'const' enum declarations member initializer must be constant expression." }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: 1, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: 1, key: "A const enum member can only be accessed using a string literal." }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: 1, key: "'const' enum member initializer was evaluated to a non-finite value." }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: 1, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, + Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: 1, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: 1, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: 1, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, + for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: 1, key: "'for...of' statements are only available when targeting ECMAScript 6 or higher." }, + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: 1, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: 1, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1809,13 +1836,6 @@ var ts; Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1, key: "Exported type alias '{0}' has or is using private name '{1}'." }, - Enum_declarations_must_all_be_const_or_non_const: { code: 4082, category: 1, key: "Enum declarations must all be const or non-const." }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 4083, category: 1, key: "In 'const' enum declarations member initializer must be constant expression." }, - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 4084, category: 1, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 4085, category: 1, key: "A const enum member can only be accessed using a string literal." }, - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 4086, category: 1, key: "'const' enum member initializer was evaluated to a non-finite value." }, - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 4087, category: 1, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, - Property_0_does_not_exist_on_const_enum_1: { code: 4088, category: 1, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: 1, key: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1, key: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: 1, key: "Cannot read file '{0}': {1}" }, @@ -1891,7 +1911,8 @@ var ts; You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: 1, key: "You cannot rename elements that are defined in the standard TypeScript library." }, yield_expressions_are_not_currently_supported: { code: 9000, category: 1, key: "'yield' expressions are not currently supported." }, Generators_are_not_currently_supported: { code: 9001, category: 1, key: "Generators are not currently supported." }, - The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: 1, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." } + The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: 1, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, + for_of_statements_are_not_currently_supported: { code: 9003, category: 1, key: "'for...of' statements are not currently supported." } }; })(ts || (ts = {})); var ts; @@ -1942,17 +1963,19 @@ var ts; "string": 119, "super": 90, "switch": 91, + "symbol": 120, "this": 92, "throw": 93, "true": 94, "try": 95, - "type": 120, + "type": 121, "typeof": 96, "var": 97, "void": 98, "while": 99, "with": 100, "yield": 109, + "of": 122, "{": 14, "}": 15, "(": 16, @@ -2033,6 +2056,7 @@ var ts; function isUnicodeIdentifierStart(code, languageVersion) { return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); } + ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart; function isUnicodeIdentifierPart(code, languageVersion) { return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) : lookupInUnicodeMap(code, unicodeES3IdentifierPart); } @@ -2077,15 +2101,15 @@ var ts; return result; } ts.computeLineStarts = computeLineStarts; - function getPositionFromLineAndCharacter(sourceFile, line, character) { - return computePositionFromLineAndCharacter(getLineStarts(sourceFile), line, character); + function getPositionOfLineAndCharacter(sourceFile, line, character) { + return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character); } - ts.getPositionFromLineAndCharacter = getPositionFromLineAndCharacter; - function computePositionFromLineAndCharacter(lineStarts, line, character) { - ts.Debug.assert(line > 0 && line <= lineStarts.length); - return lineStarts[line - 1] + character - 1; + ts.getPositionOfLineAndCharacter = getPositionOfLineAndCharacter; + function computePositionOfLineAndCharacter(lineStarts, line, character) { + ts.Debug.assert(line >= 0 && line < lineStarts.length); + return lineStarts[line] + character; } - ts.computePositionFromLineAndCharacter = computePositionFromLineAndCharacter; + ts.computePositionOfLineAndCharacter = computePositionOfLineAndCharacter; function getLineStarts(sourceFile) { return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text)); } @@ -2093,11 +2117,11 @@ var ts; function computeLineAndCharacterOfPosition(lineStarts, position) { var lineNumber = ts.binarySearch(lineStarts, position); if (lineNumber < 0) { - lineNumber = (~lineNumber) - 1; + lineNumber = ~lineNumber - 1; } return { - line: lineNumber + 1, - character: position - lineStarts[lineNumber] + 1 + line: lineNumber, + character: position - lineStarts[lineNumber] }; } ts.computeLineAndCharacterOfPosition = computeLineAndCharacterOfPosition; @@ -2107,7 +2131,9 @@ var ts; ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { - return ch === 32 || ch === 9 || ch === 11 || ch === 12 || ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; + return ch === 32 || ch === 9 || ch === 11 || ch === 12 || + ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || + ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; } ts.isWhiteSpace = isWhiteSpace; function isLineBreak(ch) { @@ -2194,7 +2220,8 @@ var ts; return false; } } - return ch === 61 || text.charCodeAt(pos + mergeConflictMarkerLength) === 32; + return ch === 61 || + text.charCodeAt(pos + mergeConflictMarkerLength) === 32; } } return false; @@ -2301,11 +2328,15 @@ var ts; } ts.getTrailingCommentRanges = getTrailingCommentRanges; function isIdentifierStart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } ts.isIdentifierStart = isIdentifierStart; function isIdentifierPart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } ts.isIdentifierPart = isIdentifierPart; function createScanner(languageVersion, skipTrivia, text, onError) { @@ -2323,10 +2354,14 @@ var ts; } } function isIdentifierStart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + 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); + 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; @@ -3047,13 +3082,10 @@ var ts; writeParameter: writeText, writeSymbol: writeText, writeLine: function () { return str += " "; }, - increaseIndent: function () { - }, - decreaseIndent: function () { - }, + increaseIndent: function () { }, + decreaseIndent: function () { }, clear: function () { return str = ""; }, - trackSymbol: function () { - } + trackSymbol: function () { } }; } return stringWriters.pop(); @@ -3075,7 +3107,8 @@ var ts; ts.containsParseError = containsParseError; function aggregateChildData(node) { if (!(node.parserContextFlags & 64)) { - var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || ts.forEachChild(node, containsParseError); + var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || + ts.forEachChild(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { node.parserContextFlags |= 32; } @@ -3083,16 +3116,21 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 207) { + while (node && node.kind !== 210) { node = node.parent; } return node; } ts.getSourceFileOfNode = getSourceFileOfNode; + function getStartPositionOfLine(line, sourceFile) { + ts.Debug.assert(line >= 0); + return ts.getLineStarts(sourceFile)[line]; + } + ts.getStartPositionOfLine = getStartPositionOfLine; function nodePosToString(node) { var file = getSourceFileOfNode(node); var loc = ts.getLineAndCharacterOfPosition(file, node.pos); - return file.fileName + "(" + loc.line + "," + loc.character + ")"; + return file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + ")"; } ts.nodePosToString = nodePosToString; function getStartPosOfNode(node) { @@ -3174,13 +3212,13 @@ var ts; function getErrorSpanForNode(node) { var errorSpan; switch (node.kind) { - case 188: - case 146: case 191: - case 192: - case 195: + case 148: case 194: - case 206: + case 195: + case 198: + case 197: + case 209: errorSpan = node.name; break; } @@ -3196,11 +3234,11 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 194 && isConst(node); + return node.kind === 197 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 146 || isBindingPattern(node))) { + while (node && (node.kind === 148 || isBindingPattern(node))) { node = node.parent; } return node; @@ -3208,14 +3246,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 188) { + if (node.kind === 191) { node = node.parent; } - if (node && node.kind === 189) { + if (node && node.kind === 192) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 171) { + if (node && node.kind === 173) { flags |= node.flags; } return flags; @@ -3230,12 +3268,12 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 173 && node.expression.kind === 8; + return node.kind === 175 && node.expression.kind === 8; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { sourceFileOfNode = sourceFileOfNode || getSourceFileOfNode(node); - if (node.kind === 124 || node.kind === 123) { + if (node.kind === 126 || node.kind === 125) { return ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)); } else { @@ -3246,7 +3284,9 @@ var ts; function getJsDocComments(node, sourceFileOfNode) { return ts.filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), 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 sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && + sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && + sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; } } ts.getJsDocComments = getJsDocComments; @@ -3255,21 +3295,22 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 181: + case 184: return visitor(node); - case 170: - case 174: - case 175: + case 172: case 176: case 177: case 178: - case 182: - case 183: - case 200: - case 201: - case 184: + case 179: + case 180: + case 181: + case 185: case 186: case 203: + case 204: + case 187: + case 189: + case 206: return ts.forEachChild(node, traverse); } } @@ -3278,22 +3319,22 @@ var ts; function isAnyFunction(node) { if (node) { switch (node.kind) { - case 129: - case 156: - case 190: - case 157: - case 128: - case 127: - case 130: case 131: + case 158: + case 193: + case 159: + case 130: + case 129: case 132: case 133: case 134: + case 135: case 136: - case 137: - case 156: - case 157: - case 190: + case 138: + case 139: + case 158: + case 159: + case 193: return true; } } @@ -3301,11 +3342,11 @@ var ts; } ts.isAnyFunction = isAnyFunction; function isFunctionBlock(node) { - return node && node.kind === 170 && isAnyFunction(node.parent); + return node && node.kind === 172 && isAnyFunction(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 128 && node.parent.kind === 148; + return node && node.kind === 130 && node.parent.kind === 150; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function getContainingFunction(node) { @@ -3324,28 +3365,28 @@ var ts; return undefined; } switch (node.kind) { - case 122: - if (node.parent.parent.kind === 191) { + case 124: + if (node.parent.parent.kind === 194) { return node; } node = node.parent; break; - case 157: + case 159: if (!includeArrowFunctions) { continue; } - case 190: - case 156: - case 195: - case 126: - case 125: + case 193: + case 158: + case 198: case 128: case 127: - case 129: case 130: + case 129: case 131: - case 194: - case 207: + case 132: + case 133: + case 197: + case 210: return node; } } @@ -3357,32 +3398,32 @@ var ts; if (!node) return node; switch (node.kind) { - case 122: - if (node.parent.parent.kind === 191) { + case 124: + if (node.parent.parent.kind === 194) { return node; } node = node.parent; break; - case 190: - case 156: - case 157: + case 193: + case 158: + case 159: if (!includeFunctions) { continue; } - case 126: - case 125: case 128: case 127: - case 129: case 130: + case 129: case 131: + case 132: + case 133: return node; } } } ts.getSuperContainer = getSuperContainer; function getInvokedExpression(node) { - if (node.kind === 153) { + if (node.kind === 155) { return node.tag; } return node.expression; @@ -3396,8 +3437,6 @@ var ts; case 94: case 79: case 9: - case 147: - case 148: case 149: case 150: case 151: @@ -3407,61 +3446,67 @@ var ts; case 155: case 156: case 157: - case 160: case 158: case 159: - case 161: case 162: + case 160: + case 161: case 163: case 164: - case 167: case 165: + case 166: + case 169: + case 167: case 10: - case 168: + case 170: return true; - case 121: - while (node.parent.kind === 121) { + case 123: + while (node.parent.kind === 123) { node = node.parent; } - return node.parent.kind === 138; + return node.parent.kind === 140; case 64: - if (node.parent.kind === 138) { + if (node.parent.kind === 140) { return true; } case 7: case 8: var parent = node.parent; switch (parent.kind) { - case 188: - case 124: + case 191: case 126: - case 125: - case 206: - case 204: - case 146: + case 128: + case 127: + case 209: + case 207: + case 148: return parent.initializer === node; - case 173: - case 174: case 175: case 176: - case 181: - case 182: - case 183: - case 200: - case 185: - case 183: - return parent.expression === node; case 177: - var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 189) || forStatement.condition === node || forStatement.iterator === node; case 178: + case 184: + case 185: + case 186: + case 203: + case 188: + case 186: + return parent.expression === node; + case 179: + var forStatement = parent; + return (forStatement.initializer === node && forStatement.initializer.kind !== 192) || + forStatement.condition === node || + forStatement.iterator === node; + case 180: + case 181: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 189) || forInStatement.expression === node; - case 154: + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 192) || + forInStatement.expression === node; + case 156: return node === parent.expression; - case 169: + case 171: return node === parent.expression; - case 122: + case 124: return node === parent.expression; default: if (isExpression(parent)) { @@ -3474,11 +3519,12 @@ var ts; ts.isExpression = isExpression; function isInstantiatedModule(node, preserveConstEnums) { var moduleState = ts.getModuleInstanceState(node); - return moduleState === 1 || (preserveConstEnums && moduleState === 2); + return moduleState === 1 || + (preserveConstEnums && moduleState === 2); } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportDeclaration(node) { - return node.kind === 197 && node.moduleReference.kind === 199; + return node.kind === 200 && node.moduleReference.kind === 202; } ts.isExternalModuleImportDeclaration = isExternalModuleImportDeclaration; function getExternalModuleImportDeclarationExpression(node) { @@ -3487,26 +3533,26 @@ var ts; } ts.getExternalModuleImportDeclarationExpression = getExternalModuleImportDeclarationExpression; function isInternalModuleImportDeclaration(node) { - return node.kind === 197 && node.moduleReference.kind !== 199; + return node.kind === 200 && node.moduleReference.kind !== 202; } ts.isInternalModuleImportDeclaration = isInternalModuleImportDeclaration; function hasDotDotDotToken(node) { - return node && node.kind === 124 && node.dotDotDotToken !== undefined; + return node && node.kind === 126 && node.dotDotDotToken !== undefined; } ts.hasDotDotDotToken = hasDotDotDotToken; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 124: + case 126: return node.questionToken !== undefined; + case 130: + case 129: + return node.questionToken !== undefined; + case 208: + case 207: case 128: case 127: return node.questionToken !== undefined; - case 205: - case 204: - case 126: - case 125: - return node.questionToken !== undefined; } } return false; @@ -3529,7 +3575,7 @@ var ts; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return node.kind === 145 || node.kind === 144; + return node.kind === 147 || node.kind === 146; } ts.isBindingPattern = isBindingPattern; function isInAmbientContext(node) { @@ -3544,27 +3590,27 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 123: - case 124: - case 188: - case 146: - case 126: case 125: - case 204: - case 205: - case 206: + case 126: + case 191: + case 148: case 128: case 127: - case 190: + case 207: + case 208: + case 209: case 130: - case 131: case 129: - case 191: - case 192: case 193: + case 132: + case 133: + case 131: case 194: case 195: + case 196: case 197: + case 198: + case 200: return true; } return false; @@ -3572,24 +3618,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 180: - case 179: - case 187: - case 175: - case 173: - case 172: - case 178: - case 177: - case 174: - case 184: - case 181: case 183: - case 93: - case 186: - case 171: - case 176: case 182: - case 198: + case 190: + case 177: + case 175: + case 174: + case 180: + case 181: + case 179: + case 176: + case 187: + case 184: + case 186: + case 93: + case 189: + case 173: + case 178: + case 185: + case 201: return true; default: return false; @@ -3601,10 +3648,10 @@ var ts; return false; } var parent = name.parent; - if (isDeclaration(parent) || parent.kind === 156) { + if (isDeclaration(parent) || parent.kind === 158) { return parent.name === name; } - if (parent.kind === 203) { + if (parent.kind === 206) { return parent.name === name; } return false; @@ -3646,16 +3693,16 @@ var ts; ts.tryResolveScriptReference = tryResolveScriptReference; function getAncestor(node, kind) { switch (kind) { - case 191: + case 194: while (node) { switch (node.kind) { - case 191: - return node; case 194: - case 192: - case 193: - case 195: + return node; case 197: + case 195: + case 196: + case 198: + case 200: return undefined; default: node = node.parent; @@ -3710,13 +3757,45 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 65 <= token && token <= 120; + return 65 <= token && token <= 122; } ts.isKeyword = isKeyword; function isTrivia(token) { return 2 <= token && token <= 6; } ts.isTrivia = isTrivia; + function hasDynamicName(declaration) { + return declaration.name && + declaration.name.kind === 124 && + !isWellKnownSymbolSyntactically(declaration.name.expression); + } + ts.hasDynamicName = hasDynamicName; + function isWellKnownSymbolSyntactically(node) { + return node.kind === 151 && isESSymbolIdentifier(node.expression); + } + ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; + function getPropertyNameForPropertyNameNode(name) { + if (name.kind === 64 || name.kind === 8 || name.kind === 7) { + return name.text; + } + if (name.kind === 124) { + var nameExpression = name.expression; + if (isWellKnownSymbolSyntactically(nameExpression)) { + var rightHandSideName = nameExpression.name.text; + return getPropertyNameForKnownSymbolName(rightHandSideName); + } + } + return undefined; + } + ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode; + function getPropertyNameForKnownSymbolName(symbolName) { + return "__@" + symbolName; + } + ts.getPropertyNameForKnownSymbolName = getPropertyNameForKnownSymbolName; + function isESSymbolIdentifier(node) { + return node.kind === 64 && node.text === "Symbol"; + } + ts.isESSymbolIdentifier = isESSymbolIdentifier; function isModifier(token) { switch (token) { case 107: @@ -3908,7 +3987,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var nodeConstructors = new Array(209); + var nodeConstructors = new Array(212); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -3945,152 +4024,224 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 121: - return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); case 123: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 124: - case 126: + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); case 125: - case 204: - case 205: - case 188: - case 146: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 136: - case 137: - case 132: - case 133: - case 134: - return visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.expression); + case 126: case 128: case 127: - case 129: - case 130: - case 131: - case 156: - case 190: - case 157: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.body); - case 135: - return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); + case 207: + case 208: + case 191: + case 148: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); case 138: - return visitNode(cbNode, node.exprName); case 139: - return visitNodes(cbNodes, node.members); + case 134: + case 135: + case 136: + return visitNodes(cbNodes, node.modifiers) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type); + case 130: + case 129: + case 131: + case 132: + case 133: + case 158: + case 193: + case 159: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + case 137: + return visitNode(cbNode, node.typeName) || + visitNodes(cbNodes, node.typeArguments); case 140: - return visitNode(cbNode, node.elementType); + return visitNode(cbNode, node.exprName); case 141: - return visitNodes(cbNodes, node.elementTypes); + return visitNodes(cbNodes, node.members); case 142: - return visitNodes(cbNodes, node.types); + return visitNode(cbNode, node.elementType); case 143: - return visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.elementTypes); case 144: + return visitNodes(cbNodes, node.types); case 145: - return visitNodes(cbNodes, node.elements); + return visitNode(cbNode, node.type); + case 146: case 147: return visitNodes(cbNodes, node.elements); - case 148: - return visitNodes(cbNodes, node.properties); case 149: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.name); + return visitNodes(cbNodes, node.elements); case 150: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); + return visitNodes(cbNodes, node.properties); case 151: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.name); case 152: - return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.argumentExpression); case 153: - return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); case 154: - return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.typeArguments) || + visitNodes(cbNodes, node.arguments); case 155: - return visitNode(cbNode, node.expression); - case 158: - return visitNode(cbNode, node.expression); - case 159: + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.template); + case 156: + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); + case 157: return visitNode(cbNode, node.expression); case 160: return visitNode(cbNode, node.expression); case 161: - return visitNode(cbNode, node.operand); - case 166: - return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); + return visitNode(cbNode, node.expression); case 162: - return visitNode(cbNode, node.operand); + return visitNode(cbNode, node.expression); case 163: - return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); + return visitNode(cbNode, node.operand); + case 168: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); case 164: - return visitNode(cbNode, node.condition) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.whenFalse); - case 167: - return visitNode(cbNode, node.expression); - case 170: - case 196: - return visitNodes(cbNodes, node.statements); - case 207: - return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 171: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 189: - return visitNodes(cbNodes, node.declarations); - case 173: - return visitNode(cbNode, node.expression); - case 174: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 175: - return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 176: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 177: - return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.iterator) || visitNode(cbNode, node.statement); - case 178: - return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 179: - case 180: - return visitNode(cbNode, node.label); - case 181: - return visitNode(cbNode, node.expression); - case 182: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 183: - return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.clauses); - case 200: - return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 201: - return visitNodes(cbNodes, node.statements); - case 184: - return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 185: - return visitNode(cbNode, node.expression); - case 186: - return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 203: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.type) || visitNode(cbNode, node.block); - case 191: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 192: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 193: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 194: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 206: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 195: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 197: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 198: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportName); + return visitNode(cbNode, node.operand); case 165: - return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); + case 166: + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.whenFalse); case 169: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 122: return visitNode(cbNode, node.expression); - case 202: - return visitNodes(cbNodes, node.types); + case 172: case 199: + return visitNodes(cbNodes, node.statements); + case 210: + return visitNodes(cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); + case 173: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); + case 192: + return visitNodes(cbNodes, node.declarations); + case 175: + return visitNode(cbNode, node.expression); + case 176: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); + case 177: + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); + case 178: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 179: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.iterator) || + visitNode(cbNode, node.statement); + case 180: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 181: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 182: + case 183: + return visitNode(cbNode, node.label); + case 184: + return visitNode(cbNode, node.expression); + case 185: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 186: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.clauses); + case 203: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.statements); + case 204: + return visitNodes(cbNodes, node.statements); + case 187: + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + case 188: + return visitNode(cbNode, node.expression); + case 189: + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); + case 206: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.block); + case 194: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); + case 195: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); + case 196: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.type); + case 197: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 209: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + case 198: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + case 200: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); + case 201: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.exportName); + case 167: + return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); + case 171: + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); + case 124: + return visitNode(cbNode, node.expression); + case 205: + return visitNodes(cbNodes, node.types); + case 202: return visitNode(cbNode, node.expression); } } @@ -4165,31 +4316,50 @@ var ts; ts.modifierToFlag = modifierToFlag; function fixupParentReferences(sourceFile) { var parent = sourceFile; - function walk(n) { + forEachChild(sourceFile, visitNode); + return; + function visitNode(n) { if (n.parent !== parent) { n.parent = parent; var saveParent = parent; parent = n; - forEachChild(n, walk); + forEachChild(n, visitNode); parent = saveParent; } } - forEachChild(sourceFile, walk); } - function moveElementEntirelyPastChangeRange(element, delta) { - if (element.length) { + function shouldCheckNode(node) { + switch (node.kind) { + case 8: + case 7: + case 64: + return true; + } + return false; + } + function moveElementEntirelyPastChangeRange(element, isArray, delta, oldText, newText, aggressiveChecks) { + if (isArray) { visitArray(element); } else { visitNode(element); } + return; function visitNode(node) { + if (aggressiveChecks && shouldCheckNode(node)) { + var text = oldText.substring(node.pos, node.end); + } node._children = undefined; node.pos += delta; node.end += delta; + if (aggressiveChecks && shouldCheckNode(node)) { + ts.Debug.assert(text === newText.substring(node.pos, node.end)); + } forEachChild(node, visitNode, visitArray); + checkNodePositions(node, aggressiveChecks); } function visitArray(array) { + array._children = undefined; array.pos += delta; array.end += delta; for (var i = 0, n = array.length; i < n; i++) { @@ -4200,6 +4370,7 @@ var ts; function adjustIntersectingElement(element, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta) { ts.Debug.assert(element.end >= changeStart, "Adjusting an element that was entirely before the change range"); ts.Debug.assert(element.pos <= changeRangeOldEnd, "Adjusting an element that was entirely after the change range"); + ts.Debug.assert(element.pos <= element.end); element.pos = Math.min(element.pos, changeRangeNewEnd); if (element.end >= changeRangeOldEnd) { element.end += delta; @@ -4213,35 +4384,53 @@ var ts; ts.Debug.assert(element.end <= element.parent.end); } } - function updateTokenPositionsAndMarkElements(node, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta) { - visitNode(node); + function checkNodePositions(node, aggressiveChecks) { + if (aggressiveChecks) { + var pos = node.pos; + forEachChild(node, function (child) { + ts.Debug.assert(child.pos >= pos); + pos = child.end; + }); + ts.Debug.assert(pos <= node.end); + } + } + function updateTokenPositionsAndMarkElements(sourceFile, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta, oldText, newText, aggressiveChecks) { + visitNode(sourceFile); + return; function visitNode(child) { + ts.Debug.assert(child.pos <= child.end); if (child.pos > changeRangeOldEnd) { - moveElementEntirelyPastChangeRange(child, delta); + moveElementEntirelyPastChangeRange(child, false, delta, oldText, newText, aggressiveChecks); return; } var fullEnd = child.end; if (fullEnd >= changeStart) { child.intersectsChange = true; + child._children = undefined; adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); forEachChild(child, visitNode, visitArray); + checkNodePositions(child, aggressiveChecks); return; } + ts.Debug.assert(fullEnd < changeStart); } function visitArray(array) { + ts.Debug.assert(array.pos <= array.end); if (array.pos > changeRangeOldEnd) { - moveElementEntirelyPastChangeRange(array, delta); + moveElementEntirelyPastChangeRange(array, true, delta, oldText, newText, aggressiveChecks); + return; } - else { - var fullEnd = array.end; - if (fullEnd >= changeStart) { - array.intersectsChange = true; - adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var i = 0, n = array.length; i < n; i++) { - visitNode(array[i]); - } + var fullEnd = array.end; + if (fullEnd >= changeStart) { + array.intersectsChange = true; + array._children = undefined; + adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); + for (var i = 0, n = array.length; i < n; i++) { + visitNode(array[i]); } + return; } + ts.Debug.assert(fullEnd < changeStart); } } function extendToAffectedRange(sourceFile, changeRange) { @@ -4249,6 +4438,7 @@ var ts; var start = changeRange.span.start; for (var i = 0; start > 0 && i <= maxLookahead; i++) { var nearestNode = findNearestNodeStartingBeforeOrAtPosition(sourceFile, start); + ts.Debug.assert(nearestNode.pos <= start); var position = nearestNode.pos; start = Math.max(0, position - 1); } @@ -4310,23 +4500,48 @@ var ts; } } } - function updateSourceFile(sourceFile, newText, textChangeRange) { + function checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks) { + var oldText = sourceFile.text; + if (textChangeRange) { + ts.Debug.assert((oldText.length - textChangeRange.span.length + textChangeRange.newLength) === newText.length); + if (aggressiveChecks || ts.Debug.shouldAssert(3)) { + var oldTextPrefix = oldText.substr(0, textChangeRange.span.start); + var newTextPrefix = newText.substr(0, textChangeRange.span.start); + ts.Debug.assert(oldTextPrefix === newTextPrefix); + var oldTextSuffix = oldText.substring(ts.textSpanEnd(textChangeRange.span), oldText.length); + var newTextSuffix = newText.substring(ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange)), newText.length); + ts.Debug.assert(oldTextSuffix === newTextSuffix); + } + } + } + function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) { + aggressiveChecks = aggressiveChecks || ts.Debug.shouldAssert(2); + checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks); if (ts.textChangeRangeIsUnchanged(textChangeRange)) { return sourceFile; } if (sourceFile.statements.length === 0) { return parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, undefined, true); } + var incrementalSourceFile = sourceFile; + ts.Debug.assert(!incrementalSourceFile.hasBeenIncrementallyParsed); + incrementalSourceFile.hasBeenIncrementallyParsed = true; + var oldText = sourceFile.text; var syntaxCursor = createSyntaxCursor(sourceFile); var changeRange = extendToAffectedRange(sourceFile, textChangeRange); + checkChangeRange(sourceFile, newText, changeRange, aggressiveChecks); + ts.Debug.assert(changeRange.span.start <= textChangeRange.span.start); + ts.Debug.assert(ts.textSpanEnd(changeRange.span) === ts.textSpanEnd(textChangeRange.span)); + ts.Debug.assert(ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)) === ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange))); var delta = ts.textChangeRangeNewSpan(changeRange).length - changeRange.span.length; - updateTokenPositionsAndMarkElements(sourceFile, changeRange.span.start, ts.textSpanEnd(changeRange.span), ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)), delta); + updateTokenPositionsAndMarkElements(incrementalSourceFile, changeRange.span.start, ts.textSpanEnd(changeRange.span), ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks); var result = parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, true); return result; } ts.updateSourceFile = updateSourceFile; function isEvalOrArgumentsIdentifier(node) { - return node.kind === 64 && (node.text === "eval" || node.text === "arguments"); + return node.kind === 64 && + (node.text === "eval" || node.text === "arguments"); } ts.isEvalOrArgumentsIdentifier = isEvalOrArgumentsIdentifier; function isUseStrictPrologueDirective(sourceFile, node) { @@ -4347,7 +4562,7 @@ var ts; return { currentNode: function (position) { if (position !== lastQueriedPosition) { - if (current && current.end === position && currentArrayIndex < currentArray.length) { + if (current && current.end === position && currentArrayIndex < (currentArray.length - 1)) { currentArrayIndex++; current = currentArray[currentArrayIndex]; } @@ -4365,6 +4580,7 @@ var ts; currentArrayIndex = -1; current = undefined; forEachChild(sourceFile, visitNode, visitArray); + return; function visitNode(node) { if (position >= node.pos && position < node.end) { forEachChild(node, visitNode, visitArray); @@ -4410,9 +4626,8 @@ var ts; var identifiers = {}; var identifierCount = 0; var nodeCount = 0; - var scanner; var token; - var sourceFile = createNode(207, 0); + var sourceFile = createNode(210, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -4423,7 +4638,7 @@ var ts; sourceFile.flags = ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? 1024 : 0; var contextFlags = 0; var parseErrorBeforeNextFinishedNode = false; - scanner = ts.createScanner(languageVersion, true, sourceText, scanError); + var scanner = ts.createScanner(languageVersion, true, sourceText, scanError); token = nextToken(); processReferenceComments(sourceFile); sourceFile.statements = parseList(0, true, parseSourceElement); @@ -4436,6 +4651,7 @@ var ts; if (setParentNodes) { fixupParentReferences(sourceFile); } + syntaxCursor = undefined; return sourceFile; function setContextFlag(val, flag) { if (val) { @@ -4599,6 +4815,11 @@ var ts; } return undefined; } + function parseTokenNode() { + var node = createNode(token); + nextToken(); + return finishNode(node); + } function canParseSemicolon() { if (token === 22) { return true; @@ -4669,7 +4890,9 @@ var ts; return createIdentifier(isIdentifierOrKeyword()); } function isLiteralPropertyName() { - return isIdentifierOrKeyword() || token === 8 || token === 7; + return isIdentifierOrKeyword() || + token === 8 || + token === 7; } function parsePropertyName() { if (token === 8 || token === 7) { @@ -4681,7 +4904,7 @@ var ts; return parseIdentifierName(); } function parseComputedPropertyName() { - var node = createNode(122); + var node = createNode(124); parseExpected(18); var yieldContext = inYieldContext(); if (inGeneratorParameterContext()) { @@ -4747,7 +4970,6 @@ var ts; case 16: return isIdentifier(); case 12: - return token === 23 || isStartOfExpression(); case 14: return token === 23 || token === 21 || isStartOfExpression(); case 15: @@ -4765,7 +4987,8 @@ var ts; return isIdentifier(); } function isNotHeritageClauseTypeName() { - if (token === 101 || token === 78) { + if (token === 101 || + token === 78) { return lookAhead(nextTokenIsIdentifier); } return false; @@ -4810,7 +5033,7 @@ var ts; if (canParseSemicolon()) { return true; } - if (token === 85) { + if (isInOrOfKeyword(token)) { return true; } if (token === 32) { @@ -4860,8 +5083,8 @@ var ts; parsingContext = saveParsingContext; return result; } - function parseListElement(kind, parseElement) { - var node = currentNode(kind); + function parseListElement(parsingContext, parseElement) { + var node = currentNode(parsingContext); if (node) { return consumeNode(node); } @@ -4930,45 +5153,27 @@ var ts; function isReusableModuleElement(node) { if (node) { switch (node.kind) { - case 197: - case 198: - case 191: - case 192: - case 195: + case 200: + case 201: case 194: - case 190: - case 171: - case 170: - case 174: - case 173: - case 185: - case 181: - case 183: - case 180: - case 179: - case 178: - case 177: - case 176: - case 182: - case 172: - case 186: - case 184: - case 175: - case 187: + case 195: + case 198: + case 197: return true; } + return isReusableStatement(node); } return false; } function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 129: - case 134: - case 128: - case 130: case 131: - case 126: + case 136: + case 130: + case 132: + case 133: + case 128: return true; } } @@ -4977,8 +5182,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 200: - case 201: + case 203: + case 204: return true; } } @@ -4987,55 +5192,60 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 190: - case 171: - case 170: - case 174: + case 193: case 173: - case 185: - case 181: + case 172: + case 176: + case 175: + case 188: + case 184: + case 186: case 183: + case 182: case 180: + case 181: case 179: case 178: - case 177: - case 176: - case 182: - case 172: - case 186: - case 184: - case 175: + case 185: + case 174: + case 189: case 187: + case 177: + case 190: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 206; + return node.kind === 209; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 133: + case 135: + case 129: + case 136: case 127: case 134: - case 125: - case 132: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 188) { + if (node.kind !== 191) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - return node.kind === 124; + if (node.kind !== 126) { + return false; + } + var parameter = node; + return parameter.initializer === undefined; } function abortParsingListOrMoveToNextToken(kind) { parseErrorAtCurrentToken(parsingContextErrors(kind)); @@ -5045,7 +5255,7 @@ var ts; nextToken(); return false; } - function parseDelimitedList(kind, parseElement) { + function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimeter) { var saveParsingContext = parsingContext; parsingContext |= 1 << kind; var result = []; @@ -5063,6 +5273,9 @@ var ts; break; } parseExpected(23); + if (considerSemicolonAsDelimeter && token === 22 && !scanner.hasPrecedingLineBreak()) { + nextToken(); + } continue; } if (isListTerminator(kind)) { @@ -5097,7 +5310,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(20)) { - var node = createNode(121, entity.pos); + var node = createNode(123, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -5113,13 +5326,8 @@ var ts; } return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } - function parseTokenNode() { - var node = createNode(token); - nextToken(); - return finishNode(node); - } function parseTemplateExpression() { - var template = createNode(165); + var template = createNode(167); template.head = parseLiteralNode(); ts.Debug.assert(template.head.kind === 11, "Template head has wrong token kind"); var templateSpans = []; @@ -5132,7 +5340,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(169); + var span = createNode(171); span.expression = allowInAnd(parseExpression); var literal; if (token === 15) { @@ -5161,7 +5369,7 @@ var ts; return node; } function parseTypeReference() { - var node = createNode(135); + var node = createNode(137); node.typeName = parseEntityName(false, ts.Diagnostics.Type_expected); if (!scanner.hasPrecedingLineBreak() && token === 24) { node.typeArguments = parseBracketedList(17, parseType, 24, 25); @@ -5169,13 +5377,13 @@ var ts; return finishNode(node); } function parseTypeQuery() { - var node = createNode(138); + var node = createNode(140); parseExpected(96); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(123); + var node = createNode(125); node.name = parseIdentifier(); if (parseOptional(78)) { if (isStartOfType() || !isStartOfExpression()) { @@ -5208,7 +5416,7 @@ var ts; } } function parseParameter() { - var node = createNode(124); + var node = createNode(126); setModifiers(node, parseModifiers()); node.dotDotDotToken = parseOptionalToken(21); node.name = inGeneratorParameterContext() ? doInYieldContext(parseIdentifierOrPattern) : parseIdentifierOrPattern(); @@ -5259,7 +5467,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 133) { + if (kind === 135) { parseExpected(87); } fillSignature(51, false, false, node); @@ -5300,7 +5508,7 @@ var ts; } function parseIndexSignatureDeclaration(modifiers) { var fullStart = modifiers ? modifiers.pos : scanner.getStartPos(); - var node = createNode(134, fullStart); + var node = createNode(136, fullStart); setModifiers(node, modifiers); node.parameters = parseBracketedList(15, parseParameter, 18, 19); node.type = parseTypeAnnotation(); @@ -5312,7 +5520,7 @@ var ts; var name = parsePropertyName(); var questionToken = parseOptionalToken(50); if (token === 16 || token === 24) { - var method = createNode(127, fullStart); + var method = createNode(129, fullStart); method.name = name; method.questionToken = questionToken; fillSignature(51, false, false, method); @@ -5320,7 +5528,7 @@ var ts; return finishNode(method); } else { - var property = createNode(125, fullStart); + var property = createNode(127, fullStart); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); @@ -5352,18 +5560,22 @@ var ts; } function isTypeMemberWithLiteralPropertyName() { nextToken(); - return token === 16 || token === 24 || token === 50 || token === 51 || canParseSemicolon(); + return token === 16 || + token === 24 || + token === 50 || + token === 51 || + canParseSemicolon(); } function parseTypeMember() { switch (token) { case 16: case 24: - return parseSignatureMember(132); + return parseSignatureMember(134); case 18: return isIndexSignature() ? parseIndexSignatureDeclaration(undefined) : parsePropertyOrMethodSignature(); case 87: if (lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(133); + return parseSignatureMember(135); } case 8: case 7: @@ -5389,7 +5601,7 @@ var ts; return token === 16 || token === 24; } function parseTypeLiteral() { - var node = createNode(139); + var node = createNode(141); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -5405,12 +5617,12 @@ var ts; return members; } function parseTupleType() { - var node = createNode(141); + var node = createNode(143); node.elementTypes = parseBracketedList(18, parseType, 18, 19); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(143); + var node = createNode(145); parseExpected(16); node.type = parseType(); parseExpected(17); @@ -5418,7 +5630,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 137) { + if (kind === 139) { parseExpected(87); } fillSignature(32, false, false, node); @@ -5434,6 +5646,7 @@ var ts; case 119: case 117: case 111: + case 120: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); case 98: @@ -5456,6 +5669,7 @@ var ts; case 119: case 117: case 111: + case 120: case 98: case 96: case 14: @@ -5477,7 +5691,7 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(18)) { parseExpected(19); - var node = createNode(140, type.pos); + var node = createNode(142, type.pos); node.elementType = type; type = finishNode(node); } @@ -5492,7 +5706,7 @@ var ts; types.push(parseArrayTypeOrHigher()); } types.end = getNodeEnd(); - var node = createNode(142, type.pos); + var node = createNode(144, type.pos); node.types = types; type = finishNode(node); } @@ -5511,7 +5725,9 @@ var ts; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 51 || token === 23 || token === 50 || token === 52 || isIdentifier() || ts.isModifier(token)) { + if (token === 51 || token === 23 || + token === 50 || token === 52 || + isIdentifier() || ts.isModifier(token)) { return true; } if (token === 17) { @@ -5535,10 +5751,10 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(136); + return parseFunctionOrConstructorType(138); } if (token === 87) { - return parseFunctionOrConstructorType(137); + return parseFunctionOrConstructorType(139); } return parseUnionTypeOrHigher(); } @@ -5588,8 +5804,9 @@ var ts; } function parseExpression() { var expr = parseAssignmentExpressionOrHigher(); - while (parseOptional(23)) { - expr = makeBinaryExpression(expr, 23, parseAssignmentExpressionOrHigher()); + var operatorToken; + while ((operatorToken = parseOptionalToken(23))) { + expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher()); } return expr; } @@ -5615,9 +5832,7 @@ var ts; return parseSimpleArrowFunctionExpression(expr); } if (isLeftHandSideExpression(expr) && isAssignmentOperator(reScanGreaterToken())) { - var operator = token; - nextToken(); - return makeBinaryExpression(expr, operator, parseAssignmentExpressionOrHigher()); + return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher()); } return parseConditionalExpressionRest(expr); } @@ -5638,9 +5853,10 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(166); + var node = createNode(168); nextToken(); - if (!scanner.hasPrecedingLineBreak() && (token === 35 || isStartOfExpression())) { + if (!scanner.hasPrecedingLineBreak() && + (token === 35 || isStartOfExpression())) { node.asteriskToken = parseOptionalToken(35); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); @@ -5651,8 +5867,8 @@ var ts; } function parseSimpleArrowFunctionExpression(identifier) { ts.Debug.assert(token === 32, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(157, identifier.pos); - var parameter = createNode(124, identifier.pos); + var node = createNode(159, identifier.pos); + var parameter = createNode(126, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; @@ -5726,7 +5942,7 @@ var ts; return parseParenthesizedArrowFunctionExpressionHead(false); } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(157); + var node = createNode(159); fillSignature(51, false, !allowAmbiguity, node); if (!node.parameters) { return undefined; @@ -5749,7 +5965,7 @@ var ts; if (!parseOptional(50)) { return leftOperand; } - var node = createNode(164, leftOperand.pos); + var node = createNode(166, leftOperand.pos); node.condition = leftOperand; node.whenTrue = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(51); @@ -5760,6 +5976,9 @@ var ts; var leftOperand = parseUnaryExpressionOrHigher(); return parseBinaryExpressionRest(precedence, leftOperand); } + function isInOrOfKeyword(t) { + return t === 85 || t === 122; + } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { reScanGreaterToken(); @@ -5770,9 +5989,7 @@ var ts; if (token === 85 && inDisallowInContext()) { break; } - var operator = token; - nextToken(); - leftOperand = makeBinaryExpression(leftOperand, operator, parseBinaryExpressionOrHigher(newPrecedence)); + leftOperand = makeBinaryExpression(leftOperand, parseTokenNode(), parseBinaryExpressionOrHigher(newPrecedence)); } return leftOperand; } @@ -5820,34 +6037,34 @@ var ts; } return -1; } - function makeBinaryExpression(left, operator, right) { - var node = createNode(163, left.pos); + function makeBinaryExpression(left, operatorToken, right) { + var node = createNode(165, left.pos); node.left = left; - node.operator = operator; + node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(161); + var node = createNode(163); node.operator = token; nextToken(); node.operand = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(158); + var node = createNode(160); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(159); + var node = createNode(161); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(160); + var node = createNode(162); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); @@ -5877,7 +6094,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(isLeftHandSideExpression(expression)); if ((token === 38 || token === 39) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(162, expression.pos); + var node = createNode(164, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -5898,14 +6115,14 @@ var ts; if (token === 16 || token === 20) { return expression; } - var node = createNode(149, expression.pos); + var node = createNode(151, expression.pos); node.expression = expression; parseExpected(20, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(true); return finishNode(node); } function parseTypeAssertion() { - var node = createNode(154); + var node = createNode(156); parseExpected(24); node.type = parseType(); parseExpected(25); @@ -5916,14 +6133,14 @@ var ts; while (true) { var dotOrBracketStart = scanner.getTokenPos(); if (parseOptional(20)) { - var propertyAccess = createNode(149, expression.pos); + var propertyAccess = createNode(151, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); continue; } if (parseOptional(18)) { - var indexedAccess = createNode(150, expression.pos); + var indexedAccess = createNode(152, expression.pos); indexedAccess.expression = expression; if (token !== 19) { indexedAccess.argumentExpression = allowInAnd(parseExpression); @@ -5937,7 +6154,7 @@ var ts; continue; } if (token === 10 || token === 11) { - var tagExpression = createNode(153, expression.pos); + var tagExpression = createNode(155, expression.pos); tagExpression.tag = expression; tagExpression.template = token === 10 ? parseLiteralNode() : parseTemplateExpression(); expression = finishNode(tagExpression); @@ -5954,7 +6171,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(151, expression.pos); + var callExpr = createNode(153, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -5962,7 +6179,7 @@ var ts; continue; } else if (token === 16) { - var callExpr = createNode(151, expression.pos); + var callExpr = createNode(153, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -6047,42 +6264,39 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(155); + var node = createNode(157); parseExpected(16); node.expression = allowInAnd(parseExpression); parseExpected(17); return finishNode(node); } - function parseAssignmentExpressionOrOmittedExpression() { - return token === 23 ? createNode(168) : parseAssignmentExpressionOrHigher(); - } function parseSpreadElement() { - var node = createNode(167); + var node = createNode(169); parseExpected(21); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } - function parseArrayLiteralElement() { - return token === 21 ? parseSpreadElement() : parseAssignmentExpressionOrOmittedExpression(); + function parseArgumentOrArrayLiteralElement() { + return token === 21 ? parseSpreadElement() : token === 23 ? createNode(170) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { - return allowInAnd(parseAssignmentExpressionOrOmittedExpression); + return allowInAnd(parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(147); + var node = createNode(149); parseExpected(18); if (scanner.hasPrecedingLineBreak()) node.flags |= 256; - node.elements = parseDelimitedList(14, parseArrayLiteralElement); + node.elements = parseDelimitedList(14, parseArgumentOrArrayLiteralElement); parseExpected(19); return finishNode(node); } function tryParseAccessorDeclaration(fullStart, modifiers) { if (parseContextualModifier(114)) { - return parseAccessorDeclaration(130, fullStart, modifiers); + return parseAccessorDeclaration(132, fullStart, modifiers); } else if (parseContextualModifier(118)) { - return parseAccessorDeclaration(131, fullStart, modifiers); + return parseAccessorDeclaration(133, fullStart, modifiers); } return undefined; } @@ -6102,13 +6316,13 @@ var ts; return parseMethodDeclaration(fullStart, modifiers, asteriskToken, propertyName, questionToken); } if ((token === 23 || token === 15) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(205, fullStart); + var shorthandDeclaration = createNode(208, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(204, fullStart); + var propertyAssignment = createNode(207, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(51); @@ -6117,17 +6331,17 @@ var ts; } } function parseObjectLiteralExpression() { - var node = createNode(148); + var node = createNode(150); parseExpected(14); if (scanner.hasPrecedingLineBreak()) { node.flags |= 256; } - node.properties = parseDelimitedList(13, parseObjectLiteralElement); + node.properties = parseDelimitedList(13, parseObjectLiteralElement, true); parseExpected(15); return finishNode(node); } function parseFunctionExpression() { - var node = createNode(156); + var node = createNode(158); parseExpected(82); node.asteriskToken = parseOptionalToken(35); node.name = node.asteriskToken ? doInYieldContext(parseOptionalIdentifier) : parseOptionalIdentifier(); @@ -6139,7 +6353,7 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(152); + var node = createNode(154); parseExpected(87); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); @@ -6149,7 +6363,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, checkForStrictMode, diagnosticMessage) { - var node = createNode(170); + var node = createNode(172); if (parseExpected(14, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(2, checkForStrictMode, parseStatement); parseExpected(15); @@ -6167,12 +6381,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(172); + var node = createNode(174); parseExpected(22); return finishNode(node); } function parseIfStatement() { - var node = createNode(174); + var node = createNode(176); parseExpected(83); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -6182,7 +6396,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(175); + var node = createNode(177); parseExpected(74); node.statement = parseStatement(); parseExpected(99); @@ -6193,7 +6407,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(176); + var node = createNode(178); parseExpected(99); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -6201,7 +6415,7 @@ var ts; node.statement = parseStatement(); return finishNode(node); } - function parseForOrForInStatement() { + function parseForOrForInOrForOfStatement() { var pos = getNodePos(); parseExpected(81); parseExpected(16); @@ -6214,16 +6428,23 @@ var ts; initializer = disallowInAnd(parseExpression); } } - var forOrForInStatement; + var forOrForInOrForOfStatement; if (parseOptional(85)) { - var forInStatement = createNode(178, pos); + var forInStatement = createNode(180, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(17); - forOrForInStatement = forInStatement; + forOrForInOrForOfStatement = forInStatement; + } + else if (parseOptional(122)) { + var forOfStatement = createNode(181, pos); + forOfStatement.initializer = initializer; + forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); + parseExpected(17); + forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(177, pos); + var forStatement = createNode(179, pos); forStatement.initializer = initializer; parseExpected(22); if (token !== 22 && token !== 17) { @@ -6234,14 +6455,14 @@ var ts; forStatement.iterator = allowInAnd(parseExpression); } parseExpected(17); - forOrForInStatement = forStatement; + forOrForInOrForOfStatement = forStatement; } - forOrForInStatement.statement = parseStatement(); - return finishNode(forOrForInStatement); + forOrForInOrForOfStatement.statement = parseStatement(); + return finishNode(forOrForInOrForOfStatement); } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 180 ? 65 : 70); + parseExpected(kind === 183 ? 65 : 70); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -6249,7 +6470,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(181); + var node = createNode(184); parseExpected(89); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -6258,7 +6479,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(182); + var node = createNode(185); parseExpected(100); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -6267,7 +6488,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(200); + var node = createNode(203); parseExpected(66); node.expression = allowInAnd(parseExpression); parseExpected(51); @@ -6275,7 +6496,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(201); + var node = createNode(204); parseExpected(72); parseExpected(51); node.statements = parseList(4, false, parseStatement); @@ -6285,7 +6506,7 @@ var ts; return token === 66 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(183); + var node = createNode(186); parseExpected(91); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -6296,14 +6517,14 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(185); + var node = createNode(188); parseExpected(93); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(186); + var node = createNode(189); parseExpected(95); node.tryBlock = parseBlock(false, false); node.catchClause = token === 67 ? parseCatchClause() : undefined; @@ -6314,7 +6535,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(203); + var result = createNode(206); parseExpected(67); parseExpected(16); result.name = parseIdentifier(); @@ -6324,7 +6545,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(187); + var node = createNode(190); parseExpected(71); parseSemicolon(); return finishNode(node); @@ -6333,13 +6554,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 64 && parseOptional(51)) { - var labeledStatement = createNode(184, fullStart); + var labeledStatement = createNode(187, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(173, fullStart); + var expressionStatement = createNode(175, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); @@ -6381,7 +6602,7 @@ var ts; case 68: case 115: case 76: - case 120: + case 121: if (isDeclarationStart()) { return false; } @@ -6422,11 +6643,11 @@ var ts; case 99: return parseWhileStatement(); case 81: - return parseForOrForInStatement(); + return parseForOrForInOrForOfStatement(); case 70: - return parseBreakOrContinueStatement(179); + return parseBreakOrContinueStatement(182); case 65: - return parseBreakOrContinueStatement(180); + return parseBreakOrContinueStatement(183); case 89: return parseReturnStatement(); case 100: @@ -6486,16 +6707,16 @@ var ts; } function parseArrayBindingElement() { if (token === 23) { - return createNode(168); + return createNode(170); } - var node = createNode(146); + var node = createNode(148); node.dotDotDotToken = parseOptionalToken(21); node.name = parseIdentifierOrPattern(); node.initializer = parseInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(146); + var node = createNode(148); var id = parsePropertyName(); if (id.kind === 64 && token !== 51) { node.name = id; @@ -6509,14 +6730,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(144); + var node = createNode(146); parseExpected(14); node.elements = parseDelimitedList(10, parseObjectBindingElement); parseExpected(15); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(145); + var node = createNode(147); parseExpected(18); node.elements = parseDelimitedList(11, parseArrayBindingElement); parseExpected(19); @@ -6535,14 +6756,16 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(188); + var node = createNode(191); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); - node.initializer = parseInitializer(false); + if (!isInOrOfKeyword(token)) { + node.initializer = parseInitializer(false); + } return finishNode(node); } - function parseVariableDeclarationList(disallowIn) { - var node = createNode(189); + function parseVariableDeclarationList(inForStatementInitializer) { + var node = createNode(192); switch (token) { case 97: break; @@ -6556,21 +6779,29 @@ var ts; ts.Debug.fail(); } nextToken(); - var savedDisallowIn = inDisallowInContext(); - setDisallowInContext(disallowIn); - node.declarations = parseDelimitedList(9, parseVariableDeclaration); - setDisallowInContext(savedDisallowIn); + if (token === 122 && lookAhead(canFollowContextualOfKeyword)) { + node.declarations = createMissingList(); + } + else { + var savedDisallowIn = inDisallowInContext(); + setDisallowInContext(inForStatementInitializer); + node.declarations = parseDelimitedList(9, parseVariableDeclaration); + setDisallowInContext(savedDisallowIn); + } return finishNode(node); } + function canFollowContextualOfKeyword() { + return nextTokenIsIdentifier() && nextToken() === 17; + } function parseVariableStatement(fullStart, modifiers) { - var node = createNode(171, fullStart); + var node = createNode(173, fullStart); setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); parseSemicolon(); return finishNode(node); } function parseFunctionDeclaration(fullStart, modifiers) { - var node = createNode(190, fullStart); + var node = createNode(193, fullStart); setModifiers(node, modifiers); parseExpected(82); node.asteriskToken = parseOptionalToken(35); @@ -6580,7 +6811,7 @@ var ts; return finishNode(node); } function parseConstructorDeclaration(pos, modifiers) { - var node = createNode(129, pos); + var node = createNode(131, pos); setModifiers(node, modifiers); parseExpected(112); fillSignature(51, false, false, node); @@ -6588,7 +6819,7 @@ var ts; return finishNode(node); } function parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(128, fullStart); + var method = createNode(130, fullStart); setModifiers(method, modifiers); method.asteriskToken = asteriskToken; method.name = name; @@ -6605,7 +6836,7 @@ var ts; return parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); } else { - var property = createNode(126, fullStart); + var property = createNode(128, fullStart); setModifiers(property, modifiers); property.name = name; property.questionToken = questionToken; @@ -6694,13 +6925,17 @@ var ts; if (isIndexSignature()) { return parseIndexSignatureDeclaration(modifiers); } - if (isIdentifierOrKeyword() || token === 8 || token === 7 || token === 35 || token === 18) { + if (isIdentifierOrKeyword() || + token === 8 || + token === 7 || + token === 35 || + token === 18) { return parsePropertyOrMethodDeclaration(fullStart, modifiers); } ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassDeclaration(fullStart, modifiers) { - var node = createNode(191, fullStart); + var node = createNode(194, fullStart); setModifiers(node, modifiers); parseExpected(68); node.name = parseIdentifier(); @@ -6726,7 +6961,7 @@ var ts; } function parseHeritageClause() { if (token === 78 || token === 101) { - var node = createNode(202); + var node = createNode(205); node.token = token; nextToken(); node.types = parseDelimitedList(8, parseTypeReference); @@ -6741,7 +6976,7 @@ var ts; return parseList(6, false, parseClassElement); } function parseInterfaceDeclaration(fullStart, modifiers) { - var node = createNode(192, fullStart); + var node = createNode(195, fullStart); setModifiers(node, modifiers); parseExpected(102); node.name = parseIdentifier(); @@ -6751,9 +6986,9 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, modifiers) { - var node = createNode(193, fullStart); + var node = createNode(196, fullStart); setModifiers(node, modifiers); - parseExpected(120); + parseExpected(121); node.name = parseIdentifier(); parseExpected(52); node.type = parseType(); @@ -6761,13 +6996,13 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNode(206, scanner.getStartPos()); + var node = createNode(209, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, modifiers) { - var node = createNode(194, fullStart); + var node = createNode(197, fullStart); setModifiers(node, modifiers); parseExpected(76); node.name = parseIdentifier(); @@ -6781,7 +7016,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(196, scanner.getStartPos()); + var node = createNode(199, scanner.getStartPos()); if (parseExpected(14)) { node.statements = parseList(1, false, parseModuleElement); parseExpected(15); @@ -6792,7 +7027,7 @@ var ts; return finishNode(node); } function parseInternalModuleTail(fullStart, modifiers, flags) { - var node = createNode(195, fullStart); + var node = createNode(198, fullStart); setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); @@ -6800,7 +7035,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, modifiers) { - var node = createNode(195, fullStart); + var node = createNode(198, fullStart); setModifiers(node, modifiers); node.name = parseLiteralNode(true); node.body = parseModuleBlock(); @@ -6811,13 +7046,14 @@ var ts; return token === 8 ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); } function isExternalModuleReference() { - return token === 116 && lookAhead(nextTokenIsOpenParen); + return token === 116 && + lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { return nextToken() === 16; } function parseImportDeclaration(fullStart, modifiers) { - var node = createNode(197, fullStart); + var node = createNode(200, fullStart); setModifiers(node, modifiers); parseExpected(84); node.name = parseIdentifier(); @@ -6830,7 +7066,7 @@ var ts; return isExternalModuleReference() ? parseExternalModuleReference() : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(199); + var node = createNode(202); parseExpected(116); parseExpected(16); node.expression = parseExpression(); @@ -6841,7 +7077,7 @@ var ts; return finishNode(node); } function parseExportAssignmentTail(fullStart, modifiers) { - var node = createNode(198, fullStart); + var node = createNode(201, fullStart); setModifiers(node, modifiers); node.exportName = parseIdentifier(); parseSemicolon(); @@ -6862,7 +7098,7 @@ var ts; case 102: case 76: case 84: - case 120: + case 121: return lookAhead(nextTokenIsIdentifierOrKeyword); case 115: return lookAhead(nextTokenIsIdentifierOrKeywordOrStringLiteral); @@ -6915,7 +7151,7 @@ var ts; return parseClassDeclaration(fullStart, modifiers); case 102: return parseInterfaceDeclaration(fullStart, modifiers); - case 120: + case 121: return parseTypeAliasDeclaration(fullStart, modifiers); case 76: return parseEnumDeclaration(fullStart, modifiers); @@ -6975,10 +7211,17 @@ var ts; } amdModuleName = amdModuleNameMatchResult[2]; } - var amdDependencyRegEx = /^\/\/\/\s* 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -9745,7 +10025,7 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 129 || signature.declaration.kind === 133; + var isConstructor = signature.declaration.kind === 131 || signature.declaration.kind === 135; var type = createObjectType(32768 | 65536); type.members = emptySymbols; type.properties = emptyArray; @@ -9786,7 +10066,7 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 123).constraint); + type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 125).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -9834,13 +10114,13 @@ var ts; while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { currentNode = currentNode.parent; } - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 123; + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 125; return links.isIllegalTypeReferenceInConstraint; } function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { var typeParameterSymbol; function check(n) { - if (n.kind === 135 && n.typeName.kind === 64) { + if (n.kind === 137 && n.typeName.kind === 64) { var links = getNodeLinks(n); if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); @@ -9905,9 +10185,9 @@ var ts; for (var i = 0; i < declarations.length; i++) { var declaration = declarations[i]; switch (declaration.kind) { - case 191: - case 192: case 194: + case 195: + case 197: return declaration; } } @@ -9926,11 +10206,20 @@ var ts; } return type; } - function getGlobalSymbol(name) { - return resolveName(undefined, name, 793056, ts.Diagnostics.Cannot_find_global_type_0, name); + function getGlobalValueSymbol(name) { + return getGlobalSymbol(name, 107455, ts.Diagnostics.Cannot_find_global_value_0); + } + function getGlobalTypeSymbol(name) { + return getGlobalSymbol(name, 793056, ts.Diagnostics.Cannot_find_global_type_0); + } + function getGlobalSymbol(name, meaning, diagnostic) { + return resolveName(undefined, name, meaning, diagnostic, name); } function getGlobalType(name) { - return getTypeOfGlobalSymbol(getGlobalSymbol(name), 0); + return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), 0); + } + function getGlobalESSymbolConstructorSymbol() { + return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); } function createArrayType(elementType) { var arrayType = globalArrayType || getDeclaredTypeOfSymbol(globalArraySymbol); @@ -10079,28 +10368,30 @@ var ts; return numberType; case 111: return booleanType; + case 120: + return esSymbolType; case 98: return voidType; case 8: return getTypeFromStringLiteral(node); - case 135: - return getTypeFromTypeReferenceNode(node); - case 138: - return getTypeFromTypeQueryNode(node); - case 140: - return getTypeFromArrayTypeNode(node); - case 141: - return getTypeFromTupleTypeNode(node); - case 142: - return getTypeFromUnionTypeNode(node); - case 143: - return getTypeFromTypeNode(node.type); - case 136: case 137: + return getTypeFromTypeReferenceNode(node); + case 140: + return getTypeFromTypeQueryNode(node); + case 142: + return getTypeFromArrayTypeNode(node); + case 143: + return getTypeFromTupleTypeNode(node); + case 144: + return getTypeFromUnionTypeNode(node); + case 145: + return getTypeFromTypeNode(node.type); + case 138: case 139: + case 141: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 64: - case 121: + case 123: var symbol = getSymbolInfo(node); return symbol && getDeclaredTypeOfSymbol(symbol); default: @@ -10244,25 +10535,27 @@ var ts; return type; } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 128 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 156: - case 157: + case 158: + case 159: return isContextSensitiveFunctionLikeDeclaration(node); - case 148: + case 150: return ts.forEach(node.properties, isContextSensitive); - case 147: + case 149: return ts.forEach(node.elements, isContextSensitive); - case 164: - return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 163: - return node.operator === 49 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 204: + case 166: + return isContextSensitive(node.whenTrue) || + isContextSensitive(node.whenFalse); + case 165: + return node.operatorToken.kind === 49 && + (isContextSensitive(node.left) || isContextSensitive(node.right)); + case 207: return isContextSensitive(node.initializer); - case 128: - case 127: + case 130: + case 129: return isContextSensitiveFunctionLikeDeclaration(node); - case 155: + case 157: return isContextSensitive(node.expression); } return false; @@ -10407,7 +10700,8 @@ var ts; } var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { + if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && + (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { errorInfo = saveErrorInfo; return result; } @@ -10864,7 +11158,9 @@ var ts; if (source === target) { return -1; } - if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { + if (source.parameters.length !== target.parameters.length || + source.minArgumentCount !== target.minArgumentCount || + source.hasRestParameter !== target.hasRestParameter) { return 0; } var result = -1; @@ -10938,6 +11234,9 @@ var ts; function isArrayType(type) { return type.flags & 4096 && type.target === globalArrayType; } + function isArrayLikeType(type) { + return !(type.flags & (32 | 64)) && isTypeAssignableTo(type, anyArrayType); + } function isTupleLikeType(type) { return !!getPropertyOfType(type, "0"); } @@ -11015,20 +11314,20 @@ var ts; function reportImplicitAnyError(declaration, type) { var typeAsString = typeToString(getWidenedType(type)); switch (declaration.kind) { - case 126: - case 125: - var diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; - break; - case 124: - var diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; - break; - case 190: case 128: case 127: + var diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; + break; + case 126: + var diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; + break; + case 193: case 130: - case 131: - case 156: - case 157: + case 129: + case 132: + case 133: + case 158: + case 159: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -11161,7 +11460,8 @@ var ts; inferFromTypes(sourceTypes[i], target); } } - else if (source.flags & 48128 && (target.flags & (4096 | 8192) || (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { + else if (source.flags & 48128 && (target.flags & (4096 | 8192) || + (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { if (depth === 0) { sourceStack = []; @@ -11256,10 +11556,10 @@ var ts; function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 138: + case 140: return true; case 64: - case 121: + case 123: node = node.parent; continue; default: @@ -11296,9 +11596,9 @@ var ts; } return links.assignmentChecks[symbol.id] = isAssignedIn(node); function isAssignedInBinaryExpression(node) { - if (node.operator >= 52 && node.operator <= 63) { + if (node.operatorToken.kind >= 52 && node.operatorToken.kind <= 63) { var n = node.left; - while (n.kind === 155) { + while (n.kind === 157) { n = n.expression; } if (n.kind === 64 && getResolvedSymbol(n) === symbol) { @@ -11315,45 +11615,46 @@ var ts; } function isAssignedIn(node) { switch (node.kind) { - case 163: + case 165: return isAssignedInBinaryExpression(node); - case 188: - case 146: - return isAssignedInVariableDeclaration(node); - case 144: - case 145: - case 147: + case 191: case 148: + return isAssignedInVariableDeclaration(node); + case 146: + case 147: case 149: case 150: case 151: case 152: + case 153: case 154: - case 155: - case 161: - case 158: - case 159: + case 156: + case 157: + case 163: case 160: + case 161: case 162: case 164: - case 167: - case 170: - case 171: + case 166: + case 169: + case 172: case 173: - case 174: case 175: case 176: case 177: case 178: + case 179: + case 180: case 181: - case 182: - case 183: - case 200: - case 201: case 184: case 185: case 186: case 203: + case 204: + case 187: + case 188: + case 189: + case 206: return ts.forEachChild(node, isAssignedIn); } return false; @@ -11362,13 +11663,12 @@ var ts; function resolveLocation(node) { var containerNodes = []; for (var parent = node.parent; parent; parent = parent.parent) { - if ((ts.isExpression(parent) || ts.isObjectLiteralMethod(node)) && isContextSensitive(parent)) { + if ((ts.isExpression(parent) || ts.isObjectLiteralMethod(node)) && + isContextSensitive(parent)) { containerNodes.unshift(parent); } } - ts.forEach(containerNodes, function (node) { - getTypeOfNode(node); - }); + ts.forEach(containerNodes, function (node) { getTypeOfNode(node); }); } function getSymbolAtLocation(node) { resolveLocation(node); @@ -11390,34 +11690,34 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 174: + case 176: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } break; - case 164: + case 166: if (child !== node.condition) { narrowedType = narrowType(type, node.condition, child === node.whenTrue); } break; - case 163: + case 165: if (child === node.right) { - if (node.operator === 48) { + if (node.operatorToken.kind === 48) { narrowedType = narrowType(type, node.left, true); } - else if (node.operator === 49) { + else if (node.operatorToken.kind === 49) { narrowedType = narrowType(type, node.left, false); } } break; - case 207: - case 195: - case 190: - case 128: - case 127: + case 210: + case 198: + case 193: case 130: - case 131: case 129: + case 132: + case 133: + case 131: break loop; } if (narrowedType !== type) { @@ -11430,7 +11730,7 @@ var ts; } return type; function narrowTypeByEquality(type, expr, assumeTrue) { - if (expr.left.kind !== 159 || expr.right.kind !== 8) { + if (expr.left.kind !== 161 || expr.right.kind !== 8) { return type; } var left = expr.left; @@ -11439,12 +11739,12 @@ var ts; return type; } var typeInfo = primitiveTypeInfo[right.text]; - if (expr.operator === 31) { + if (expr.operatorToken.kind === 31) { assumeTrue = !assumeTrue; } if (assumeTrue) { if (!typeInfo) { - return removeTypesFromUnionType(type, 258 | 132 | 8, true); + return removeTypesFromUnionType(type, 258 | 132 | 8 | 1048576, true); } if (isTypeSubtypeOf(typeInfo.type, type)) { return typeInfo.type; @@ -11503,10 +11803,10 @@ var ts; } function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 155: + case 157: return narrowType(type, expr.expression, assumeTrue); - case 163: - var operator = expr.operator; + case 165: + var operator = expr.operatorToken.kind; if (operator === 30 || operator === 31) { return narrowTypeByEquality(type, expr, assumeTrue); } @@ -11520,7 +11820,7 @@ var ts; return narrowTypeByInstanceof(type, expr, assumeTrue); } break; - case 161: + case 163: if (expr.operator === 46) { return narrowType(type, expr.operand, !assumeTrue); } @@ -11536,19 +11836,21 @@ var ts; nodeLinks.importOnRightSide = undefined; getSymbolLinks(rightSide).referenced = true; ts.Debug.assert((rightSide.flags & 8388608) !== 0); - nodeLinks = getNodeLinks(ts.getDeclarationOfKind(rightSide, 197)); + nodeLinks = getNodeLinks(ts.getDeclarationOfKind(rightSide, 200)); } } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); - if (symbol === argumentsSymbol && ts.getContainingFunction(node).kind === 157) { + if (symbol === argumentsSymbol && ts.getContainingFunction(node).kind === 159) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression); } if (symbol.flags & 8388608) { var symbolLinks = getSymbolLinks(symbol); if (!symbolLinks.referenced) { var importOrExportAssignment = getLeftSideOfImportOrExportAssignment(node); - if (!importOrExportAssignment || (importOrExportAssignment.flags & 1) || (importOrExportAssignment.kind === 198)) { + if (!importOrExportAssignment || + (importOrExportAssignment.flags & 1) || + (importOrExportAssignment.kind === 201)) { symbolLinks.referenced = !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveImport(symbol)); } else { @@ -11558,7 +11860,7 @@ var ts; } } if (symbolLinks.referenced) { - markLinkedImportsAsReferenced(ts.getDeclarationOfKind(symbol, 197)); + markLinkedImportsAsReferenced(ts.getDeclarationOfKind(symbol, 200)); } } checkCollisionWithCapturedSuperVariable(node, node); @@ -11566,9 +11868,9 @@ var ts; return getNarrowedTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol), node); } function captureLexicalThis(node, container) { - var classNode = container.parent && container.parent.kind === 191 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 194 ? container.parent : undefined; getNodeLinks(node).flags |= 2; - if (container.kind === 126 || container.kind === 129) { + if (container.kind === 128 || container.kind === 131) { getNodeLinks(classNode).flags |= 4; } else { @@ -11578,36 +11880,36 @@ var ts; function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 157) { + if (container.kind === 159) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 195: + case 198: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); break; - case 194: + case 197: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 129: + case 131: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 126: - case 125: + case 128: + case 127: if (container.flags & 128) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 122: + case 124: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } - var classNode = container.parent && container.parent.kind === 191 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 194 ? container.parent : undefined; if (classNode) { var symbol = getSymbolOfNode(classNode); return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); @@ -11616,15 +11918,15 @@ var ts; } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 124) { + if (n.kind === 126) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 151 && node.parent.expression === node; - var enclosingClass = ts.getAncestor(node, 191); + var isCallExpression = node.parent.kind === 153 && node.parent.expression === node; + var enclosingClass = ts.getAncestor(node, 194); var baseClass; if (enclosingClass && ts.getClassBaseTypeNode(enclosingClass)) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); @@ -11638,20 +11940,31 @@ var ts; if (container) { var canUseSuperExpression = false; if (isCallExpression) { - canUseSuperExpression = container.kind === 129; + canUseSuperExpression = container.kind === 131; } else { var needToCaptureLexicalThis = false; - while (container && container.kind === 157) { + while (container && container.kind === 159) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = true; } - if (container && container.parent && container.parent.kind === 191) { + if (container && container.parent && container.parent.kind === 194) { if (container.flags & 128) { - canUseSuperExpression = container.kind === 128 || container.kind === 127 || container.kind === 130 || container.kind === 131; + canUseSuperExpression = + container.kind === 130 || + container.kind === 129 || + container.kind === 132 || + container.kind === 133; } else { - canUseSuperExpression = container.kind === 128 || container.kind === 127 || container.kind === 130 || container.kind === 131 || container.kind === 126 || container.kind === 125 || container.kind === 129; + canUseSuperExpression = + container.kind === 130 || + container.kind === 129 || + container.kind === 132 || + container.kind === 133 || + container.kind === 128 || + container.kind === 127 || + container.kind === 131; } } } @@ -11665,7 +11978,7 @@ var ts; getNodeLinks(node).flags |= 16; returnType = baseClass; } - if (container.kind === 129 && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 131 && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); returnType = unknownType; } @@ -11675,7 +11988,7 @@ var ts; return returnType; } } - if (container.kind === 122) { + if (container.kind === 124) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { @@ -11698,7 +12011,8 @@ var ts; if (indexOfParameter < len) { return getTypeAtPosition(contextualSignature, indexOfParameter); } - if (indexOfParameter === (func.parameters.length - 1) && funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { + if (indexOfParameter === (func.parameters.length - 1) && + funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]); } } @@ -11712,7 +12026,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 124) { + if (declaration.kind === 126) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -11727,7 +12041,7 @@ var ts; function getContextualTypeForReturnExpression(node) { var func = ts.getContainingFunction(node); if (func) { - if (func.type || func.kind === 129 || func.kind === 130 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(func.symbol, 131))) { + if (func.type || func.kind === 131 || func.kind === 132 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(func.symbol, 133))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(func)); } var signature = getContextualSignatureForFunctionLikeDeclaration(func); @@ -11747,14 +12061,14 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 153) { + if (template.parent.kind === 155) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; } function getContextualTypeForBinaryOperand(node) { var binaryExpression = node.parent; - var operator = binaryExpression.operator; + var operator = binaryExpression.operatorToken.kind; if (operator >= 52 && operator <= 63) { if (node === binaryExpression.right) { return checkExpression(binaryExpression.left); @@ -11825,7 +12139,8 @@ var ts; return propertyType; } } - return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || getIndexTypeOfContextualType(type, 0); + return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || + getIndexTypeOfContextualType(type, 0); } return undefined; } @@ -11851,32 +12166,32 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 188: - case 124: + case 191: case 126: - case 125: - case 146: + case 128: + case 127: + case 148: return getContextualTypeForInitializerExpression(node); - case 157: - case 181: + case 159: + case 184: return getContextualTypeForReturnExpression(node); - case 151: - case 152: - return getContextualTypeForArgument(parent, node); + case 153: case 154: + return getContextualTypeForArgument(parent, node); + case 156: return getTypeFromTypeNode(parent.type); - case 163: + case 165: return getContextualTypeForBinaryOperand(node); - case 204: + case 207: return getContextualTypeForObjectLiteralElement(parent); - case 147: + case 149: return getContextualTypeForElementExpression(node); - case 164: + case 166: return getContextualTypeForConditionalOperand(node); - case 169: - ts.Debug.assert(parent.parent.kind === 165); + case 171: + ts.Debug.assert(parent.parent.kind === 167); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 155: + case 157: return getContextualType(parent); } return undefined; @@ -11891,13 +12206,13 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 156 || node.kind === 157; + return node.kind === 158 || node.kind === 159; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) ? getContextualSignature(node) : undefined; } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 128 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); if (!type) { return undefined; @@ -11908,7 +12223,8 @@ var ts; var signatureList; var types = type.types; for (var i = 0; i < types.length; i++) { - if (signatureList && getSignaturesOfObjectOrUnionType(types[i], 0).length > 1) { + if (signatureList && + getSignaturesOfObjectOrUnionType(types[i], 0).length > 1) { return undefined; } var signature = getNonGenericSignature(types[i]); @@ -11937,20 +12253,20 @@ var ts; } function isAssignmentTarget(node) { var parent = node.parent; - if (parent.kind === 163 && parent.operator === 52 && parent.left === node) { + if (parent.kind === 165 && parent.operatorToken.kind === 52 && parent.left === node) { return true; } - if (parent.kind === 204) { + if (parent.kind === 207) { return isAssignmentTarget(parent.parent); } - if (parent.kind === 147) { + if (parent.kind === 149) { return isAssignmentTarget(parent); } return false; } function checkSpreadElementExpression(node, contextualMapper) { var type = checkExpressionCached(node.expression, contextualMapper); - if (!isTypeAssignableTo(type, anyArrayType)) { + if (!isArrayLikeType(type)) { error(node.expression, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(type)); return unknownType; } @@ -11965,7 +12281,7 @@ var ts; var elementTypes = []; ts.forEach(elements, function (e) { var type = checkExpression(e, contextualMapper); - if (e.kind === 167) { + if (e.kind === 169) { elementTypes.push(getIndexTypeOfType(type, 1) || anyType); hasSpreadElement = true; } @@ -11982,10 +12298,10 @@ var ts; return createArrayType(getUnionType(elementTypes)); } function isNumericName(name) { - return name.kind === 122 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 124 ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { - return isTypeOfKind(checkComputedPropertyName(name), 1 | 132); + return allConstituentTypesHaveKind(checkComputedPropertyName(name), 1 | 132); } function isNumericLiteralName(name) { return (+name).toString() === name; @@ -11994,8 +12310,11 @@ var ts; var links = getNodeLinks(node.expression); if (!links.resolvedType) { links.resolvedType = checkExpression(node.expression); - if (!isTypeOfKind(links.resolvedType, 1 | 132 | 258)) { - error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_or_any); + if (!allConstituentTypesHaveKind(links.resolvedType, 1 | 132 | 258 | 1048576)) { + error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); + } + else { + checkThatExpressionIsProperSymbolReference(node.expression, links.resolvedType, true); } } return links.resolvedType; @@ -12009,16 +12328,18 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 204 || memberDecl.kind === 205 || ts.isObjectLiteralMethod(memberDecl)) { - if (memberDecl.kind === 204) { + if (memberDecl.kind === 207 || + memberDecl.kind === 208 || + ts.isObjectLiteralMethod(memberDecl)) { + if (memberDecl.kind === 207) { var type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 128) { + else if (memberDecl.kind === 130) { var type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 205); - var type = memberDecl.name.kind === 122 ? unknownType : checkExpression(memberDecl.name, contextualMapper); + ts.Debug.assert(memberDecl.kind === 208); + var type = memberDecl.name.kind === 124 ? unknownType : checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); @@ -12032,7 +12353,7 @@ var ts; member = prop; } else { - ts.Debug.assert(memberDecl.kind === 130 || memberDecl.kind === 131); + ts.Debug.assert(memberDecl.kind === 132 || memberDecl.kind === 133); checkAccessorDeclaration(memberDecl); } if (!ts.hasDynamicName(memberDecl)) { @@ -12065,7 +12386,7 @@ var ts; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 126; + return s.valueDeclaration ? s.valueDeclaration.kind : 128; } function getDeclarationFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 16 | 128 : 0; @@ -12075,7 +12396,7 @@ var ts; if (!(flags & (32 | 64))) { return; } - var enclosingClassDeclaration = ts.getAncestor(node, 191); + var enclosingClassDeclaration = ts.getAncestor(node, 194); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; var declaringClass = getDeclaredTypeOfSymbol(prop.parent); if (flags & 32) { @@ -12122,7 +12443,7 @@ var ts; } getNodeLinks(node).resolvedSymbol = prop; if (prop.parent && prop.parent.flags & 32) { - if (left.kind === 90 && getDeclarationKindFromSymbol(prop) !== 128) { + if (left.kind === 90 && getDeclarationKindFromSymbol(prop) !== 130) { error(right, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); } else { @@ -12134,12 +12455,12 @@ var ts; return anyType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 149 ? node.expression : node.left; + var left = node.kind === 151 ? node.expression : node.left; var type = checkExpressionOrQualifiedName(left); if (type !== unknownType && type !== anyType) { var prop = getPropertyOfType(getWidenedType(type), propertyName); if (prop && prop.parent && prop.parent.flags & 32) { - if (left.kind === 90 && getDeclarationKindFromSymbol(prop) !== 128) { + if (left.kind === 90 && getDeclarationKindFromSymbol(prop) !== 130) { return false; } else { @@ -12154,7 +12475,7 @@ var ts; function checkIndexedAccess(node) { if (!node.argumentExpression) { var sourceFile = getSourceFile(node); - if (node.parent.kind === 152 && node.parent.expression === node) { + if (node.parent.kind === 154 && 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); @@ -12171,13 +12492,14 @@ var ts; return unknownType; } var isConstEnum = isConstEnumObjectType(objectType); - if (isConstEnum && (!node.argumentExpression || node.argumentExpression.kind !== 8)) { + if (isConstEnum && + (!node.argumentExpression || node.argumentExpression.kind !== 8)) { error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } if (node.argumentExpression) { - if (node.argumentExpression.kind === 8 || node.argumentExpression.kind === 7) { - var name = node.argumentExpression.text; + var name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (name !== undefined) { var prop = getPropertyOfType(objectType, name); if (prop) { getNodeLinks(node).resolvedSymbol = prop; @@ -12189,8 +12511,8 @@ var ts; } } } - if (isTypeOfKind(indexType, 1 | 258 | 132)) { - if (isTypeOfKind(indexType, 1 | 132)) { + if (allConstituentTypesHaveKind(indexType, 1 | 258 | 132 | 1048576)) { + if (allConstituentTypesHaveKind(indexType, 1 | 132)) { var numberIndexType = getIndexTypeOfType(objectType, 1); if (numberIndexType) { return numberIndexType; @@ -12205,11 +12527,51 @@ var ts; } return anyType; } - error(node, ts.Diagnostics.An_index_expression_argument_must_be_of_type_string_number_or_any); + error(node, ts.Diagnostics.An_index_expression_argument_must_be_of_type_string_number_symbol_or_any); return unknownType; } + function getPropertyNameForIndexedAccess(indexArgumentExpression, indexArgumentType) { + if (indexArgumentExpression.kind === 8 || indexArgumentExpression.kind === 7) { + return indexArgumentExpression.text; + } + if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, false)) { + var rightHandSideName = indexArgumentExpression.name.text; + return ts.getPropertyNameForKnownSymbolName(rightHandSideName); + } + return undefined; + } + function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) { + if (expressionType === unknownType) { + return false; + } + if (!ts.isWellKnownSymbolSyntactically(expression)) { + return false; + } + if ((expressionType.flags & 1048576) === 0) { + if (reportError) { + error(expression, ts.Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, ts.getTextOfNode(expression)); + } + return false; + } + var leftHandSide = expression.expression; + var leftHandSideSymbol = getResolvedSymbol(leftHandSide); + if (!leftHandSideSymbol) { + return false; + } + var globalESSymbol = getGlobalESSymbolConstructorSymbol(); + if (!globalESSymbol) { + return false; + } + if (leftHandSideSymbol !== globalESSymbol) { + if (reportError) { + error(leftHandSide, ts.Diagnostics.Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object); + } + return false; + } + return true; + } function resolveUntypedCall(node) { - if (node.kind === 153) { + if (node.kind === 155) { checkExpression(node.template); } else { @@ -12223,15 +12585,60 @@ var ts; resolveUntypedCall(node); return unknownSignature; } + function reorderCandidates(signatures, result) { + var lastParent; + var lastSymbol; + var cutoffIndex = 0; + var index; + var specializedIndex = -1; + var spliceIndex; + ts.Debug.assert(!result.length); + for (var i = 0; i < signatures.length; i++) { + var signature = signatures[i]; + var symbol = signature.declaration && getSymbolOfNode(signature.declaration); + var parent = signature.declaration && signature.declaration.parent; + if (!lastSymbol || symbol === lastSymbol) { + if (lastParent && parent === lastParent) { + index++; + } + else { + lastParent = parent; + index = cutoffIndex; + } + } + else { + index = cutoffIndex = result.length; + lastParent = parent; + } + lastSymbol = symbol; + if (signature.hasStringLiterals) { + specializedIndex++; + spliceIndex = specializedIndex; + cutoffIndex++; + } + else { + spliceIndex = index; + } + result.splice(spliceIndex, 0, signature); + } + } + function getSpreadArgumentIndex(args) { + for (var i = 0; i < args.length; i++) { + if (args[i].kind === 169) { + return i; + } + } + return -1; + } function hasCorrectArity(node, args, signature) { var adjustedArgCount; var typeArguments; var callIsIncomplete; - if (node.kind === 153) { + if (node.kind === 155) { var tagExpression = node; adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 165) { + if (tagExpression.template.kind === 167) { var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); @@ -12246,32 +12653,33 @@ var ts; else { var callExpression = node; if (!callExpression.arguments) { - ts.Debug.assert(callExpression.kind === 152); + ts.Debug.assert(callExpression.kind === 154); return signature.minArgumentCount === 0; } adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; callIsIncomplete = callExpression.arguments.end === callExpression.end; typeArguments = callExpression.typeArguments; } - ts.Debug.assert(adjustedArgCount !== undefined, "'adjustedArgCount' undefined"); - ts.Debug.assert(callIsIncomplete !== undefined, "'callIsIncomplete' undefined"); - return checkArity(adjustedArgCount, typeArguments, callIsIncomplete, signature); - function checkArity(adjustedArgCount, typeArguments, callIsIncomplete, signature) { - if (!signature.hasRestParameter && adjustedArgCount > signature.parameters.length) { - return false; - } - var hasRightNumberOfTypeArgs = !typeArguments || (signature.typeParameters && typeArguments.length === signature.typeParameters.length); - if (!hasRightNumberOfTypeArgs) { - return false; - } - var hasEnoughArguments = adjustedArgCount >= signature.minArgumentCount; - return callIsIncomplete || hasEnoughArguments; + var hasRightNumberOfTypeArgs = !typeArguments || + (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + if (!hasRightNumberOfTypeArgs) { + return false; } + var spreadArgIndex = getSpreadArgumentIndex(args); + if (spreadArgIndex >= 0) { + return signature.hasRestParameter && spreadArgIndex >= signature.parameters.length - 1; + } + if (!signature.hasRestParameter && adjustedArgCount > signature.parameters.length) { + return false; + } + var hasEnoughArguments = adjustedArgCount >= signature.minArgumentCount; + return callIsIncomplete || hasEnoughArguments; } function getSingleCallSignature(type) { if (type.flags & 48128) { var resolved = resolveObjectOrUnionTypeMembers(type); - if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && + resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { return resolved.callSignatures[0]; } } @@ -12289,25 +12697,25 @@ var ts; var context = createInferenceContext(typeParameters, false); var inferenceMapper = createInferenceMapper(context); for (var i = 0; i < args.length; i++) { - if (args[i].kind === 168) { - continue; + var arg = args[i]; + if (arg.kind !== 170) { + var paramType = getTypeAtPosition(signature, arg.kind === 169 ? -1 : i); + if (i === 0 && args[i].parent.kind === 155) { + var argType = globalTemplateStringsArrayType; + } + else { + var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; + var argType = checkExpressionWithContextualType(arg, paramType, mapper); + } + inferTypes(context, argType, paramType); } - var parameterType = getTypeAtPosition(signature, i); - if (i === 0 && args[i].parent.kind === 153) { - inferTypes(context, globalTemplateStringsArrayType, parameterType); - continue; - } - var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; - inferTypes(context, checkExpressionWithContextualType(args[i], parameterType, mapper), parameterType); } if (excludeArgument) { for (var i = 0; i < args.length; i++) { - if (args[i].kind === 168) { - continue; - } if (excludeArgument[i] === false) { - var parameterType = getTypeAtPosition(signature, i); - inferTypes(context, checkExpressionWithContextualType(args[i], parameterType, inferenceMapper), parameterType); + var arg = args[i]; + var paramType = getTypeAtPosition(signature, arg.kind === 169 ? -1 : i); + inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); } } } @@ -12339,30 +12747,22 @@ var ts; function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - var argType; - if (arg.kind === 168) { - continue; - } - var paramType = getTypeAtPosition(signature, i); - if (i === 0 && node.kind === 153) { - argType = globalTemplateStringsArrayType; - } - else { - argType = arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); - } - var isValidArgument = checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1); - if (!isValidArgument) { - return false; + if (arg.kind !== 170) { + var paramType = getTypeAtPosition(signature, arg.kind === 169 ? -1 : i); + var argType = i === 0 && node.kind === 155 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + if (!checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1)) { + return false; + } } } return true; } function getEffectiveCallArguments(node) { var args; - if (node.kind === 153) { + if (node.kind === 155) { var template = node.template; args = [template]; - if (template.kind === 165) { + if (template.kind === 167) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); @@ -12375,7 +12775,7 @@ var ts; } function getEffectiveTypeArguments(callExpression) { if (callExpression.expression.kind === 90) { - var containingClass = ts.getAncestor(callExpression, 191); + var containingClass = ts.getAncestor(callExpression, 194); var baseClassTypeNode = containingClass && ts.getClassBaseTypeNode(containingClass); return baseClassTypeNode && baseClassTypeNode.typeArguments; } @@ -12384,7 +12784,7 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray) { - var isTaggedTemplate = node.kind === 153; + var isTaggedTemplate = node.kind === 155; var typeArguments; if (!isTaggedTemplate) { typeArguments = getEffectiveTypeArguments(node); @@ -12393,7 +12793,7 @@ var ts; } } var candidates = candidatesOutArray || []; - collectCandidates(); + reorderCandidates(signatures, candidates); if (!candidates.length) { error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); return resolveErrorCall(node); @@ -12504,44 +12904,6 @@ var ts; } return undefined; } - function collectCandidates() { - var result = candidates; - var lastParent; - var lastSymbol; - var cutoffIndex = 0; - var index; - var specializedIndex = -1; - var spliceIndex; - ts.Debug.assert(!result.length); - for (var i = 0; i < signatures.length; i++) { - var signature = signatures[i]; - var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent = signature.declaration && signature.declaration.parent; - if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent === lastParent) { - index++; - } - else { - lastParent = parent; - index = cutoffIndex; - } - } - else { - index = cutoffIndex = result.length; - lastParent = parent; - } - lastSymbol = symbol; - if (signature.hasStringLiterals) { - specializedIndex++; - spliceIndex = specializedIndex; - cutoffIndex++; - } - else { - spliceIndex = index; - } - result.splice(spliceIndex, 0, signature); - } - } } function resolveCallExpression(node, candidatesOutArray) { if (node.expression.kind === 90) { @@ -12576,6 +12938,12 @@ var ts; return resolveCall(node, callSignatures, candidatesOutArray); } function resolveNewExpression(node, candidatesOutArray) { + if (node.arguments && languageVersion < 2) { + var spreadIndex = getSpreadArgumentIndex(node.arguments); + if (spreadIndex >= 0) { + error(node.arguments[spreadIndex], ts.Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher); + } + } var expressionType = checkExpression(node.expression); if (expressionType === anyType) { if (node.typeArguments) { @@ -12622,13 +12990,13 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - if (node.kind === 151) { + if (node.kind === 153) { links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); } - else if (node.kind === 152) { + else if (node.kind === 154) { links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); } - else if (node.kind === 153) { + else if (node.kind === 155) { links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); } else { @@ -12643,9 +13011,12 @@ var ts; if (node.expression.kind === 90) { return voidType; } - if (node.kind === 152) { + if (node.kind === 154) { var declaration = signature.declaration; - if (declaration && declaration.kind !== 129 && declaration.kind !== 133 && declaration.kind !== 137) { + if (declaration && + declaration.kind !== 131 && + declaration.kind !== 135 && + declaration.kind !== 139) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -12672,7 +13043,10 @@ var ts; return targetType; } function getTypeAtPosition(signature, pos) { - return signature.hasRestParameter ? pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + if (pos >= 0) { + return signature.hasRestParameter ? pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + } + return signature.hasRestParameter ? getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : anyArrayType; } function assignContextualParameterTypes(signature, context, mapper) { var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); @@ -12692,7 +13066,7 @@ var ts; if (!func.body) { return unknownType; } - if (func.body.kind !== 170) { + if (func.body.kind !== 172) { var type = checkExpressionCached(func.body, contextualMapper); } else { @@ -12730,7 +13104,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 185); + return (body.statements.length === 1) && (body.statements[0].kind === 188); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!produceDiagnostics) { @@ -12739,7 +13113,7 @@ var ts; if (returnType === voidType || returnType === anyType) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 170) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 172) { return; } var bodyBlock = func.body; @@ -12752,9 +13126,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 !== 128 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 156) { + if (!hasGrammarError && node.kind === 158) { checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); } if (contextualMapper === identityMapper && isContextSensitive(node)) { @@ -12782,19 +13156,19 @@ var ts; checkSignatureDeclaration(node); } } - if (produceDiagnostics && node.kind !== 128 && node.kind !== 127) { + if (produceDiagnostics && node.kind !== 130 && node.kind !== 129) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodBody(node) { - ts.Debug.assert(node.kind !== 128 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); if (node.type) { checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); } if (node.body) { - if (node.body.kind === 170) { + if (node.body.kind === 172) { checkSourceElement(node.body); } else { @@ -12807,7 +13181,7 @@ var ts; } } function checkArithmeticOperandType(operand, type, diagnostic) { - if (!isTypeOfKind(type, 1 | 132)) { + if (!allConstituentTypesHaveKind(type, 1 | 132)) { error(operand, diagnostic); return false; } @@ -12823,12 +13197,12 @@ var ts; case 64: var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; - case 149: + case 151: var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || (symbol.flags & ~8) !== 0; - case 150: + case 152: return true; - case 155: + case 157: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -12837,10 +13211,10 @@ var ts; function isConstVariableReference(n) { switch (n.kind) { case 64: - case 149: + case 151: var symbol = findSymbol(n); return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 4096) !== 0; - case 150: + case 152: var index = n.argumentExpression; var symbol = findSymbol(n.expression); if (symbol && index && index.kind === 8) { @@ -12849,7 +13223,7 @@ var ts; return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 4096) !== 0; } return false; - case 155: + case 157: return isConstVariableReference(n.expression); default: return false; @@ -12889,6 +13263,9 @@ var ts; case 33: case 34: case 47: + if (someConstituentTypeHasKind(operandType, 1048576)) { + error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); + } return numberType; case 46: return booleanType; @@ -12911,7 +13288,22 @@ var ts; } return numberType; } - function isTypeOfKind(type, kind) { + function someConstituentTypeHasKind(type, kind) { + if (type.flags & kind) { + return true; + } + if (type.flags & 16384) { + var types = type.types; + for (var i = 0; i < types.length; i++) { + if (types[i].flags & kind) { + return true; + } + } + return false; + } + return false; + } + function allConstituentTypesHaveKind(type, kind) { if (type.flags & kind) { return true; } @@ -12933,7 +13325,7 @@ var ts; return (symbol.flags & 128) !== 0; } function checkInstanceOfExpression(node, leftType, rightType) { - if (isTypeOfKind(leftType, 510)) { + if (allConstituentTypesHaveKind(leftType, 1049086)) { 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); } if (!(rightType.flags & 1 || isTypeSubtypeOf(rightType, globalFunctionType))) { @@ -12942,10 +13334,10 @@ var ts; return booleanType; } function checkInExpression(node, leftType, rightType) { - if (!isTypeOfKind(leftType, 1 | 258 | 132)) { - error(node.left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number); + if (!allConstituentTypesHaveKind(leftType, 1 | 258 | 132 | 1048576)) { + error(node.left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } - if (!isTypeOfKind(rightType, 1 | 48128 | 512)) { + if (!allConstituentTypesHaveKind(rightType, 1 | 48128 | 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); } return booleanType; @@ -12954,9 +13346,11 @@ var ts; var properties = node.properties; for (var i = 0; i < properties.length; i++) { var p = properties[i]; - if (p.kind === 204 || p.kind === 205) { + if (p.kind === 207 || p.kind === 208) { var name = p.name; - var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); + var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || + isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, 1) || + getIndexTypeOfType(sourceType, 0); if (type) { checkDestructuringAssignment(p.initializer || name, type); } @@ -12971,15 +13365,15 @@ var ts; return sourceType; } function checkArrayLiteralAssignment(node, sourceType, contextualMapper) { - if (!isTypeAssignableTo(sourceType, anyArrayType)) { + if (!isArrayLikeType(sourceType)) { error(node, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(sourceType)); return sourceType; } var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 168) { - if (e.kind !== 167) { + if (e.kind !== 170) { + if (e.kind !== 169) { var propName = "" + i; var type = sourceType.flags & 1 ? sourceType : isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : getIndexTypeOfType(sourceType, 1); if (type) { @@ -13002,14 +13396,14 @@ var ts; return sourceType; } function checkDestructuringAssignment(target, sourceType, contextualMapper) { - if (target.kind === 163 && target.operator === 52) { + if (target.kind === 165 && target.operatorToken.kind === 52) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 148) { + if (target.kind === 150) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 147) { + if (target.kind === 149) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); @@ -13022,11 +13416,11 @@ var ts; return sourceType; } function checkBinaryExpression(node, contextualMapper) { - if (ts.isLeftHandSideExpression(node.left) && ts.isAssignmentOperator(node.operator)) { + if (ts.isLeftHandSideExpression(node.left) && ts.isAssignmentOperator(node.operatorToken.kind)) { checkGrammarEvalOrArgumentsInStrictMode(node, node.left); } - var operator = node.operator; - if (operator === 52 && (node.left.kind === 148 || node.left.kind === 147)) { + var operator = node.operatorToken.kind; + if (operator === 52 && (node.left.kind === 150 || node.left.kind === 149)) { return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); } var leftType = checkExpression(node.left, contextualMapper); @@ -13057,8 +13451,10 @@ var ts; if (rightType.flags & (32 | 64)) rightType = leftType; var suggestedOperator; - if ((leftType.flags & 8) && (rightType.flags & 8) && (suggestedOperator = getSuggestedBooleanOperator(node.operator)) !== undefined) { - error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operator), ts.tokenToString(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)); } 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); @@ -13075,14 +13471,19 @@ var ts; if (rightType.flags & (32 | 64)) rightType = leftType; var resultType; - if (isTypeOfKind(leftType, 132) && isTypeOfKind(rightType, 132)) { + if (allConstituentTypesHaveKind(leftType, 132) && allConstituentTypesHaveKind(rightType, 132)) { resultType = numberType; } - else if (isTypeOfKind(leftType, 258) || isTypeOfKind(rightType, 258)) { - resultType = stringType; - } - else if (leftType.flags & 1 || rightType.flags & 1) { - resultType = anyType; + else { + if (allConstituentTypesHaveKind(leftType, 258) || allConstituentTypesHaveKind(rightType, 258)) { + resultType = stringType; + } + else if (leftType.flags & 1 || rightType.flags & 1) { + resultType = anyType; + } + if (resultType && !checkForDisallowedESSymbolOperand(operator)) { + return resultType; + } } if (!resultType) { reportOperatorError(); @@ -13092,14 +13493,17 @@ var ts; checkAssignmentOperator(resultType); } return resultType; - case 28: - case 29: - case 30: - case 31: case 24: case 25: case 26: case 27: + if (!checkForDisallowedESSymbolOperand(operator)) { + return booleanType; + } + case 28: + case 29: + case 30: + case 31: if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { reportOperatorError(); } @@ -13118,6 +13522,14 @@ var ts; case 23: return rightType; } + function checkForDisallowedESSymbolOperand(operator) { + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : someConstituentTypeHasKind(rightType, 1048576) ? node.right : undefined; + if (offendingSymbolOperand) { + error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); + return false; + } + return true; + } function getSuggestedBooleanOperator(operator) { switch (operator) { case 44: @@ -13142,7 +13554,7 @@ var ts; } } function reportOperatorError() { - error(node, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(node.operator), typeToString(leftType), typeToString(rightType)); + error(node, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(node.operatorToken.kind), typeToString(leftType), typeToString(rightType)); } } function checkYieldExpression(node) { @@ -13180,14 +13592,14 @@ var ts; return links.resolvedType; } function checkPropertyAssignment(node, contextualMapper) { - if (ts.hasDynamicName(node)) { + if (node.name.kind === 124) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); } function checkObjectLiteralMethod(node, contextualMapper) { checkGrammarMethod(node); - if (ts.hasDynamicName(node)) { + if (node.name.kind === 124) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -13213,7 +13625,7 @@ var ts; } function checkExpressionOrQualifiedName(node, contextualMapper) { var type; - if (node.kind == 121) { + if (node.kind == 123) { type = checkQualifiedName(node); } else { @@ -13221,7 +13633,9 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 149 && node.parent.expression === node) || (node.parent.kind === 150 && node.parent.expression === node) || ((node.kind === 64 || node.kind === 121) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 151 && node.parent.expression === node) || + (node.parent.kind === 152 && node.parent.expression === node) || + ((node.kind === 64 || node.kind === 123) && 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); } @@ -13247,52 +13661,52 @@ var ts; return booleanType; case 7: return checkNumericLiteral(node); - case 165: + case 167: return checkTemplateExpression(node); case 8: case 10: return stringType; case 9: return globalRegExpType; - case 147: - return checkArrayLiteral(node, contextualMapper); - case 148: - return checkObjectLiteral(node, contextualMapper); case 149: - return checkPropertyAccessExpression(node); + return checkArrayLiteral(node, contextualMapper); case 150: - return checkIndexedAccess(node); + return checkObjectLiteral(node, contextualMapper); case 151: + return checkPropertyAccessExpression(node); case 152: - return checkCallExpression(node); + return checkIndexedAccess(node); case 153: - return checkTaggedTemplateExpression(node); case 154: - return checkTypeAssertion(node); + return checkCallExpression(node); case 155: - return checkExpression(node.expression, contextualMapper); + return checkTaggedTemplateExpression(node); case 156: + return checkTypeAssertion(node); case 157: - return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 159: - return checkTypeOfExpression(node); + return checkExpression(node.expression, contextualMapper); case 158: - return checkDeleteExpression(node); - case 160: - return checkVoidExpression(node); + case 159: + return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); case 161: - return checkPrefixUnaryExpression(node); + return checkTypeOfExpression(node); + case 160: + return checkDeleteExpression(node); case 162: - return checkPostfixUnaryExpression(node); + return checkVoidExpression(node); case 163: - return checkBinaryExpression(node, contextualMapper); + return checkPrefixUnaryExpression(node); case 164: - return checkConditionalExpression(node, contextualMapper); - case 167: - return checkSpreadElementExpression(node, contextualMapper); - case 168: - return undefinedType; + return checkPostfixUnaryExpression(node); + case 165: + return checkBinaryExpression(node, contextualMapper); case 166: + return checkConditionalExpression(node, contextualMapper); + case 169: + return checkSpreadElementExpression(node, contextualMapper); + case 170: + return undefinedType; + case 168: checkYieldExpression(node); return unknownType; } @@ -13314,7 +13728,7 @@ var ts; var func = ts.getContainingFunction(node); if (node.flags & 112) { func = ts.getContainingFunction(node); - if (!(func.kind === 129 && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 131 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -13328,10 +13742,12 @@ var ts; } } function checkSignatureDeclaration(node) { - if (node.kind === 134) { + if (node.kind === 136) { checkGrammarIndexSignature(node); } - else if (node.kind === 136 || node.kind === 190 || node.kind === 137 || node.kind === 132 || node.kind === 129 || node.kind === 133) { + else if (node.kind === 138 || node.kind === 193 || node.kind === 139 || + node.kind === 134 || node.kind === 131 || + node.kind === 135) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -13343,10 +13759,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 133: + case 135: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 132: + case 134: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -13355,7 +13771,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 192) { + if (node.kind === 195) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -13391,7 +13807,7 @@ var ts; } } function checkPropertyDeclaration(node) { - checkGrammarModifiers(node) || checkGrammarProperty(node); + checkGrammarModifiers(node) || checkGrammarProperty(node) || checkGrammarComputedPropertyName(node.name); checkVariableLikeDeclaration(node); } function checkMethodDeclaration(node) { @@ -13414,17 +13830,17 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 151 && n.expression.kind === 90; + return n.kind === 153 && n.expression.kind === 90; } function containsSuperCall(n) { if (isSuperCallExpression(n)) { return true; } switch (n.kind) { - case 156: - case 190: - case 157: - case 148: return false; + case 158: + case 193: + case 159: + case 150: return false; default: return ts.forEachChild(n, containsSuperCall); } } @@ -13432,19 +13848,22 @@ var ts; if (n.kind === 92) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 156 && n.kind !== 190) { + else if (n.kind !== 158 && n.kind !== 193) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 126 && !(n.flags & 128) && !!n.initializer; + return n.kind === 128 && + !(n.flags & 128) && + !!n.initializer; } if (ts.getClassBaseTypeNode(node.parent)) { if (containsSuperCall(node.body)) { - var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); + var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || + ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); if (superCallShouldBeFirst) { var statements = node.body.statements; - if (!statements.length || statements[0].kind !== 173 || !isSuperCallExpression(statements[0].expression)) { + if (!statements.length || statements[0].kind !== 175 || !isSuperCallExpression(statements[0].expression)) { error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } else { @@ -13460,13 +13879,13 @@ var ts; function checkAccessorDeclaration(node) { if (produceDiagnostics) { checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); - if (node.kind === 130) { + if (node.kind === 132) { 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 === 130 ? 131 : 130; + var otherKind = node.kind === 132 ? 133 : 132; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & 112) !== (otherAccessor.flags & 112))) { @@ -13540,9 +13959,9 @@ var ts; return; } var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 192) { - ts.Debug.assert(signatureDeclarationNode.kind === 132 || signatureDeclarationNode.kind === 133); - var signatureKind = signatureDeclarationNode.kind === 132 ? 0 : 1; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 195) { + ts.Debug.assert(signatureDeclarationNode.kind === 134 || signatureDeclarationNode.kind === 135); + var signatureKind = signatureDeclarationNode.kind === 134 ? 0 : 1; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); var containingType = getDeclaredTypeOfSymbol(containingSymbol); signaturesToCheck = getSignaturesOfType(containingType, signatureKind); @@ -13560,7 +13979,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 192 && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 195 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; } @@ -13633,7 +14052,7 @@ var ts; if (subsequentNode.kind === node.kind) { var errorNode = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - ts.Debug.assert(node.kind === 128 || node.kind === 127); + ts.Debug.assert(node.kind === 130 || node.kind === 129); 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, diagnostic); @@ -13659,11 +14078,11 @@ var ts; for (var i = 0; i < declarations.length; i++) { var node = declarations[i]; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 192 || node.parent.kind === 139 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 195 || node.parent.kind === 141 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 190 || node.kind === 128 || node.kind === 127 || node.kind === 129) { + if (node.kind === 193 || node.kind === 130 || node.kind === 129 || node.kind === 131) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -13760,19 +14179,17 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 192: - return 2097152; case 195: + return 2097152; + case 198: return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 191: case 194: - return 2097152 | 1048576; case 197: + return 2097152 | 1048576; + case 200: var result = 0; var target = resolveImport(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { - result |= getDeclarationSpaces(d); - }); + ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); return result; default: return 1048576; @@ -13781,7 +14198,10 @@ var ts; } function checkFunctionDeclaration(node) { if (produceDiagnostics) { - checkFunctionLikeDeclaration(node) || checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); + checkFunctionLikeDeclaration(node) || + checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || + checkGrammarFunctionName(node.name) || + checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -13789,10 +14209,10 @@ var ts; } function checkFunctionLikeDeclaration(node) { checkSignatureDeclaration(node); - if (ts.hasDynamicName(node)) { + if (node.name.kind === 124) { checkComputedPropertyName(node.name); } - else { + if (!ts.hasDynamicName(node)) { var symbol = getSymbolOfNode(node); var localSymbol = node.localSymbol || symbol; var firstDeclaration = ts.getDeclarationOfKind(localSymbol, node.kind); @@ -13814,11 +14234,11 @@ var ts; } } function checkBlock(node) { - if (node.kind === 170) { - checkGrammarForStatementInAmbientContext(node); + if (node.kind === 172) { + checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 196) { + if (ts.isFunctionBlock(node) || node.kind === 199) { checkFunctionExpressionBodies(node); } } @@ -13836,14 +14256,19 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 126 || node.kind === 125 || node.kind === 128 || node.kind === 127 || node.kind === 130 || node.kind === 131) { + if (node.kind === 128 || + node.kind === 127 || + node.kind === 130 || + node.kind === 129 || + node.kind === 132 || + node.kind === 133) { return false; } if (ts.isInAmbientContext(node)) { return false; } var root = getRootDeclaration(node); - if (root.kind === 124 && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 126 && ts.nodeIsMissing(root.parent.body)) { return false; } return true; @@ -13873,7 +14298,7 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; } - var enclosingClass = ts.getAncestor(node, 191); + var enclosingClass = ts.getAncestor(node, 194); if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { return; } @@ -13891,35 +14316,47 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 195 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 198 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 207 && ts.isExternalModule(parent)) { + if (parent.kind === 210 && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } - function checkCollisionWithConstDeclarations(node) { + function checkVarDeclaredNamesNotShadowed(node) { if (node.initializer && (ts.getCombinedNodeFlags(node) & 6144) === 0) { var symbol = getSymbolOfNode(node); if (symbol.flags & 1) { var localDeclarationSymbol = resolveName(node, node.name.text, 3, undefined, undefined); - if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { - if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 4096) { - error(node, ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0, symbolToString(localDeclarationSymbol)); + if (localDeclarationSymbol && + localDeclarationSymbol !== symbol && + localDeclarationSymbol.flags & 2) { + if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 6144) { + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 192); + var container = varDeclList.parent.kind === 173 && + varDeclList.parent.parent; + var namesShareScope = container && + (container.kind === 172 && ts.isAnyFunction(container.parent) || + (container.kind === 199 && container.kind === 198) || + container.kind === 210); + if (!namesShareScope) { + var name = symbolToString(localDeclarationSymbol); + error(ts.getErrorSpanForNode(node), ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); + } } } } } } function isParameterDeclaration(node) { - while (node.kind === 146) { + while (node.kind === 148) { node = node.parent.parent; } - return node.kind === 124; + return node.kind === 126; } function checkParameterInitializer(node) { - if (getRootDeclaration(node).kind === 124) { + if (getRootDeclaration(node).kind === 126) { var func = ts.getContainingFunction(node); visit(node.initializer); } @@ -13927,7 +14364,7 @@ var ts; if (n.kind === 64) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 124) { + if (referencedSymbol.valueDeclaration.kind === 126) { if (referencedSymbol.valueDeclaration === node) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); return; @@ -13946,17 +14383,16 @@ var ts; } function checkVariableLikeDeclaration(node) { checkSourceElement(node.type); - if (ts.hasDynamicName(node)) { + if (node.name.kind === 124) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } - return; } if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && getRootDeclaration(node).kind === 124 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && getRootDeclaration(node).kind === 126 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -13984,9 +14420,11 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, undefined); } } - if (node.kind !== 126 && node.kind !== 125) { + if (node.kind !== 128 && node.kind !== 127) { checkExportsOnMergedDeclarations(node); - checkCollisionWithConstDeclarations(node); + if (node.kind === 191 || node.kind === 148) { + checkVarDeclaredNamesNotShadowed(node); + } checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -14013,40 +14451,40 @@ var ts; } function inBlockOrObjectLiteralExpression(node) { while (node) { - if (node.kind === 170 || node.kind === 148) { + if (node.kind === 172 || node.kind === 150) { return true; } node = node.parent; } } function checkExpressionStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); } function checkIfStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); checkSourceElement(node.elseStatement); } function checkDoStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkSourceElement(node.statement); checkExpression(node.expression); } function checkWhileStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.statement); } function checkForStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind == 189) { + if (!checkGrammarStatementInAmbientContext(node)) { + if (node.initializer && node.initializer.kind == 192) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 189) { + if (node.initializer.kind === 192) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -14059,31 +14497,22 @@ var ts; checkExpression(node.iterator); checkSourceElement(node.statement); } + function checkForOfStatement(node) { + checkGrammarForOfStatement(node); + } function checkForInStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { - if (node.initializer.kind === 189) { - var variableList = node.initializer; - if (!checkGrammarVariableDeclarationList(variableList)) { - if (variableList.declarations.length > 1) { - grammarErrorOnFirstToken(variableList.declarations[1], ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement); - } - } - } - } - if (node.initializer.kind === 189) { + checkGrammarForInOrForOfStatement(node); + if (node.initializer.kind === 192) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { var decl = variableDeclarationList.declarations[0]; checkVariableDeclaration(decl); - if (decl.type) { - error(decl, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation); - } } } else { var varExpr = node.initializer; var exprType = checkExpression(varExpr); - if (exprType !== anyType && exprType !== stringType) { + if (!allConstituentTypesHaveKind(exprType, 1 | 258)) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); } else { @@ -14091,19 +14520,19 @@ var ts; } } var exprType = checkExpression(node.expression); - if (!isTypeOfKind(exprType, 1 | 48128 | 512)) { + if (!allConstituentTypesHaveKind(exprType, 1 | 48128 | 512)) { error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } checkSourceElement(node.statement); } function checkBreakOrContinueStatement(node) { - checkGrammarForStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); + checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } function isGetAccessorWithAnnotatatedSetAccessor(node) { - return !!(node.kind === 130 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 131))); + return !!(node.kind === 132 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 133))); } function checkReturnStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { var functionBlock = ts.getContainingFunction(node); if (!functionBlock) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); @@ -14114,11 +14543,11 @@ var ts; if (func) { var returnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); var exprType = checkExpressionCached(node.expression); - if (func.kind === 131) { + if (func.kind === 133) { error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } else { - if (func.kind === 129) { + if (func.kind === 131) { if (!isTypeAssignableTo(exprType, returnType)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -14131,7 +14560,7 @@ var ts; } } function checkWithStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { if (node.parserContextFlags & 1) { grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); } @@ -14140,12 +14569,12 @@ var ts; error(node.expression, ts.Diagnostics.All_symbols_within_a_with_block_will_be_resolved_to_any); } function checkSwitchStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); var firstDefaultClause; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); ts.forEach(node.clauses, function (clause) { - if (clause.kind === 201 && !hasDuplicateDefaultClause) { + if (clause.kind === 204 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -14157,7 +14586,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 200) { + if (produceDiagnostics && clause.kind === 203) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -14168,13 +14597,13 @@ var ts; }); } function checkLabeledStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { var current = node.parent; while (current) { if (ts.isAnyFunction(current)) { break; } - if (current.kind === 184 && current.label.text === node.label.text) { + if (current.kind === 187 && 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; @@ -14185,7 +14614,7 @@ var ts; checkSourceElement(node.statement); } function checkThrowStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { if (node.expression === undefined) { grammarErrorAfterFirstToken(node, ts.Diagnostics.Line_break_not_permitted_here); } @@ -14195,7 +14624,7 @@ var ts; } } function checkTryStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkBlock(node.tryBlock); var catchClause = node.catchClause; if (catchClause) { @@ -14221,7 +14650,7 @@ var ts; checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0); checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1); }); - if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 191) { + if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 194) { var classDeclaration = type.symbol.valueDeclaration; for (var i = 0; i < classDeclaration.members.length; i++) { var member = classDeclaration.members[i]; @@ -14252,7 +14681,7 @@ var ts; return; } var errorNode; - if (prop.valueDeclaration.name.kind === 122 || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 124 || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -14274,6 +14703,7 @@ var ts; case "number": case "boolean": case "string": + case "symbol": case "void": error(name, message, name.text); } @@ -14392,7 +14822,7 @@ var ts; } } function isAccessor(kind) { - return kind === 130 || kind === 131; + return kind === 132 || kind === 133; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -14424,9 +14854,7 @@ var ts; return true; } var seen = {}; - ts.forEach(type.declaredProperties, function (p) { - seen[p.name] = { prop: p, containingType: type }; - }); + ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); var ok = true; for (var i = 0, len = type.baseTypes.length; i < len; ++i) { var base = type.baseTypes[i]; @@ -14443,7 +14871,7 @@ var ts; ok = false; var typeName1 = typeToString(existing.containingType); var typeName2 = typeToString(base); - var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_properties_0_of_types_1_and_2_are_not_identical, prop.name, typeName1, typeName2); + var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2); errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(typeNode, errorInfo)); } @@ -14459,7 +14887,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 192); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 195); 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); @@ -14495,7 +14923,7 @@ var ts; var ambient = ts.isInAmbientContext(node); var enumIsConst = ts.isConst(node); ts.forEach(node.members, function (member) { - if (member.name.kind !== 122 && isNumericLiteralName(member.name.text)) { + if (member.name.kind !== 124 && isNumericLiteralName(member.name.text)) { error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); } var initializer = member.initializer; @@ -14531,7 +14959,7 @@ var ts; return evalConstant(initializer); function evalConstant(e) { switch (e.kind) { - case 161: + case 163: var value = evalConstant(e.operand); if (value === undefined) { return undefined; @@ -14542,7 +14970,7 @@ var ts; case 47: return enumIsConst ? ~value : undefined; } return undefined; - case 163: + case 165: if (!enumIsConst) { return undefined; } @@ -14554,7 +14982,7 @@ var ts; if (right === undefined) { return undefined; } - switch (e.operator) { + switch (e.operatorToken.kind) { case 44: return left | right; case 43: return left & right; case 41: return left >> right; @@ -14570,11 +14998,11 @@ var ts; return undefined; case 7: return +e.text; - case 155: + case 157: return enumIsConst ? evalConstant(e.expression) : undefined; case 64: - case 150: - case 149: + case 152: + case 151: if (!enumIsConst) { return undefined; } @@ -14587,8 +15015,9 @@ var ts; propertyName = e.text; } else { - if (e.kind === 150) { - if (e.argumentExpression === undefined || e.argumentExpression.kind !== 8) { + if (e.kind === 152) { + if (e.argumentExpression === undefined || + e.argumentExpression.kind !== 8) { return undefined; } var enumType = getTypeOfNode(e.expression); @@ -14644,7 +15073,7 @@ var ts; } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 194) { + if (declaration.kind !== 197) { return false; } var enumDeclaration = declaration; @@ -14667,7 +15096,7 @@ var ts; var declarations = symbol.declarations; for (var i = 0; i < declarations.length; i++) { var declaration = declarations[i]; - if ((declaration.kind === 191 || (declaration.kind === 190 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { + if ((declaration.kind === 194 || (declaration.kind === 193 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } } @@ -14679,11 +15108,11 @@ var ts; if (!ts.isInAmbientContext(node) && node.name.kind === 8) { grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names); } - else if (node.name.kind === 64 && node.body.kind === 196) { + else if (node.name.kind === 64 && node.body.kind === 199) { var statements = node.body.statements; for (var i = 0, n = statements.length; i < n; i++) { var statement = statements[i]; - if (statement.kind === 198) { + if (statement.kind === 201) { grammarErrorOnNode(statement, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); } else if (ts.isExternalModuleImportDeclaration(statement)) { @@ -14719,7 +15148,7 @@ var ts; checkSourceElement(node.body); } function getFirstIdentifier(node) { - while (node.kind === 121) { + while (node.kind === 123) { node = node.left; } return node; @@ -14748,10 +15177,10 @@ var ts; } } else { - if (node.parent.kind === 207) { + if (node.parent.kind === 210) { target = resolveImport(symbol); } - else if (node.parent.kind === 196 && node.parent.parent.name.kind === 8) { + else if (node.parent.kind === 199 && node.parent.parent.name.kind === 8) { if (ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { if (isExternalModuleNameRelative(ts.getExternalModuleImportDeclarationExpression(node).text)) { error(node, ts.Diagnostics.Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name); @@ -14770,7 +15199,9 @@ var ts; } } if (target !== unknownSymbol) { - var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); + var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | + (symbol.flags & 793056 ? 793056 : 0) | + (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { error(node, ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0, symbolToString(symbol)); } @@ -14781,7 +15212,7 @@ var ts; grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } var container = node.parent; - if (container.kind !== 207) { + if (container.kind !== 210) { container = container.parent; } checkTypeOfExportAssignmentSymbol(getSymbolOfNode(container)); @@ -14790,156 +15221,156 @@ var ts; if (!node) return; switch (node.kind) { - case 123: - return checkTypeParameter(node); - case 124: - return checkParameter(node); - case 126: case 125: - return checkPropertyDeclaration(node); - case 136: - case 137: - case 132: - case 133: - return checkSignatureDeclaration(node); - case 134: - return checkSignatureDeclaration(node); + return checkTypeParameter(node); + case 126: + return checkParameter(node); case 128: case 127: - return checkMethodDeclaration(node); - case 129: - return checkConstructorDeclaration(node); - case 130: - case 131: - return checkAccessorDeclaration(node); - case 135: - return checkTypeReference(node); + return checkPropertyDeclaration(node); case 138: - return checkTypeQuery(node); case 139: - return checkTypeLiteral(node); + case 134: + case 135: + return checkSignatureDeclaration(node); + case 136: + return checkSignatureDeclaration(node); + case 130: + case 129: + return checkMethodDeclaration(node); + case 131: + return checkConstructorDeclaration(node); + case 132: + case 133: + return checkAccessorDeclaration(node); + case 137: + return checkTypeReference(node); case 140: - return checkArrayType(node); + return checkTypeQuery(node); case 141: - return checkTupleType(node); + return checkTypeLiteral(node); case 142: - return checkUnionType(node); + return checkArrayType(node); case 143: + return checkTupleType(node); + case 144: + return checkUnionType(node); + case 145: return checkSourceElement(node.type); - case 190: - return checkFunctionDeclaration(node); - case 170: - case 196: - return checkBlock(node); - case 171: - return checkVariableStatement(node); - case 173: - return checkExpressionStatement(node); - case 174: - return checkIfStatement(node); - case 175: - return checkDoStatement(node); - case 176: - return checkWhileStatement(node); - case 177: - return checkForStatement(node); - case 178: - return checkForInStatement(node); - case 179: - case 180: - return checkBreakOrContinueStatement(node); - case 181: - return checkReturnStatement(node); - case 182: - return checkWithStatement(node); - case 183: - return checkSwitchStatement(node); - case 184: - return checkLabeledStatement(node); - case 185: - return checkThrowStatement(node); - case 186: - return checkTryStatement(node); - case 188: - return checkVariableDeclaration(node); - case 146: - return checkBindingElement(node); - case 191: - return checkClassDeclaration(node); - case 192: - return checkInterfaceDeclaration(node); case 193: - return checkTypeAliasDeclaration(node); - case 194: - return checkEnumDeclaration(node); - case 195: - return checkModuleDeclaration(node); - case 197: - return checkImportDeclaration(node); - case 198: - return checkExportAssignment(node); + return checkFunctionDeclaration(node); case 172: - checkGrammarForStatementInAmbientContext(node); - return; + case 199: + return checkBlock(node); + case 173: + return checkVariableStatement(node); + case 175: + return checkExpressionStatement(node); + case 176: + return checkIfStatement(node); + case 177: + return checkDoStatement(node); + case 178: + return checkWhileStatement(node); + case 179: + return checkForStatement(node); + case 180: + return checkForInStatement(node); + case 181: + return checkForOfStatement(node); + case 182: + case 183: + return checkBreakOrContinueStatement(node); + case 184: + return checkReturnStatement(node); + case 185: + return checkWithStatement(node); + case 186: + return checkSwitchStatement(node); case 187: - checkGrammarForStatementInAmbientContext(node); + return checkLabeledStatement(node); + case 188: + return checkThrowStatement(node); + case 189: + return checkTryStatement(node); + case 191: + return checkVariableDeclaration(node); + case 148: + return checkBindingElement(node); + case 194: + return checkClassDeclaration(node); + case 195: + return checkInterfaceDeclaration(node); + case 196: + return checkTypeAliasDeclaration(node); + case 197: + return checkEnumDeclaration(node); + case 198: + return checkModuleDeclaration(node); + case 200: + return checkImportDeclaration(node); + case 201: + return checkExportAssignment(node); + case 174: + checkGrammarStatementInAmbientContext(node); + return; + case 190: + checkGrammarStatementInAmbientContext(node); return; } } function checkFunctionExpressionBodies(node) { switch (node.kind) { - case 156: - case 157: + case 158: + case 159: ts.forEach(node.parameters, checkFunctionExpressionBodies); checkFunctionExpressionOrObjectLiteralMethodBody(node); break; - case 128: - case 127: + case 130: + case 129: ts.forEach(node.parameters, checkFunctionExpressionBodies); if (ts.isObjectLiteralMethod(node)) { checkFunctionExpressionOrObjectLiteralMethodBody(node); } break; - case 129: - case 130: case 131: - case 190: + case 132: + case 133: + case 193: ts.forEach(node.parameters, checkFunctionExpressionBodies); break; - case 182: + case 185: checkFunctionExpressionBodies(node.expression); break; - case 124: case 126: - case 125: - case 144: - case 145: + case 128: + case 127: case 146: case 147: case 148: - case 204: case 149: case 150: + case 207: case 151: case 152: case 153: - case 165: - case 169: case 154: case 155: - case 159: - case 160: - case 158: + case 167: + case 171: + case 156: + case 157: case 161: case 162: + case 160: case 163: case 164: - case 167: - case 170: - case 196: - case 171: + case 165: + case 166: + case 169: + case 172: + case 199: case 173: - case 174: case 175: case 176: case 177: @@ -14947,19 +15378,22 @@ var ts; case 179: case 180: case 181: + case 182: case 183: - case 200: - case 201: case 184: - case 185: case 186: case 203: + case 204: + case 187: case 188: case 189: - case 191: - case 194: case 206: - case 207: + case 191: + case 192: + case 194: + case 197: + case 209: + case 210: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -14981,7 +15415,7 @@ var ts; var symbol = getExportAssignmentSymbol(node.symbol); if (symbol && symbol.flags & 8388608) { getSymbolLinks(symbol).referenced = true; - markLinkedImportsAsReferenced(ts.getDeclarationOfKind(symbol, 197)); + markLinkedImportsAsReferenced(ts.getDeclarationOfKind(symbol, 200)); } } if (potentialThisCollisions.length) { @@ -15015,7 +15449,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 182 && node.parent.statement === node) { + if (node.parent.kind === 185 && node.parent.statement === node) { return true; } node = node.parent; @@ -15051,27 +15485,27 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 207: + case 210: if (!ts.isExternalModule(location)) break; - case 195: + case 198: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 194: + case 197: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 191: - case 192: + case 194: + case 195: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } break; - case 156: + case 158: if (location.name) { copySymbol(location.symbol, meaning); } break; - case 203: + case 206: if (location.name.text) { copySymbol(location.symbol, meaning); } @@ -15084,26 +15518,28 @@ var ts; return ts.mapToArray(symbols); } function isTypeDeclarationName(name) { - return name.kind == 64 && isTypeDeclaration(name.parent) && name.parent.name === name; + return name.kind == 64 && + isTypeDeclaration(name.parent) && + name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { - case 123: - case 191: - case 192: - case 193: + case 125: case 194: + case 195: + case 196: + case 197: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 121) + while (node.parent && node.parent.kind === 123) node = node.parent; - return node.parent && node.parent.kind === 135; + return node.parent && node.parent.kind === 137; } function isTypeNode(node) { - if (135 <= node.kind && node.kind <= 143) { + if (137 <= node.kind && node.kind <= 145) { return true; } switch (node.kind) { @@ -15111,64 +15547,65 @@ var ts; case 117: case 119: case 111: + case 120: return true; case 98: - return node.parent.kind !== 160; + return node.parent.kind !== 162; case 8: - return node.parent.kind === 124; + return node.parent.kind === 126; case 64: - if (node.parent.kind === 121 && node.parent.right === node) { + if (node.parent.kind === 123 && node.parent.right === node) { node = node.parent; } - case 121: - ts.Debug.assert(node.kind === 64 || node.kind === 121, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); + case 123: + ts.Debug.assert(node.kind === 64 || node.kind === 123, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); var parent = node.parent; - if (parent.kind === 138) { + if (parent.kind === 140) { return false; } - if (135 <= parent.kind && parent.kind <= 143) { + if (137 <= parent.kind && parent.kind <= 145) { return true; } switch (parent.kind) { - case 123: - return node === parent.constraint; - case 126: case 125: - case 124: - case 188: - return node === parent.type; - case 190: - case 156: - case 157: - case 129: + return node === parent.constraint; case 128: case 127: - case 130: - case 131: + case 126: + case 191: return node === parent.type; + case 193: + case 158: + case 159: + case 131: + case 130: + case 129: case 132: case 133: + return node === parent.type; case 134: + case 135: + case 136: return node === parent.type; - case 154: + case 156: return node === parent.type; - case 151: - case 152: - return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; case 153: + case 154: + return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; + case 155: return false; } } return false; } function getLeftSideOfImportOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 121) { + while (nodeOnRightSide.parent.kind === 123) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 197) { + if (nodeOnRightSide.parent.kind === 200) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 198) { + if (nodeOnRightSide.parent.kind === 201) { return nodeOnRightSide.parent.exportName === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -15177,16 +15614,17 @@ var ts; return getLeftSideOfImportOrExportAssignment(node) !== undefined; } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 121 && node.parent.right === node) || (node.parent.kind === 149 && node.parent.name === node); + return (node.parent.kind === 123 && node.parent.right === node) || + (node.parent.kind === 151 && node.parent.name === node); } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 198) { + if (entityName.parent.kind === 201) { return resolveEntityName(entityName.parent.parent, entityName, 107455 | 793056 | 1536 | 8388608); } - if (entityName.kind !== 149) { + if (entityName.kind !== 151) { if (isInRightSideOfImportOrExportAssignment(entityName)) { return getSymbolOfPartOfRightHandSideOfImport(entityName); } @@ -15202,14 +15640,14 @@ var ts; var meaning = 107455 | 8388608; return resolveEntityName(entityName, entityName, meaning); } - else if (entityName.kind === 149) { + else if (entityName.kind === 151) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 121) { + else if (entityName.kind === 123) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -15218,7 +15656,7 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 135 ? 793056 : 1536; + var meaning = entityName.parent.kind === 137 ? 793056 : 1536; meaning |= 8388608; return resolveEntityName(entityName, entityName, meaning); } @@ -15232,12 +15670,12 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 64 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 198 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImport(node); + return node.parent.kind === 201 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImport(node); } switch (node.kind) { case 64: - case 149: - case 121: + case 151: + case 123: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 92: case 90: @@ -15245,18 +15683,19 @@ var ts; return type.symbol; case 112: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 129) { + if (constructorDeclaration && constructorDeclaration.kind === 131) { return constructorDeclaration.parent.symbol; } return undefined; case 8: - if (ts.isExternalModuleImportDeclaration(node.parent.parent) && ts.getExternalModuleImportDeclarationExpression(node.parent.parent) === node) { + if (ts.isExternalModuleImportDeclaration(node.parent.parent) && + ts.getExternalModuleImportDeclarationExpression(node.parent.parent) === node) { var importSymbol = getSymbolOfNode(node.parent.parent); var moduleType = getTypeOfSymbol(importSymbol); return moduleType ? moduleType.symbol : undefined; } case 7: - if (node.parent.kind == 150 && node.parent.argumentExpression === node) { + if (node.parent.kind == 152 && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -15270,7 +15709,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 205) { + if (location && location.kind === 208) { return resolveEntityName(location, location.name, 107455); } return undefined; @@ -15344,7 +15783,7 @@ var ts; return [symbol]; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 207; + return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 210; } function isNodeDescendentOf(node, ancestor) { while (node) { @@ -15362,7 +15801,7 @@ var ts; return false; } if (symbolWithRelevantName.flags & 8388608) { - var importDeclarationWithRelevantName = ts.getDeclarationOfKind(symbolWithRelevantName, 197); + var importDeclarationWithRelevantName = ts.getDeclarationOfKind(symbolWithRelevantName, 200); if (isReferencedImportDeclaration(importDeclarationWithRelevantName)) { return false; } @@ -15386,7 +15825,7 @@ var ts; function getLocalNameForSymbol(symbol, location) { var node = location; while (node) { - if ((node.kind === 195 || node.kind === 194) && getSymbolOfNode(node) === symbol) { + if ((node.kind === 198 || node.kind === 197) && getSymbolOfNode(node) === symbol) { return getLocalNameOfContainer(node); } node = node.parent; @@ -15410,7 +15849,7 @@ var ts; return symbol && symbolIsValue(symbol) && !isConstEnumSymbol(symbol) ? symbolToString(symbol) : undefined; } function isTopLevelValueImportWithEntityName(node) { - if (node.parent.kind !== 207 || !ts.isInternalModuleImportDeclaration(node)) { + if (node.parent.kind !== 210 || !ts.isInternalModuleImportDeclaration(node)) { return false; } return isImportResolvedToValue(getSymbolOfNode(node)); @@ -15436,7 +15875,8 @@ var ts; if (ts.nodeIsPresent(node.body)) { var symbol = getSymbolOfNode(node); var signaturesOfSymbol = getSignaturesOfSymbol(symbol); - return signaturesOfSymbol.length > 1 || (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); + return signaturesOfSymbol.length > 1 || + (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); } return false; } @@ -15448,14 +15888,14 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 206) { + if (node.kind === 209) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; if (symbol && (symbol.flags & 8)) { var declaration = symbol.valueDeclaration; var constantValue; - if (declaration.kind === 206) { + if (declaration.kind === 209) { return getEnumMemberValue(declaration); } } @@ -15504,7 +15944,7 @@ var ts; getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); getSymbolLinks(unknownSymbol).type = unknownType; globals[undefinedSymbol.name] = undefinedSymbol; - globalArraySymbol = getGlobalSymbol("Array"); + globalArraySymbol = getGlobalTypeSymbol("Array"); globalArrayType = getTypeOfGlobalSymbol(globalArraySymbol, 1); globalObjectType = getGlobalType("Object"); globalFunctionType = getGlobalType("Function"); @@ -15512,29 +15952,38 @@ var ts; globalNumberType = getGlobalType("Number"); globalBooleanType = getGlobalType("Boolean"); globalRegExpType = getGlobalType("RegExp"); - globalTemplateStringsArrayType = languageVersion >= 2 ? getGlobalType("TemplateStringsArray") : unknownType; + if (languageVersion >= 2) { + globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); + globalESSymbolType = getGlobalType("Symbol"); + globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); + } + else { + globalTemplateStringsArrayType = unknownType; + globalESSymbolType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + globalESSymbolConstructorSymbol = undefined; + } anyArrayType = createArrayType(anyType); } function checkGrammarModifiers(node) { switch (node.kind) { - case 130: + case 132: + case 133: case 131: - case 129: - case 126: - case 125: case 128: case 127: - case 134: - case 191: - case 192: - case 195: + case 130: + case 129: + case 136: case 194: + case 195: case 198: - case 171: - case 190: - case 193: case 197: - case 124: + case 201: + case 173: + case 193: + case 196: + case 200: + case 126: break; default: return false; @@ -15568,7 +16017,7 @@ var ts; else if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } - else if (node.parent.kind === 196 || node.parent.kind === 207) { + else if (node.parent.kind === 199 || node.parent.kind === 210) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } flags |= ts.modifierToFlag(modifier.kind); @@ -15577,10 +16026,10 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (node.parent.kind === 196 || node.parent.kind === 207) { + else if (node.parent.kind === 199 || node.parent.kind === 210) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } - else if (node.kind === 124) { + else if (node.kind === 126) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } flags |= 128; @@ -15593,10 +16042,10 @@ var ts; else if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (node.parent.kind === 191) { + else if (node.parent.kind === 194) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 124) { + else if (node.kind === 126) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1; @@ -15605,13 +16054,13 @@ var ts; if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (node.parent.kind === 191) { + else if (node.parent.kind === 194) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 124) { + else if (node.kind === 126) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 196) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 199) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -15619,7 +16068,7 @@ var ts; break; } } - if (node.kind === 129) { + if (node.kind === 131) { if (flags & 128) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -15630,13 +16079,13 @@ var ts; return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } } - else if (node.kind === 197 && flags & 2) { + else if (node.kind === 200 && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 192 && flags & 2) { + else if (node.kind === 195 && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); } - else if (node.kind === 124 && (flags & 112) && ts.isBindingPattern(node.name)) { + else if (node.kind === 126 && (flags & 112) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } } @@ -15704,25 +16153,25 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter); } } - else if (parameter.dotDotDotToken) { + if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter); } - else if (parameter.flags & 243) { + if (parameter.flags & 243) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); } - else if (parameter.questionToken) { + if (parameter.questionToken) { return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark); } - else if (parameter.initializer) { + if (parameter.initializer) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_initializer); } - else if (!parameter.type) { + if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - else if (parameter.type.kind !== 119 && parameter.type.kind !== 117) { + if (parameter.type.kind !== 119 && parameter.type.kind !== 117) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } - else if (!node.type) { + if (!node.type) { return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_a_type_annotation); } } @@ -15743,21 +16192,23 @@ var ts; } } function checkGrammarTypeArguments(node, typeArguments) { - return checkGrammarForDisallowedTrailingComma(typeArguments) || checkGrammarForAtLeastOneTypeArgument(node, typeArguments); + return checkGrammarForDisallowedTrailingComma(typeArguments) || + checkGrammarForAtLeastOneTypeArgument(node, typeArguments); } function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); for (var i = 0, n = arguments.length; i < n; i++) { var arg = arguments[i]; - if (arg.kind === 168) { + if (arg.kind === 170) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } } } function checkGrammarArguments(node, arguments) { - return checkGrammarForDisallowedTrailingComma(arguments) || checkGrammarForOmittedArgument(node, arguments); + return checkGrammarForDisallowedTrailingComma(arguments) || + checkGrammarForOmittedArgument(node, arguments); } function checkGrammarHeritageClause(node) { var types = node.types; @@ -15822,14 +16273,11 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 122) { + if (node.kind !== 124) { return false; } var computedPropertyName = node; - if (languageVersion < 2) { - return grammarErrorOnNode(node, ts.Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher); - } - else if (computedPropertyName.expression.kind === 163 && computedPropertyName.expression.operator === 23) { + if (computedPropertyName.expression.kind === 165 && computedPropertyName.expression.operatorToken.kind === 23) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } @@ -15856,25 +16304,26 @@ var ts; for (var i = 0, n = node.properties.length; i < n; i++) { var prop = node.properties[i]; var name = prop.name; - if (prop.kind === 168 || name.kind === 122) { + if (prop.kind === 170 || + name.kind === 124) { checkGrammarComputedPropertyName(name); continue; } var currentKind; - if (prop.kind === 204 || prop.kind === 205) { + if (prop.kind === 207 || prop.kind === 208) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === 7) { checkGrammarNumbericLiteral(name); } currentKind = Property; } - else if (prop.kind === 128) { + else if (prop.kind === 130) { currentKind = Property; } - else if (prop.kind === 130) { + else if (prop.kind === 132) { currentKind = GetAccessor; } - else if (prop.kind === 131) { + else if (prop.kind === 133) { currentKind = SetAccesor; } else { @@ -15904,6 +16353,37 @@ var ts; } } } + function checkGrammarForInOrForOfStatement(forInOrOfStatement) { + if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { + return true; + } + if (forInOrOfStatement.initializer.kind === 192) { + var variableList = forInOrOfStatement.initializer; + if (!checkGrammarVariableDeclarationList(variableList)) { + if (variableList.declarations.length > 1) { + var diagnostic = forInOrOfStatement.kind === 180 ? 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 === 180 ? 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 === 180 ? 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); + } + } + } + return false; + } + function checkGrammarForOfStatement(forOfStatement) { + return grammarErrorOnFirstToken(forOfStatement, ts.Diagnostics.for_of_statements_are_not_currently_supported); + if (languageVersion < 2) { + return grammarErrorOnFirstToken(forOfStatement, ts.Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher); + } + return checkGrammarForInOrForOfStatement(forOfStatement); + } function checkGrammarAccessor(accessor) { var kind = accessor.kind; if (languageVersion < 1) { @@ -15918,10 +16398,10 @@ var ts; else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 130 && accessor.parameters.length) { + else if (kind === 132 && accessor.parameters.length) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 131) { + else if (kind === 133) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -15945,16 +16425,18 @@ var ts; } } } - function checkGrammarForDisallowedComputedProperty(node, message) { - if (node.kind === 122) { + function checkGrammarForNonSymbolComputedProperty(node, message) { + if (node.kind === 124 && !ts.isWellKnownSymbolSyntactically(node.expression)) { return grammarErrorOnNode(node, message); } } function checkGrammarMethod(node) { - if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionLikeDeclaration(node) || checkGrammarForGenerator(node)) { + if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || + checkGrammarFunctionLikeDeclaration(node) || + checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 148) { + if (node.parent.kind === 150) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -15962,32 +16444,33 @@ var ts; return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } - if (node.parent.kind === 191) { + if (node.parent.kind === 194) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } if (ts.isInAmbientContext(node)) { - return checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_an_ambient_context); + return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol); } else if (!node.body) { - return checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_method_overloads); + 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 === 192) { - return checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_interfaces); + else if (node.parent.kind === 195) { + 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 === 139) { - return checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_type_literals); + else if (node.parent.kind === 141) { + 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 179: + case 180: + case 181: case 177: case 178: - case 175: - case 176: return true; - case 184: + case 187: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -15999,17 +16482,17 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 184: + case 187: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 179 && !isIterationStatement(current.statement, true); + var isMisplacedContinueLabel = node.kind === 182 && !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); } return false; } break; - case 183: - if (node.kind === 180 && !node.label) { + case 186: + if (node.kind === 183 && !node.label) { return false; } break; @@ -16022,11 +16505,11 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 180 ? 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; + var message = node.kind === 183 ? 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 === 180 ? 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; + var message = node.kind === 183 ? 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); } } @@ -16061,7 +16544,22 @@ var ts; } } } - return checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + var checkLetConstNames = languageVersion >= 2 && (ts.isLet(node) || ts.isConst(node)); + return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || + checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + } + function checkGrammarNameInLetOrConstDeclarations(name) { + if (name.kind === 64) { + if (name.text === "let") { + return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); + } + } + else { + var elements = name.elements; + for (var i = 0; i < elements.length; ++i) { + checkGrammarNameInLetOrConstDeclarations(elements[i].name); + } + } } function checkGrammarVariableDeclarationList(declarationList) { var declarations = declarationList.declarations; @@ -16082,14 +16580,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 174: - case 175: case 176: - case 182: case 177: case 178: + case 185: + case 179: + case 180: + case 181: return false; - case 184: + case 187: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -16105,7 +16604,7 @@ var ts; } } function isIntegerLiteral(expression) { - if (expression.kind === 161) { + if (expression.kind === 163) { var unaryExpression = expression; if (unaryExpression.operator === 33 || unaryExpression.operator === 34) { expression = unaryExpression.operand; @@ -16124,7 +16623,7 @@ var ts; var inAmbientContext = ts.isInAmbientContext(enumDecl); for (var i = 0, n = enumDecl.members.length; i < n; i++) { var node = enumDecl.members[i]; - if (node.name.kind === 122) { + if (node.name.kind === 124) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); } else if (inAmbientContext) { @@ -16192,18 +16691,19 @@ var ts; } } function checkGrammarProperty(node) { - if (node.parent.kind === 191) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_class_property_declarations)) { + if (node.parent.kind === 194) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || + checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 192) { - if (checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_interfaces)) { + else if (node.parent.kind === 195) { + 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 === 139) { - if (checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_type_literals)) { + else if (node.parent.kind === 141) { + if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } } @@ -16212,7 +16712,10 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 192 || node.kind === 197 || node.kind === 198 || (node.flags & 2)) { + if (node.kind === 195 || + node.kind === 200 || + node.kind === 201 || + (node.flags & 2)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -16220,7 +16723,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var i = 0, n = file.statements.length; i < n; i++) { var decl = file.statements[i]; - if (ts.isDeclaration(decl) || decl.kind === 171) { + if (ts.isDeclaration(decl) || decl.kind === 173) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -16230,7 +16733,7 @@ var ts; function checkGrammarSourceFile(node) { return ts.isInAmbientContext(node) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node); } - function checkGrammarForStatementInAmbientContext(node) { + function checkGrammarStatementInAmbientContext(node) { if (ts.isInAmbientContext(node)) { if (isAccessor(node.parent.kind)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = true; @@ -16239,7 +16742,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isAnyFunction(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 170 || node.parent.kind === 196 || node.parent.kind === 207) { + if (node.parent.kind === 172 || node.parent.kind === 199 || node.parent.kind === 210) { var links = getNodeLinks(node.parent); if (!links.hasReportedStatementInAmbientContext) { return links.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -16363,7 +16866,8 @@ var ts; return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line; } function emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments) { - if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && + getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { writer.writeLine(); } } @@ -16389,13 +16893,13 @@ var ts; function writeCommentRange(currentSourceFile, writer, comment, newLine) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { var firstCommentLineAndCharacter = ts.getLineAndCharacterOfPosition(currentSourceFile, comment.pos); - var lastLine = ts.getLineStarts(currentSourceFile).length; + var lineCount = ts.getLineStarts(currentSourceFile).length; var firstCommentLineIndent; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = currentLine === lastLine ? (comment.end + 1) : ts.getPositionFromLineAndCharacter(currentSourceFile, currentLine + 1, 1); + var nextLineStart = (currentLine + 1) === lineCount ? currentSourceFile.text.length + 1 : ts.getStartPositionOfLine(currentLine + 1, currentSourceFile); if (pos !== comment.pos) { if (firstCommentLineIndent === undefined) { - firstCommentLineIndent = calculateIndent(ts.getPositionFromLineAndCharacter(currentSourceFile, firstCommentLineAndCharacter.line, 1), comment.pos); + firstCommentLineIndent = calculateIndent(ts.getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); } var currentWriterIndentSpacing = writer.getIndent() * getIndentSize(); var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(pos, nextLineStart); @@ -16447,21 +16951,21 @@ var ts; } function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 129 && ts.nodeIsPresent(member.body)) { + if (member.kind === 131 && ts.nodeIsPresent(member.body)) { return member; } }); } - function getAllAccessorDeclarations(node, accessor) { + function getAllAccessorDeclarations(declarations, accessor) { var firstAccessor; var getAccessor; var setAccessor; - if (accessor.name.kind === 122) { + if (ts.hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 130) { + if (accessor.kind === 132) { getAccessor = accessor; } - else if (accessor.kind === 131) { + else if (accessor.kind === 133) { setAccessor = accessor; } else { @@ -16469,16 +16973,20 @@ var ts; } } else { - ts.forEach(node.members, function (member) { - if ((member.kind === 130 || member.kind === 131) && member.name.text === accessor.name.text && (member.flags & 128) === (accessor.flags & 128)) { - if (!firstAccessor) { - firstAccessor = member; - } - if (member.kind === 130 && !getAccessor) { - getAccessor = member; - } - if (member.kind === 131 && !setAccessor) { - setAccessor = member; + ts.forEach(declarations, function (member) { + if ((member.kind === 132 || member.kind === 133) && (member.flags & 128) === (accessor.flags & 128)) { + var memberName = ts.getPropertyNameForPropertyNameNode(member.name); + var accessorName = ts.getPropertyNameForPropertyNameNode(accessor.name); + if (memberName === accessorName) { + if (!firstAccessor) { + firstAccessor = member; + } + if (member.kind === 132 && !getAccessor) { + getAccessor = member; + } + if (member.kind === 133 && !setAccessor) { + setAccessor = member; + } } } }); @@ -16522,8 +17030,7 @@ var ts; var enclosingDeclaration; var currentSourceFile; var reportedDeclarationError = false; - var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { - } : writeJsDocComments; + var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; var aliasDeclarationEmitInfo = []; var referencePathsOutput = ""; @@ -16532,7 +17039,9 @@ var ts; var addedGlobalFileReference = false; ts.forEach(root.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); - if (referencedFile && ((referencedFile.flags & 1024) || shouldEmitToOwnFile(referencedFile, compilerOptions) || !addedGlobalFileReference)) { + if (referencedFile && ((referencedFile.flags & 1024) || + shouldEmitToOwnFile(referencedFile, compilerOptions) || + !addedGlobalFileReference)) { writeReferencePath(referencedFile); if (!isExternalModuleOrDeclarationFile(referencedFile)) { addedGlobalFileReference = true; @@ -16549,7 +17058,8 @@ var ts; if (!compilerOptions.noResolve) { ts.forEach(sourceFile.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && !ts.contains(emittedReferencedFiles, referencedFile))) { + if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && + !ts.contains(emittedReferencedFiles, referencedFile))) { writeReferencePath(referencedFile); emittedReferencedFiles.push(referencedFile); } @@ -16692,35 +17202,36 @@ var ts; case 119: case 117: case 111: + case 120: case 98: case 8: return writeTextOfNode(currentSourceFile, type); - case 135: - return emitTypeReference(type); - case 138: - return emitTypeQuery(type); - case 140: - return emitArrayType(type); - case 141: - return emitTupleType(type); - case 142: - return emitUnionType(type); - case 143: - return emitParenType(type); - case 136: case 137: - return emitSignatureDeclarationWithJsDocComments(type); + return emitTypeReference(type); + case 140: + return emitTypeQuery(type); + case 142: + return emitArrayType(type); + case 143: + return emitTupleType(type); + case 144: + return emitUnionType(type); + case 145: + return emitParenType(type); + case 138: case 139: + return emitSignatureDeclarationWithJsDocComments(type); + case 141: return emitTypeLiteral(type); case 64: return emitEntityName(type); - case 121: + case 123: return emitEntityName(type); default: ts.Debug.fail("Unknown type annotation: " + type.kind); } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 197 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 200 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); function writeEntityName(entityName) { @@ -16791,7 +17302,7 @@ var ts; if (node.flags & 1) { write("export "); } - if (node.kind !== 192) { + if (node.kind !== 195) { write("declare "); } } @@ -16851,7 +17362,7 @@ var ts; emitModuleElementDeclarationFlags(node); write("module "); writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 196) { + while (node.body.kind !== 199) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -16917,7 +17428,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 128 && (node.parent.flags & 32); + return node.parent.kind === 130 && (node.parent.flags & 32); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -16927,8 +17438,15 @@ var ts; writeTextOfNode(currentSourceFile, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 136 || node.parent.kind === 137 || (node.parent.parent && node.parent.parent.kind === 139)) { - ts.Debug.assert(node.parent.kind === 128 || node.parent.kind === 127 || node.parent.kind === 136 || node.parent.kind === 137 || node.parent.kind === 132 || node.parent.kind === 133); + if (node.parent.kind === 138 || + node.parent.kind === 139 || + (node.parent.parent && node.parent.parent.kind === 141)) { + ts.Debug.assert(node.parent.kind === 130 || + node.parent.kind === 129 || + node.parent.kind === 138 || + node.parent.kind === 139 || + node.parent.kind === 134 || + node.parent.kind === 135); emitType(node.constraint); } else { @@ -16938,31 +17456,31 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 191: + case 194: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 192: + case 195: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 133: + case 135: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 132: + case 134: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 128: - case 127: + case 130: + case 129: 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 === 191) { + else if (node.parent.parent.kind === 194) { 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 190: + case 193: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -16990,7 +17508,7 @@ var ts; emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 191) { + if (node.parent.parent.kind === 194) { 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; } else { @@ -17069,12 +17587,12 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 188 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 191 || resolver.isDeclarationVisible(node)) { writeTextOfNode(currentSourceFile, node.name); - if ((node.kind === 126 || node.kind === 125) && ts.hasQuestionToken(node)) { + if ((node.kind === 128 || node.kind === 127) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 126 || node.kind === 125) && node.parent.kind === 139) { + if ((node.kind === 128 || node.kind === 127) && node.parent.kind === 141) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.flags & 32)) { @@ -17083,14 +17601,14 @@ var ts; } function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.kind === 188) { + if (node.kind === 191) { diagnosticMessage = 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 === 126 || node.kind === 125) { + else if (node.kind === 128 || node.kind === 127) { if (node.flags & 128) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : 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 === 191) { + else if (node.parent.kind === 194) { diagnosticMessage = 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 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { @@ -17133,7 +17651,7 @@ var ts; if (ts.hasDynamicName(node)) { return; } - var accessors = getAllAccessorDeclarations(node.parent, node); + var accessors = getAllAccessorDeclarations(node.parent.members, node); if (node === accessors.firstAccessor) { emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); @@ -17143,7 +17661,7 @@ var ts; var accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { - var anotherAccessor = node.kind === 130 ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 132 ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -17156,12 +17674,12 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 130 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : undefined; + return accessor.kind === 132 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : undefined; } } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 131) { + if (accessorWithTypeAnnotation.kind === 133) { 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 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } @@ -17193,19 +17711,20 @@ var ts; if (ts.hasDynamicName(node)) { return; } - if ((node.kind !== 190 || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { + if ((node.kind !== 193 || resolver.isDeclarationVisible(node)) && + !resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 190) { + if (node.kind === 193) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 128) { + else if (node.kind === 130) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 190) { + if (node.kind === 193) { write("function "); writeTextOfNode(currentSourceFile, node.name); } - else if (node.kind === 129) { + else if (node.kind === 131) { write("constructor"); } else { @@ -17222,11 +17741,11 @@ var ts; emitSignatureDeclaration(node); } function emitSignatureDeclaration(node) { - if (node.kind === 133 || node.kind === 137) { + if (node.kind === 135 || node.kind === 139) { write("new "); } emitTypeParameters(node.typeParameters); - if (node.kind === 134) { + if (node.kind === 136) { write("["); } else { @@ -17235,20 +17754,20 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 134) { + if (node.kind === 136) { write("]"); } else { write(")"); } - var isFunctionTypeOrConstructorType = node.kind === 136 || node.kind === 137; - if (isFunctionTypeOrConstructorType || node.parent.kind === 139) { + var isFunctionTypeOrConstructorType = node.kind === 138 || node.kind === 139; + if (isFunctionTypeOrConstructorType || node.parent.kind === 141) { if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 129 && !(node.flags & 32)) { + else if (node.kind !== 131 && !(node.flags & 32)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -17259,28 +17778,28 @@ var ts; function getReturnTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.kind) { - case 133: + case 135: 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 132: + case 134: 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 134: + case 136: 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 128: - case 127: + case 130: + case 129: if (node.flags & 128) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : 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 === 191) { + else if (node.parent.kind === 194) { 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 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 190: + case 193: 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 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: @@ -17308,7 +17827,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 136 || node.parent.kind === 137 || node.parent.parent.kind === 139) { + if (node.parent.kind === 138 || + node.parent.kind === 139 || + node.parent.parent.kind === 141) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32)) { @@ -17317,28 +17838,28 @@ var ts; function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 129: + case 131: diagnosticMessage = 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; break; - case 133: + case 135: diagnosticMessage = 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; break; - case 132: + case 134: diagnosticMessage = 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; break; - case 128: - case 127: + case 130: + case 129: if (node.parent.flags & 128) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : 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 === 191) { + else if (node.parent.parent.kind === 194) { diagnosticMessage = 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 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? 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; } break; - case 190: + case 193: diagnosticMessage = 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 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -17353,40 +17874,40 @@ var ts; } function emitNode(node) { switch (node.kind) { + case 131: + case 193: + case 130: case 129: - case 190: + return emitFunctionDeclaration(node); + case 135: + case 134: + case 136: + return emitSignatureDeclarationWithJsDocComments(node); + case 132: + case 133: + return emitAccessorDeclaration(node); + case 173: + return emitVariableStatement(node); case 128: case 127: - return emitFunctionDeclaration(node); - case 133: - case 132: - case 134: - return emitSignatureDeclarationWithJsDocComments(node); - case 130: - case 131: - return emitAccessorDeclaration(node); - case 171: - return emitVariableStatement(node); - case 126: - case 125: return emitPropertyDeclaration(node); - case 192: - return emitInterfaceDeclaration(node); - case 191: - return emitClassDeclaration(node); - case 193: - return emitTypeAliasDeclaration(node); - case 206: - return emitEnumMemberDeclaration(node); - case 194: - return emitEnumDeclaration(node); case 195: - return emitModuleDeclaration(node); + return emitInterfaceDeclaration(node); + case 194: + return emitClassDeclaration(node); + case 196: + return emitTypeAliasDeclaration(node); + case 209: + return emitEnumMemberDeclaration(node); case 197: - return emitImportDeclaration(node); + return emitEnumDeclaration(node); case 198: + return emitModuleDeclaration(node); + case 200: + return emitImportDeclaration(node); + case 201: return emitExportAssignment(node); - case 207: + case 210: return emitSourceFile(node); } } @@ -17448,28 +17969,19 @@ var ts; var tempVariables; var tempParameters; var writeEmittedFiles = writeJavaScriptFile; - var emitLeadingComments = compilerOptions.removeComments ? function (node) { - } : emitLeadingDeclarationComments; - var emitTrailingComments = compilerOptions.removeComments ? function (node) { - } : emitTrailingDeclarationComments; - var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { - } : emitLeadingCommentsOfLocalPosition; + var emitLeadingComments = compilerOptions.removeComments ? function (node) { } : emitLeadingDeclarationComments; + var emitTrailingComments = compilerOptions.removeComments ? function (node) { } : emitTrailingDeclarationComments; + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfLocalPosition; var detachedCommentsInfo; - var emitDetachedComments = compilerOptions.removeComments ? function (node) { - } : emitDetachedCommentsAtPosition; - var emitPinnedOrTripleSlashComments = compilerOptions.removeComments ? function (node) { - } : emitPinnedOrTripleSlashCommentsOfNode; + var emitDetachedComments = compilerOptions.removeComments ? function (node) { } : emitDetachedCommentsAtPosition; + var emitPinnedOrTripleSlashComments = compilerOptions.removeComments ? function (node) { } : emitPinnedOrTripleSlashCommentsOfNode; var writeComment = writeCommentRange; var emit = emitNode; - var emitStart = function (node) { - }; - var emitEnd = function (node) { - }; + var emitStart = function (node) { }; + var emitEnd = function (node) { }; var emitToken = emitTokenText; - var scopeEmitStart = function (scopeDeclaration, scopeName) { - }; - var scopeEmitEnd = function () { - }; + var scopeEmitStart = function (scopeDeclaration, scopeName) { }; + var scopeEmitEnd = function () { }; var sourceMapData; if (compilerOptions.sourceMap) { initializeEmitterWithSourceMaps(); @@ -17557,9 +18069,16 @@ var ts; } 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)))) { + 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, @@ -17605,7 +18124,7 @@ var ts; var parentIndex = getSourceMapNameIndex(); if (parentIndex !== -1) { var name = node.name; - if (!name || name.kind !== 122) { + if (!name || name.kind !== 124) { scopeName = "." + scopeName; } scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; @@ -17622,10 +18141,18 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 190 || node.kind === 156 || node.kind === 128 || node.kind === 127 || node.kind === 130 || node.kind === 131 || node.kind === 195 || node.kind === 191 || node.kind === 194) { + else if (node.kind === 193 || + node.kind === 158 || + node.kind === 130 || + node.kind === 129 || + node.kind === 132 || + node.kind === 133 || + node.kind === 198 || + node.kind === 194 || + node.kind === 197) { if (node.name) { var name = node.name; - scopeName = name.kind === 122 ? ts.getTextOfNode(name) : node.name.text; + scopeName = name.kind === 124 ? ts.getTextOfNode(name) : node.name.text; } recordScopeNameStart(scopeName); } @@ -17705,7 +18232,7 @@ var ts; } function emitNodeWithMap(node) { if (node) { - if (node.kind != 207) { + if (node.kind != 210) { recordEmitNodeStartSpan(node); emitNode(node); recordEmitNodeEndSpan(node); @@ -17747,6 +18274,11 @@ var ts; } tempVariables.push(name); } + function createAndRecordTempVariable(location) { + var temp = createTempVariable(location, false); + recordTempDeclaration(temp); + return temp; + } function emitTempDeclarations(newLine) { if (tempVariables) { if (newLine) { @@ -17790,10 +18322,44 @@ var ts; write(","); } } - function emitList(nodes, start, count, multiLine, trailingComma) { - if (multiLine) { - increaseIndent(); + 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]); + } + var closeTokenIsOnSameLineAsLastElement = nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes)); + if (nodes.hasTrailingComma && allowTrailingComma) { + write(","); + } + decreaseIndent(); + if (closeTokenIsOnSameLineAsLastElement) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + } + function emitList(nodes, start, count, multiLine, trailingComma) { for (var i = 0; i < count; i++) { if (multiLine) { if (i) { @@ -17812,7 +18378,6 @@ var ts; write(","); } if (multiLine) { - decreaseIndent(); writeLine(); } } @@ -17821,11 +18386,6 @@ var ts; emitList(nodes, 0, nodes.length, false, false); } } - function emitMultiLineList(nodes) { - if (nodes) { - emitList(nodes, 0, nodes.length, true, false); - } - } function emitLines(nodes) { emitLinesStartingAt(nodes, 0); } @@ -17839,7 +18399,8 @@ var ts; if (text.length <= 0) { return false; } - if (text.charCodeAt(1) === 66 || text.charCodeAt(1) === 98 || text.charCodeAt(1) === 79 || text.charCodeAt(1) === 111) { + if (text.charCodeAt(1) === 66 || text.charCodeAt(1) === 98 || + text.charCodeAt(1) === 79 || text.charCodeAt(1) === 111) { return true; } return false; @@ -17875,7 +18436,7 @@ var ts; } for (var i = 0; i < node.templateSpans.length; i++) { var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 155 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; + var needsParens = templateSpan.expression.kind !== 157 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { write(" + "); } @@ -17894,11 +18455,11 @@ var ts; } function templateNeedsParens(template, parent) { switch (parent.kind) { - case 151: - case 152: - return parent.expression === template; case 153: + case 154: + return parent.expression === template; case 155: + case 157: return false; default: return comparePrecedenceToBinaryPlus(parent) !== -1; @@ -17906,8 +18467,8 @@ var ts; } function comparePrecedenceToBinaryPlus(expression) { switch (expression.kind) { - case 163: - switch (expression.operator) { + case 165: + switch (expression.operatorToken.kind) { case 35: case 36: case 37: @@ -17918,7 +18479,7 @@ var ts; default: return -1; } - case 164: + case 166: return -1; default: return 1; @@ -17930,10 +18491,11 @@ var ts; emit(span.literal); } function emitExpressionForPropertyName(node) { + ts.Debug.assert(node.kind !== 148); if (node.kind === 8) { emitLiteral(node); } - else if (node.kind === 122) { + else if (node.kind === 124) { emit(node.expression); } else { @@ -17950,33 +18512,33 @@ var ts; function isNotExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 124: - case 188: - case 146: case 126: - case 125: - case 204: - case 205: - case 206: + case 191: + case 148: case 128: case 127: - case 190: + case 207: + case 208: + case 209: case 130: - case 131: - case 156: - case 191: - case 192: + case 129: + case 193: + case 132: + case 133: + case 158: case 194: case 195: case 197: - return parent.name === node; - case 180: - case 179: case 198: + case 200: + return parent.name === node; + case 183: + case 182: + case 201: return false; - case 184: + case 187: return node.parent.label === node; - case 203: + case 206: return node.parent.name === node; } } @@ -18054,30 +18616,19 @@ var ts; function needsParenthesisForPropertyAccess(node) { switch (node.kind) { case 64: - case 147: case 149: - case 150: case 151: - case 155: + case 152: + case 153: + case 157: return false; } return true; } - function emitArrayLiteral(node) { - var elements = node.elements; - var length = elements.length; - if (length === 0) { - write("[]"); - return; - } - if (languageVersion >= 2) { - write("["); - emitList(elements, 0, elements.length, (node.flags & 256) !== 0, elements.hasTrailingComma); - write("]"); - return; - } + function emitListWithSpread(elements, multiLine, trailingComma) { var pos = 0; var group = 0; + var length = elements.length; while (pos < length) { if (group === 1) { write(".concat("); @@ -18086,18 +18637,24 @@ var ts; write(", "); } var e = elements[pos]; - if (e.kind === 167) { + if (e.kind === 169) { e = e.expression; emitParenthesized(e, group === 0 && needsParenthesisForPropertyAccess(e)); pos++; } else { var i = pos; - while (i < length && elements[i].kind !== 167) { + while (i < length && elements[i].kind !== 169) { i++; } write("["); - emitList(elements, pos, i - pos, (node.flags & 256) !== 0, elements.hasTrailingComma); + if (multiLine) { + increaseIndent(); + } + emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); + if (multiLine) { + decreaseIndent(); + } write("]"); pos = i; } @@ -18107,18 +18664,187 @@ var ts; write(")"); } } + function isSpreadElementExpression(node) { + return node.kind === 169; + } + 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, (node.flags & 256) !== 0, elements.hasTrailingComma); + } + } + function createSynthesizedNode(kind) { + var node = ts.createNode(kind); + node.pos = -1; + node.end = -1; + return node; + } + function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { + var parenthesizedObjectLiteral = createDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex); + return emit(parenthesizedObjectLiteral); + } + function createDownlevelObjectLiteralWithComputedProperties(originalObjectLiteral, firstComputedPropertyIndex) { + var tempVar = createAndRecordTempVariable(originalObjectLiteral); + var initialObjectLiteral = createSynthesizedNode(150); + initialObjectLiteral.properties = originalObjectLiteral.properties.slice(0, firstComputedPropertyIndex); + initialObjectLiteral.flags |= 256; + var propertyPatches = createBinaryExpression(tempVar, 52, initialObjectLiteral); + ts.forEach(originalObjectLiteral.properties, function (property) { + var patchedProperty = tryCreatePatchingPropertyAssignment(originalObjectLiteral, tempVar, property); + if (patchedProperty) { + propertyPatches = createBinaryExpression(propertyPatches, 23, patchedProperty); + } + }); + propertyPatches = createBinaryExpression(propertyPatches, 23, tempVar); + var result = createParenthesizedExpression(propertyPatches); + return result; + } + function addCommentsToSynthesizedNode(node, leadingCommentRanges, trailingCommentRanges) { + node.leadingCommentRanges = leadingCommentRanges; + node.trailingCommentRanges = trailingCommentRanges; + } + function tryCreatePatchingPropertyAssignment(objectLiteral, tempVar, property) { + var leftHandSide = createMemberAccessForPropertyName(tempVar, property.name); + var maybeRightHandSide = tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property); + return maybeRightHandSide && createBinaryExpression(leftHandSide, 52, maybeRightHandSide); + } + function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property) { + switch (property.kind) { + case 207: + return property.initializer; + case 208: + var prefix = createIdentifier(resolver.getExpressionNamePrefix(property.name)); + return createPropertyAccessExpression(prefix, property.name); + case 130: + return createFunctionExpression(property.parameters, property.body); + case 132: + case 133: + var _a = getAllAccessorDeclarations(objectLiteral.properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; + if (firstAccessor !== property) { + return undefined; + } + var propertyDescriptor = createSynthesizedNode(150); + var descriptorProperties = []; + if (getAccessor) { + var getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); + descriptorProperties.push(getProperty); + } + if (setAccessor) { + var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpression(setAccessor.parameters, setAccessor.body)); + descriptorProperties.push(setProperty); + } + var trueExpr = createSynthesizedNode(94); + var enumerableTrue = createPropertyAssignment(createIdentifier("enumerable"), trueExpr); + descriptorProperties.push(enumerableTrue); + var configurableTrue = createPropertyAssignment(createIdentifier("configurable"), trueExpr); + descriptorProperties.push(configurableTrue); + propertyDescriptor.properties = descriptorProperties; + var objectDotDefineProperty = createPropertyAccessExpression(createIdentifier("Object"), createIdentifier("defineProperty")); + return createCallExpression(objectDotDefineProperty, createNodeArray(propertyDescriptor)); + default: + ts.Debug.fail("ObjectLiteralElement kind " + property.kind + " not accounted for."); + } + } + function createParenthesizedExpression(expression) { + var result = createSynthesizedNode(157); + result.expression = expression; + return result; + } + function createNodeArray() { + var elements = []; + for (var _i = 0; _i < arguments.length; _i++) { + elements[_i - 0] = arguments[_i]; + } + var result = elements; + result.pos = -1; + result.end = -1; + return result; + } + function createBinaryExpression(left, operator, right) { + var result = createSynthesizedNode(165); + result.operatorToken = createSynthesizedNode(operator); + result.left = left; + result.right = right; + return result; + } + function createMemberAccessForPropertyName(expression, memberName) { + if (memberName.kind === 64) { + return createPropertyAccessExpression(expression, memberName); + } + else if (memberName.kind === 8 || memberName.kind === 7) { + return createElementAccessExpression(expression, memberName); + } + else if (memberName.kind === 124) { + return createElementAccessExpression(expression, memberName.expression); + } + else { + ts.Debug.fail("Kind '" + memberName.kind + "' not accounted for."); + } + } + function createPropertyAssignment(name, initializer) { + var result = createSynthesizedNode(207); + result.name = name; + result.initializer = initializer; + return result; + } + function createFunctionExpression(parameters, body) { + var result = createSynthesizedNode(158); + result.parameters = parameters; + result.body = body; + return result; + } + function createPropertyAccessExpression(expression, name) { + var result = createSynthesizedNode(151); + result.expression = expression; + result.name = name; + return result; + } + function createElementAccessExpression(expression, argumentExpression) { + var result = createSynthesizedNode(152); + result.expression = expression; + result.argumentExpression = argumentExpression; + return result; + } + function createIdentifier(name) { + var result = createSynthesizedNode(64); + result.text = name; + return result; + } + function createCallExpression(invokedExpression, arguments) { + var result = createSynthesizedNode(153); + result.expression = invokedExpression; + result.arguments = arguments; + return result; + } 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 === 124) { + numInitialNonComputedProperties = i; + break; + } + } + var hasComputedProperty = numInitialNonComputedProperties !== properties.length; + if (hasComputedProperty) { + emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); + return; + } + } write("{"); var properties = node.properties; if (properties.length) { - var multiLine = (node.flags & 256) !== 0; - if (!multiLine) { - write(" "); - } - emitList(properties, 0, properties.length, multiLine, properties.hasTrailingComma && languageVersion >= 1); - if (!multiLine) { - write(" "); - } + emitLinePreservingList(node, properties, languageVersion >= 1, true); } write("}"); } @@ -18141,7 +18867,7 @@ var ts; } function emitShorthandPropertyAssignment(node) { emit(node.name); - if (languageVersion < 2 || resolver.getExpressionNamePrefix(node.name)) { + if (languageVersion <= 1 || resolver.getExpressionNamePrefix(node.name)) { write(": "); emitExpressionIdentifier(node.name); } @@ -18151,7 +18877,7 @@ var ts; if (constantValue !== undefined) { write(constantValue.toString()); if (!compilerOptions.removeComments) { - var propertyName = node.kind === 149 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + var propertyName = node.kind === 151 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); write(" /* " + propertyName + " */"); } return true; @@ -18180,7 +18906,70 @@ var ts; emit(node.argumentExpression); write("]"); } + function hasSpreadElement(elements) { + return ts.forEach(elements, function (e) { return e.kind === 169; }); + } + function skipParentheses(node) { + while (node.kind === 157 || node.kind === 156) { + node = node.expression; + } + return node; + } + function emitCallTarget(node) { + if (node.kind === 64 || node.kind === 92 || node.kind === 90) { + emit(node); + return node; + } + var temp = createAndRecordTempVariable(node); + write("("); + emit(temp); + write(" = "); + emit(node); + write(")"); + return temp; + } + function emitCallWithSpread(node) { + var target; + var expr = skipParentheses(node.expression); + if (expr.kind === 151) { + target = emitCallTarget(expr.expression); + write("."); + emit(expr.name); + } + else if (expr.kind === 152) { + target = emitCallTarget(expr.expression); + write("["); + emit(expr.argumentExpression); + write("]"); + } + else if (expr.kind === 90) { + target = expr; + write("_super"); + } + else { + emit(node.expression); + } + write(".apply("); + if (target) { + if (target.kind === 90) { + emitThis(target); + } + else { + emit(target); + } + } + else { + write("void 0"); + } + write(", "); + emitListWithSpread(node.arguments, false, false); + write(")"); + } function emitCallExpression(node) { + if (languageVersion < 2 && hasSpreadElement(node.arguments)) { + emitCallWithSpread(node); + return; + } var superCall = false; if (node.expression.kind === 90) { write("_super"); @@ -18188,7 +18977,7 @@ var ts; } else { emit(node.expression); - superCall = node.expression.kind === 149 && node.expression.expression.kind === 90; + superCall = node.expression.kind === 151 && node.expression.expression.kind === 90; } if (superCall) { write(".call("); @@ -18220,12 +19009,19 @@ var ts; emit(node.template); } function emitParenExpression(node) { - if (node.expression.kind === 154) { + if (node.expression.kind === 156) { var operand = node.expression.expression; - while (operand.kind == 154) { + while (operand.kind == 156) { operand = operand.expression; } - if (operand.kind !== 161 && operand.kind !== 160 && operand.kind !== 159 && operand.kind !== 158 && operand.kind !== 162 && operand.kind !== 152 && !(operand.kind === 151 && node.parent.kind === 152) && !(operand.kind === 156 && node.parent.kind === 151)) { + if (operand.kind !== 163 && + operand.kind !== 162 && + operand.kind !== 161 && + operand.kind !== 160 && + operand.kind !== 164 && + operand.kind !== 154 && + !(operand.kind === 153 && node.parent.kind === 154) && + !(operand.kind === 158 && node.parent.kind === 153)) { emit(operand); return; } @@ -18251,7 +19047,7 @@ var ts; } function emitPrefixUnaryExpression(node) { write(ts.tokenToString(node.operator)); - if (node.operand.kind === 161) { + if (node.operand.kind === 163) { var operand = node.operand; if (node.operator === 33 && (operand.operator === 33 || operand.operator === 38)) { write(" "); @@ -18267,18 +19063,48 @@ var ts; write(ts.tokenToString(node.operator)); } function emitBinaryExpression(node) { - if (languageVersion < 2 && node.operator === 52 && (node.left.kind === 148 || node.left.kind === 147)) { + if (languageVersion < 2 && node.operatorToken.kind === 52 && + (node.left.kind === 150 || node.left.kind === 149)) { emitDestructuring(node); } else { emit(node.left); - if (node.operator !== 23) + if (node.operatorToken.kind !== 23) { write(" "); - write(ts.tokenToString(node.operator)); - write(" "); + } + write(ts.tokenToString(node.operatorToken.kind)); + var operatorEnd = ts.getLineAndCharacterOfPosition(currentSourceFile, node.operatorToken.end); + var rightStart = ts.getLineAndCharacterOfPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.right.pos)); + var onDifferentLine = operatorEnd.line !== rightStart.line; + if (onDifferentLine) { + var exprStart = ts.getLineAndCharacterOfPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + var firstCharOfExpr = getFirstNonWhitespaceCharacterIndexOnLine(exprStart.line); + var shouldIndent = rightStart.character > firstCharOfExpr; + if (shouldIndent) { + increaseIndent(); + } + writeLine(); + } + else { + write(" "); + } emit(node.right); + if (shouldIndent) { + decreaseIndent(); + } } } + function getFirstNonWhitespaceCharacterIndexOnLine(line) { + var lineStart = ts.getLineStarts(currentSourceFile)[line]; + var text = currentSourceFile.text; + for (var i = lineStart; i < text.length; i++) { + var ch = text.charCodeAt(i); + if (!ts.isWhiteSpace(text.charCodeAt(i)) || ts.isLineBreak(ch)) { + break; + } + } + return i - lineStart; + } function emitConditionalExpression(node) { emit(node.condition); write(" ? "); @@ -18286,16 +19112,28 @@ var ts; write(" : "); emit(node.whenFalse); } + function isSingleLineEmptyBlock(node) { + if (node && node.kind === 172) { + var block = node; + return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); + } + } function emitBlock(node) { + if (isSingleLineEmptyBlock(node)) { + emitToken(14, node.pos); + write(" "); + emitToken(15, node.statements.end); + return; + } emitToken(14, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 196) { - ts.Debug.assert(node.parent.kind === 195); + if (node.kind === 199) { + ts.Debug.assert(node.parent.kind === 198); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 196) { + if (node.kind === 199) { emitTempDeclarations(true); } decreaseIndent(); @@ -18304,7 +19142,7 @@ var ts; scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 170) { + if (node.kind === 172) { write(" "); emit(node); } @@ -18316,7 +19154,7 @@ var ts; } } function emitExpressionStatement(node) { - emitParenthesized(node.expression, node.expression.kind === 157); + emitParenthesized(node.expression, node.expression.kind === 159); write(";"); } function emitIfStatement(node) { @@ -18329,7 +19167,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(75, node.thenStatement.end); - if (node.elseStatement.kind === 174) { + if (node.elseStatement.kind === 176) { write(" "); emit(node.elseStatement); } @@ -18341,7 +19179,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 170) { + if (node.statement.kind === 172) { write(" "); } else { @@ -18361,7 +19199,7 @@ var ts; var endPos = emitToken(81, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer && node.initializer.kind === 189) { + if (node.initializer && node.initializer.kind === 192) { var variableDeclarationList = node.initializer; var declarations = variableDeclarationList.declarations; if (declarations[0] && ts.isLet(declarations[0])) { @@ -18386,11 +19224,11 @@ var ts; write(")"); emitEmbeddedStatement(node.statement); } - function emitForInStatement(node) { + function emitForInOrForOfStatement(node) { var endPos = emitToken(81, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer.kind === 189) { + if (node.initializer.kind === 192) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { var decl = variableDeclarationList.declarations[0]; @@ -18407,13 +19245,18 @@ var ts; else { emit(node.initializer); } - write(" in "); + if (node.kind === 180) { + write(" in "); + } + else { + write(" of "); + } emit(node.expression); emitToken(17, node.expression.end); emitEmbeddedStatement(node.statement); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 180 ? 65 : 70, node.pos); + emitToken(node.kind === 183 ? 65 : 70, node.pos); emitOptional(" ", node.label); write(";"); } @@ -18442,11 +19285,20 @@ var ts; writeLine(); emitToken(15, node.clauses.end); } - function isOnSameLine(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + function nodeStartPositionsAreOnSameLine(node1, node2) { + return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === + getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + } + function nodeEndPositionsAreOnSameLine(node1, node2) { + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, node2.end); + } + function nodeEndIsOnSameLineAsNodeStart(node1, node2) { + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 200) { + if (node.kind === 203) { write("case "); emit(node.expression); write(":"); @@ -18454,7 +19306,7 @@ var ts; else { write("default:"); } - if (node.statements.length === 1 && isOnSameLine(node, node.statements[0])) { + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { write(" "); emit(node.statements[0]); } @@ -18501,7 +19353,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 195); + } while (node && node.kind !== 198); return node; } function emitModuleMemberName(node) { @@ -18516,8 +19368,8 @@ var ts; } function emitDestructuring(root, value) { var emitCount = 0; - var isDeclaration = (root.kind === 188 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 124; - if (root.kind === 163) { + var isDeclaration = (root.kind === 191 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 126; + if (root.kind === 165) { emitAssignmentExpression(root); } else { @@ -18527,7 +19379,7 @@ var ts; if (emitCount++) { write(", "); } - if (name.parent && (name.parent.kind === 188 || name.parent.kind === 146)) { + if (name.parent && (name.parent.kind === 191 || name.parent.kind === 148)) { emitModuleMemberName(name.parent); } else { @@ -18550,17 +19402,17 @@ var ts; function createVoidZero() { var zero = ts.createNode(7); zero.text = "0"; - var result = ts.createNode(160); + var result = ts.createNode(162); result.expression = zero; return result; } function createDefaultValueCheck(value, defaultValue) { value = ensureIdentifier(value); - var equals = ts.createNode(163); + var equals = ts.createNode(165); equals.left = value; - equals.operator = 30; + equals.operatorToken = ts.createNode(30); equals.right = createVoidZero(); - var cond = ts.createNode(164); + var cond = ts.createNode(166); cond.condition = equals; cond.whenTrue = defaultValue; cond.whenFalse = value; @@ -18572,10 +19424,10 @@ var ts; return node; } function parenthesizeForAccess(expr) { - if (expr.kind === 64 || expr.kind === 149 || expr.kind === 150) { + if (expr.kind === 64 || expr.kind === 151 || expr.kind === 152) { return expr; } - var node = ts.createNode(155); + var node = ts.createNode(157); node.expression = expr; return node; } @@ -18583,13 +19435,13 @@ var ts; if (propName.kind !== 64) { return createElementAccess(object, propName); } - var node = ts.createNode(149); + var node = ts.createNode(151); node.expression = parenthesizeForAccess(object); node.name = propName; return node; } function createElementAccess(object, index) { - var node = ts.createNode(150); + var node = ts.createNode(152); node.expression = parenthesizeForAccess(object); node.argumentExpression = index; return node; @@ -18601,7 +19453,7 @@ var ts; } for (var i = 0; i < properties.length; i++) { var p = properties[i]; - if (p.kind === 204 || p.kind === 205) { + if (p.kind === 207 || p.kind === 208) { var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccess(value, propName)); } @@ -18614,8 +19466,8 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 168) { - if (e.kind !== 167) { + if (e.kind !== 170) { + if (e.kind !== 169) { emitDestructuringAssignment(e, createElementAccess(value, createNumericLiteral(i))); } else { @@ -18629,14 +19481,14 @@ var ts; } } function emitDestructuringAssignment(target, value) { - if (target.kind === 163 && target.operator === 52) { + if (target.kind === 165 && target.operatorToken.kind === 52) { value = createDefaultValueCheck(value, target.right); target = target.left; } - if (target.kind === 148) { + if (target.kind === 150) { emitObjectLiteralAssignment(target, value); } - else if (target.kind === 147) { + else if (target.kind === 149) { emitArrayLiteralAssignment(target, value); } else { @@ -18646,18 +19498,18 @@ var ts; function emitAssignmentExpression(root) { var target = root.left; var value = root.right; - if (root.parent.kind === 173) { + if (root.parent.kind === 175) { emitDestructuringAssignment(target, value); } else { - if (root.parent.kind !== 155) { + if (root.parent.kind !== 157) { write("("); } value = ensureIdentifier(value); emitDestructuringAssignment(target, value); write(", "); emit(value); - if (root.parent.kind !== 155) { + if (root.parent.kind !== 157) { write(")"); } } @@ -18677,11 +19529,11 @@ var ts; } for (var i = 0; i < elements.length; i++) { var element = elements[i]; - if (pattern.kind === 144) { + if (pattern.kind === 146) { var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccess(value, propName)); } - else if (element.kind !== 168) { + else if (element.kind !== 170) { if (!element.dotDotDotToken) { emitBindingElement(element, createElementAccess(value, createNumericLiteral(i))); } @@ -18820,28 +19672,28 @@ var ts; } } function emitAccessor(node) { - write(node.kind === 130 ? "get " : "set "); + write(node.kind === 132 ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); } function shouldEmitAsArrowFunction(node) { - return node.kind === 157 && languageVersion >= 2; + return node.kind === 159 && languageVersion >= 2; } function emitFunctionDeclaration(node) { if (ts.nodeIsMissing(node.body)) { return emitPinnedOrTripleSlashComments(node); } - if (node.kind !== 128 && node.kind !== 127) { + if (node.kind !== 130 && node.kind !== 129) { emitLeadingComments(node); } if (!shouldEmitAsArrowFunction(node)) { write("function "); } - if (node.kind === 190 || (node.kind === 156 && node.name)) { + if (node.kind === 193 || (node.kind === 158 && node.name)) { emit(node.name); } emitSignatureAndBody(node); - if (node.kind !== 128 && node.kind !== 127) { + if (node.kind !== 130 && node.kind !== 129) { emitTrailingComments(node); } } @@ -18885,65 +19737,15 @@ var ts; else { emitSignatureParameters(node); } - write(" {"); - scopeEmitStart(node); - if (!node.body) { - writeLine(); - write("}"); + if (isSingleLineEmptyBlock(node.body) || !node.body) { + write(" { }"); + } + else if (node.body.kind === 172) { + emitBlockFunctionBody(node, node.body); } else { - increaseIndent(); - emitDetachedComments(node.body.kind === 170 ? node.body.statements : node.body); - var startIndex = 0; - if (node.body.kind === 170) { - startIndex = emitDirectivePrologues(node.body.statements, true); - } - var outPos = writer.getTextPos(); - emitCaptureThisForNodeIfNecessary(node); - emitDefaultValueAssignments(node); - emitRestParameter(node); - if (node.body.kind !== 170 && outPos === writer.getTextPos()) { - decreaseIndent(); - write(" "); - emitStart(node.body); - write("return "); - emitNode(node.body, true); - emitEnd(node.body); - write(";"); - emitTempDeclarations(false); - write(" "); - emitStart(node.body); - write("}"); - emitEnd(node.body); - } - else { - if (node.body.kind === 170) { - emitLinesStartingAt(node.body.statements, startIndex); - } - else { - writeLine(); - emitLeadingComments(node.body); - write("return "); - emit(node.body, true); - write(";"); - emitTrailingComments(node.body); - } - emitTempDeclarations(true); - writeLine(); - if (node.body.kind === 170) { - emitLeadingCommentsOfPosition(node.body.statements.end); - decreaseIndent(); - emitToken(15, node.body.statements.end); - } - else { - decreaseIndent(); - emitStart(node.body); - write("}"); - emitEnd(node.body); - } - } + emitExpressionFunctionBody(node, node.body); } - scopeEmitEnd(); if (node.flags & 1) { writeLine(); emitStart(node); @@ -18957,12 +19759,83 @@ var ts; tempVariables = saveTempVariables; tempParameters = saveTempParameters; } + function emitFunctionBodyPreamble(node) { + emitCaptureThisForNodeIfNecessary(node); + emitDefaultValueAssignments(node); + emitRestParameter(node); + } + function emitExpressionFunctionBody(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 "); + emitNode(body, true); + emitEnd(body); + write(";"); + emitTempDeclarations(false); + write(" "); + } + else { + increaseIndent(); + writeLine(); + emitLeadingComments(node.body); + write("return "); + emit(node.body, true); + write(";"); + emitTrailingComments(node.body); + emitTempDeclarations(true); + decreaseIndent(); + writeLine(); + } + emitStart(node.body); + write("}"); + emitEnd(node.body); + scopeEmitEnd(); + } + function emitBlockFunctionBody(node, body) { + write(" {"); + scopeEmitStart(node); + var outPos = writer.getTextPos(); + increaseIndent(); + emitDetachedComments(body.statements); + var startIndex = emitDirectivePrologues(body.statements, true); + emitFunctionBodyPreamble(node); + decreaseIndent(); + var preambleEmitted = writer.getTextPos() !== outPos; + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var i = 0, n = body.statements.length; i < n; i++) { + write(" "); + emit(body.statements[i]); + } + emitTempDeclarations(false); + write(" "); + emitLeadingCommentsOfPosition(body.statements.end); + } + else { + increaseIndent(); + emitLinesStartingAt(body.statements, startIndex); + emitTempDeclarations(true); + writeLine(); + emitLeadingCommentsOfPosition(body.statements.end); + decreaseIndent(); + } + emitToken(15, body.statements.end); + scopeEmitEnd(); + } function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 173) { + if (statement && statement.kind === 175) { var expr = statement.expression; - if (expr && expr.kind === 151) { + if (expr && expr.kind === 153) { var func = expr.expression; if (func && func.kind === 90) { return statement; @@ -18993,7 +19866,7 @@ var ts; emitNode(memberName); write("]"); } - else if (memberName.kind === 122) { + else if (memberName.kind === 124) { emitComputedPropertyName(memberName); } else { @@ -19003,7 +19876,7 @@ var ts; } function emitMemberAssignments(node, staticFlag) { ts.forEach(node.members, function (member) { - if (member.kind === 126 && (member.flags & 128) === staticFlag && member.initializer) { + if (member.kind === 128 && (member.flags & 128) === staticFlag && member.initializer) { writeLine(); emitLeadingComments(member); emitStart(member); @@ -19026,7 +19899,7 @@ var ts; } function emitMemberFunctions(node) { ts.forEach(node.members, function (member) { - if (member.kind === 128 || node.kind === 127) { + if (member.kind === 130 || node.kind === 129) { if (!member.body) { return emitPinnedOrTripleSlashComments(member); } @@ -19048,8 +19921,8 @@ var ts; write(";"); emitTrailingComments(member); } - else if (member.kind === 130 || member.kind === 131) { - var accessors = getAllAccessorDeclarations(node, member); + else if (member.kind === 132 || member.kind === 133) { + var accessors = getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); emitStart(member); @@ -19156,7 +20029,7 @@ var ts; tempVariables = undefined; tempParameters = undefined; ts.forEach(node.members, function (member) { - if (member.kind === 129 && !member.body) { + if (member.kind === 131 && !member.body) { emitPinnedOrTripleSlashComments(member); } }); @@ -19299,7 +20172,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 195) { + if (moduleDeclaration.body.kind === 198) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -19324,7 +20197,7 @@ var ts; write(resolver.getLocalNameOfContainer(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 196) { + if (node.body.kind === 199) { var saveTempCount = tempCount; var saveTempVariables = tempVariables; tempCount = 0; @@ -19363,7 +20236,7 @@ var ts; emitImportDeclaration = !ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportWithEntityName(node); } if (emitImportDeclaration) { - if (ts.isExternalModuleImportDeclaration(node) && node.parent.kind === 207 && compilerOptions.module === 2) { + if (ts.isExternalModuleImportDeclaration(node) && node.parent.kind === 210 && compilerOptions.module === 2) { if (node.flags & 1) { writeLine(); emitLeadingComments(node); @@ -19412,15 +20285,29 @@ var ts; } function getFirstExportAssignment(sourceFile) { return ts.forEach(sourceFile.statements, function (node) { - if (node.kind === 198) { + if (node.kind === 201) { return node; } }); } + function sortAMDModules(amdModules) { + return amdModules.sort(function (moduleA, moduleB) { + if (moduleA.name === moduleB.name) { + return 0; + } + else if (!moduleA.name) { + return 1; + } + else { + return -1; + } + }); + } function emitAMDModule(node, startIndex) { var imports = getExternalImportDeclarations(node); writeLine(); write("define("); + sortAMDModules(node.amdDependencies); if (node.amdModuleName) { write("\"" + node.amdModuleName + "\", "); } @@ -19430,7 +20317,7 @@ var ts; emitLiteral(ts.getExternalModuleImportDeclarationExpression(imp)); }); ts.forEach(node.amdDependencies, function (amdDependency) { - var text = "\"" + amdDependency + "\""; + var text = "\"" + amdDependency.path + "\""; write(", "); write(text); }); @@ -19439,6 +20326,12 @@ var ts; write(", "); emit(imp.name); }); + ts.forEach(node.amdDependencies, function (amdDependency) { + if (amdDependency.name) { + write(", "); + write(amdDependency.name); + } + }); write(") {"); increaseIndent(); emitCaptureThisForNodeIfNecessary(node); @@ -19546,15 +20439,15 @@ var ts; } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 192: - case 190: - case 197: - case 193: - case 198: - return false; case 195: + case 193: + case 200: + case 196: + case 201: + return false; + case 198: return shouldEmitModuleDeclaration(node); - case 194: + case 197: return shouldEmitEnumDeclaration(node); } return true; @@ -19563,13 +20456,13 @@ var ts; switch (node.kind) { case 64: return emitIdentifier(node); - case 124: + case 126: return emitParameter(node); - case 128: - case 127: - return emitMethod(node); case 130: - case 131: + case 129: + return emitMethod(node); + case 132: + case 133: return emitAccessor(node); case 92: return emitThis(node); @@ -19589,120 +20482,121 @@ var ts; case 12: case 13: return emitLiteral(node); - case 165: - return emitTemplateExpression(node); - case 169: - return emitTemplateSpan(node); - case 121: - return emitQualifiedName(node); - case 144: - return emitObjectBindingPattern(node); - case 145: - return emitArrayBindingPattern(node); - case 146: - return emitBindingElement(node); - case 147: - return emitArrayLiteral(node); - case 148: - return emitObjectLiteral(node); - case 204: - return emitPropertyAssignment(node); - case 205: - return emitShorthandPropertyAssignment(node); - case 122: - return emitComputedPropertyName(node); - case 149: - return emitPropertyAccess(node); - case 150: - return emitIndexedAccess(node); - case 151: - return emitCallExpression(node); - case 152: - return emitNewExpression(node); - case 153: - return emitTaggedTemplateExpression(node); - case 154: - return emit(node.expression); - case 155: - return emitParenExpression(node); - case 190: - case 156: - case 157: - return emitFunctionDeclaration(node); - case 158: - return emitDeleteExpression(node); - case 159: - return emitTypeOfExpression(node); - case 160: - return emitVoidExpression(node); - case 161: - return emitPrefixUnaryExpression(node); - case 162: - return emitPostfixUnaryExpression(node); - case 163: - return emitBinaryExpression(node); - case 164: - return emitConditionalExpression(node); case 167: - return emitSpreadElementExpression(node); - case 168: - return; - case 170: - case 196: - return emitBlock(node); + return emitTemplateExpression(node); case 171: - return emitVariableStatement(node); - case 172: - return write(";"); - case 173: - return emitExpressionStatement(node); - case 174: - return emitIfStatement(node); - case 175: - return emitDoStatement(node); - case 176: - return emitWhileStatement(node); - case 177: - return emitForStatement(node); - case 178: - return emitForInStatement(node); - case 179: - case 180: - return emitBreakOrContinueStatement(node); - case 181: - return emitReturnStatement(node); - case 182: - return emitWithStatement(node); - case 183: - return emitSwitchStatement(node); - case 200: - case 201: - return emitCaseOrDefaultClause(node); - case 184: - return emitLabelledStatement(node); - case 185: - return emitThrowStatement(node); - case 186: - return emitTryStatement(node); - case 203: - return emitCatchClause(node); - case 187: - return emitDebuggerStatement(node); - case 188: - return emitVariableDeclaration(node); - case 191: - return emitClassDeclaration(node); - case 192: - return emitInterfaceDeclaration(node); - case 194: - return emitEnumDeclaration(node); - case 206: - return emitEnumMember(node); - case 195: - return emitModuleDeclaration(node); - case 197: - return emitImportDeclaration(node); + return emitTemplateSpan(node); + case 123: + return emitQualifiedName(node); + case 146: + return emitObjectBindingPattern(node); + case 147: + return emitArrayBindingPattern(node); + case 148: + return emitBindingElement(node); + case 149: + return emitArrayLiteral(node); + case 150: + return emitObjectLiteral(node); case 207: + return emitPropertyAssignment(node); + case 208: + return emitShorthandPropertyAssignment(node); + case 124: + return emitComputedPropertyName(node); + case 151: + return emitPropertyAccess(node); + case 152: + return emitIndexedAccess(node); + case 153: + return emitCallExpression(node); + case 154: + return emitNewExpression(node); + case 155: + return emitTaggedTemplateExpression(node); + case 156: + return emit(node.expression); + case 157: + return emitParenExpression(node); + case 193: + case 158: + case 159: + return emitFunctionDeclaration(node); + case 160: + return emitDeleteExpression(node); + case 161: + return emitTypeOfExpression(node); + case 162: + return emitVoidExpression(node); + case 163: + return emitPrefixUnaryExpression(node); + case 164: + return emitPostfixUnaryExpression(node); + case 165: + return emitBinaryExpression(node); + case 166: + return emitConditionalExpression(node); + case 169: + return emitSpreadElementExpression(node); + case 170: + return; + case 172: + case 199: + return emitBlock(node); + case 173: + return emitVariableStatement(node); + case 174: + return write(";"); + case 175: + return emitExpressionStatement(node); + case 176: + return emitIfStatement(node); + case 177: + return emitDoStatement(node); + case 178: + return emitWhileStatement(node); + case 179: + return emitForStatement(node); + case 181: + case 180: + return emitForInOrForOfStatement(node); + case 182: + case 183: + return emitBreakOrContinueStatement(node); + case 184: + return emitReturnStatement(node); + case 185: + return emitWithStatement(node); + case 186: + return emitSwitchStatement(node); + case 203: + case 204: + return emitCaseOrDefaultClause(node); + case 187: + return emitLabelledStatement(node); + case 188: + return emitThrowStatement(node); + case 189: + return emitTryStatement(node); + case 206: + return emitCatchClause(node); + case 190: + return emitDebuggerStatement(node); + case 191: + return emitVariableDeclaration(node); + case 194: + return emitClassDeclaration(node); + case 195: + return emitInterfaceDeclaration(node); + case 197: + return emitEnumDeclaration(node); + case 209: + return emitEnumMember(node); + case 198: + return emitModuleDeclaration(node); + case 200: + return emitImportDeclaration(node); + case 210: return emitSourceFile(node); } } @@ -19721,7 +20615,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 207 || node.pos !== node.parent.pos) { + if (node.parent.kind === 210 || node.pos !== node.parent.pos) { var leadingComments; if (hasDetachedComments(node.pos)) { leadingComments = getLeadingCommentsWithoutDetachedComments(); @@ -19740,7 +20634,7 @@ var ts; } function emitTrailingDeclarationComments(node) { if (node.parent) { - if (node.parent.kind === 207 || node.end !== node.parent.end) { + if (node.parent.kind === 210 || node.end !== node.parent.end) { var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, node.end); emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); } @@ -19775,8 +20669,8 @@ var ts; }); if (detachedComments.length) { var lastCommentLine = getLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end); - var astLine = getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); - if (astLine >= lastCommentLine + 2) { + var nodeLine = getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; @@ -19796,7 +20690,10 @@ var ts; if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; } - else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && comment.pos + 2 < comment.end && currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { + else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && + comment.pos + 2 < comment.end && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && + currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { return true; } } @@ -20117,7 +21014,8 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (ts.isExternalModuleImportDeclaration(node) && ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { + if (ts.isExternalModuleImportDeclaration(node) && + ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { var nameLiteral = ts.getExternalModuleImportDeclarationExpression(node); var moduleName = nameLiteral.text; if (moduleName) { @@ -20135,9 +21033,10 @@ var ts; } } } - else if (node.kind === 195 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { + else if (node.kind === 198 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportDeclaration(node) && ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { + if (ts.isExternalModuleImportDeclaration(node) && + ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { var nameLiteral = ts.getExternalModuleImportDeclarationExpression(node); var moduleName = nameLiteral.text; if (moduleName) { @@ -20172,7 +21071,10 @@ var ts; var errorLength = externalModuleErrorSpan.end - errorStart; diagnostics.add(ts.createFileDiagnostic(firstExternalModule, errorStart, errorLength, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } - if (options.outDir || options.sourceRoot || (options.mapRoot && (!options.out || firstExternalModule !== undefined))) { + if (options.outDir || + options.sourceRoot || + (options.mapRoot && + (!options.out || firstExternalModule !== undefined))) { var commonPathComponents; ts.forEach(files, function (sourceFile) { if (!(sourceFile.flags & 1024) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { @@ -20573,10 +21475,10 @@ var ts; } function autoCollapse(node) { switch (node.kind) { - case 196: - case 191: - case 192: + case 199: case 194: + case 195: + case 197: return false; } return true; @@ -20588,16 +21490,23 @@ var ts; return; } switch (n.kind) { - case 170: + case 172: if (!ts.isFunctionBlock(n)) { var parent = n.parent; var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - if (parent.kind === 175 || parent.kind === 178 || parent.kind === 177 || parent.kind === 174 || parent.kind === 176 || parent.kind === 182 || parent.kind === 203) { + if (parent.kind === 177 || + parent.kind === 180 || + parent.kind === 181 || + parent.kind === 179 || + parent.kind === 176 || + parent.kind === 178 || + parent.kind === 185 || + parent.kind === 206) { addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent.kind === 186) { + if (parent.kind === 189) { var tryStatement = parent; if (tryStatement.tryBlock === n) { addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); @@ -20620,21 +21529,21 @@ var ts; }); break; } - case 196: + case 199: var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; - case 191: - case 192: case 194: - case 148: - case 183: + case 195: + case 197: + case 150: + case 186: var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; - case 147: + case 149: var openBracket = ts.findChildOfKind(n, 18, sourceFile); var closeBracket = ts.findChildOfKind(n, 19, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -20651,6 +21560,95 @@ var ts; })(OutliningElementsCollector = ts.OutliningElementsCollector || (ts.OutliningElementsCollector = {})); })(ts || (ts = {})); var ts; +(function (ts) { + var NavigateTo; + (function (NavigateTo) { + var MatchKind; + (function (MatchKind) { + MatchKind[MatchKind["none"] = 0] = "none"; + MatchKind[MatchKind["exact"] = 1] = "exact"; + MatchKind[MatchKind["substring"] = 2] = "substring"; + MatchKind[MatchKind["prefix"] = 3] = "prefix"; + })(MatchKind || (MatchKind = {})); + function getNavigateToItems(program, cancellationToken, searchValue, maxResultCount) { + var terms = searchValue.split(" "); + var searchTerms = ts.map(terms, function (t) { return ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t }); }); + var rawItems = []; + ts.forEach(program.getSourceFiles(), function (sourceFile) { + cancellationToken.throwIfCancellationRequested(); + var fileName = sourceFile.fileName; + var declarations = sourceFile.getNamedDeclarations(); + for (var i = 0, n = declarations.length; i < n; i++) { + var declaration = declarations[i]; + var name = declaration.name.text; + var matchKind = getMatchKind(searchTerms, name); + if (matchKind !== 0) { + rawItems.push({ name: name, fileName: fileName, matchKind: matchKind, declaration: declaration }); + } + } + }); + rawItems.sort(compareNavigateToItems); + if (maxResultCount !== undefined) { + rawItems = rawItems.slice(0, maxResultCount); + } + var items = ts.map(rawItems, createNavigateToItem); + return items; + var baseSensitivity = { sensitivity: "base" }; + function compareNavigateToItems(i1, i2) { + return i1.matchKind - i2.matchKind || + i1.name.localeCompare(i2.name, undefined, baseSensitivity) || + i1.name.localeCompare(i2.name); + } + function createNavigateToItem(rawItem) { + var declaration = rawItem.declaration; + var container = ts.getContainerNode(declaration); + return { + name: rawItem.name, + kind: ts.getNodeKind(declaration), + kindModifiers: ts.getNodeModifiers(declaration), + matchKind: MatchKind[rawItem.matchKind], + fileName: rawItem.fileName, + textSpan: ts.createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), + containerName: container && container.name ? container.name.text : "", + containerKind: container && container.name ? ts.getNodeKind(container) : "" + }; + } + function hasAnyUpperCaseCharacter(s) { + for (var i = 0, n = s.length; i < n; i++) { + var c = s.charCodeAt(i); + if ((65 <= c && c <= 90) || + (c >= 127 && s.charAt(i).toLocaleLowerCase() !== s.charAt(i))) { + return true; + } + } + return false; + } + function getMatchKind(searchTerms, name) { + var matchKind = 0; + if (name) { + for (var j = 0, n = searchTerms.length; j < n; j++) { + var searchTerm = searchTerms[j]; + var nameToSearch = searchTerm.caseSensitive ? name : name.toLocaleLowerCase(); + var index = nameToSearch.indexOf(searchTerm.term); + if (index < 0) { + return 0; + } + var termKind = 2; + if (index === 0) { + termKind = name.length === searchTerm.term.length ? 1 : 3; + } + if (matchKind === 0 || termKind < matchKind) { + matchKind = termKind; + } + } + } + return matchKind; + } + } + NavigateTo.getNavigateToItems = getNavigateToItems; + })(NavigateTo = ts.NavigateTo || (ts.NavigateTo = {})); +})(ts || (ts = {})); +var ts; (function (ts) { var NavigationBar; (function (NavigationBar) { @@ -20662,14 +21660,14 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 195: + case 198: do { current = current.parent; - } while (current.kind === 195); - case 191: + } while (current.kind === 198); case 194: - case 192: - case 190: + case 197: + case 195: + case 193: indent++; } current = current.parent; @@ -20680,24 +21678,24 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 171: + case 173: ts.forEach(node.declarationList.declarations, visit); break; - case 144: - case 145: + case 146: + case 147: ts.forEach(node.elements, visit); break; - case 146: - case 188: + case 148: + case 191: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } - case 191: case 194: - case 192: + case 197: case 195: - case 190: + case 198: + case 193: childNodes.push(node); } } @@ -20713,7 +21711,7 @@ var ts; function sortNodes(nodes) { return nodes.slice(0).sort(function (n1, n2) { if (n1.name && n2.name) { - return n1.name.text.localeCompare(n2.name.text); + return ts.getPropertyNameForPropertyNameNode(n1.name).localeCompare(ts.getPropertyNameForPropertyNameNode(n2.name)); } else if (n1.name) { return 1; @@ -20731,17 +21729,17 @@ var ts; for (var i = 0, n = nodes.length; i < n; i++) { var node = nodes[i]; switch (node.kind) { - case 191: case 194: - case 192: + case 197: + case 195: topLevelNodes.push(node); break; - case 195: + case 198: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 190: + case 193: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -20752,9 +21750,9 @@ var ts; } } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 190) { - if (functionDeclaration.body && functionDeclaration.body.kind === 170) { - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 190 && !isEmpty(s.name.text); })) { + if (functionDeclaration.kind === 193) { + if (functionDeclaration.body && functionDeclaration.body.kind === 172) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 193 && !isEmpty(s.name.text); })) { return true; } if (!ts.isFunctionBlock(functionDeclaration.parent)) { @@ -20807,7 +21805,7 @@ var ts; } function createChildItem(node) { switch (node.kind) { - case 124: + case 126: if (ts.isBindingPattern(node.name)) { break; } @@ -20815,34 +21813,34 @@ var ts; return undefined; } return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 130: + case 129: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); + case 132: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); + case 133: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); + case 136: + return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); + case 209: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 134: + return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); + case 135: + return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); case 128: case 127: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); - case 130: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); - case 131: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); - case 134: - return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 206: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 132: - return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); - case 133: - return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); - case 126: - case 125: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 190: + case 193: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 188: - case 146: + case 191: + case 148: var variableDeclarationNode; var name; - if (node.kind === 146) { + if (node.kind === 148) { name = node.name; variableDeclarationNode = node; - while (variableDeclarationNode && variableDeclarationNode.kind !== 188) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 191) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -20861,7 +21859,7 @@ var ts; else { return createItem(node, getTextOfNode(name), ts.ScriptElementKind.variableElement); } - case 129: + case 131: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); } return undefined; @@ -20891,17 +21889,17 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 207: + case 210: return createSourceFileItem(node); - case 191: - return createClassItem(node); case 194: + return createClassItem(node); + case 197: return createEnumItem(node); - case 192: - return createIterfaceItem(node); case 195: + return createIterfaceItem(node); + case 198: return createModuleItem(node); - case 190: + case 193: return createFunctionItem(node); } return undefined; @@ -20911,7 +21909,7 @@ var ts; } var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 195) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 198) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -20923,7 +21921,7 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if (node.name && node.body && node.body.kind === 170) { + if (node.name && node.body && node.body.kind === 172) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem(node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } @@ -20942,9 +21940,9 @@ var ts; var childItems; if (node.members) { var constructor = ts.forEach(node.members, function (member) { - return member.kind === 129 && member; + return member.kind === 131 && member; }); - var nodes = removeComputedProperties(node); + var nodes = removeDynamicallyNamedProperties(node); if (constructor) { nodes.push.apply(nodes, constructor.parameters); } @@ -20957,21 +21955,24 @@ var ts; return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createIterfaceItem(node) { - var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); + var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 122; }); + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 124; }); + } + function removeDynamicallyNamedProperties(node) { + return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 195) { + while (node.body.kind === 198) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 207 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); + return node.kind === 210 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } function getTextOfNode(node) { return ts.getTextOfNodeFromSourceText(sourceFile.text, node); @@ -20981,6 +21982,456 @@ var ts; })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {})); })(ts || (ts = {})); var ts; +(function (ts) { + (function (PatternMatchKind) { + PatternMatchKind[PatternMatchKind["Exact"] = 0] = "Exact"; + PatternMatchKind[PatternMatchKind["Prefix"] = 1] = "Prefix"; + PatternMatchKind[PatternMatchKind["Substring"] = 2] = "Substring"; + PatternMatchKind[PatternMatchKind["CamelCase"] = 3] = "CamelCase"; + })(ts.PatternMatchKind || (ts.PatternMatchKind = {})); + var PatternMatchKind = ts.PatternMatchKind; + function createPatternMatch(kind, punctuationStripped, isCaseSensitive, camelCaseWeight) { + return { + kind: kind, + punctuationStripped: punctuationStripped, + isCaseSensitive: isCaseSensitive, + camelCaseWeight: camelCaseWeight + }; + } + function createPatternMatcher(pattern) { + var stringToWordSpans = {}; + pattern = pattern.trim(); + var fullPatternSegment = createSegment(pattern); + var dotSeparatedSegments = pattern.split(".").map(function (p) { return createSegment(p.trim()); }); + var invalidPattern = dotSeparatedSegments.length === 0 || ts.forEach(dotSeparatedSegments, segmentIsInvalid); + return { + getMatches: getMatches, + getMatchesForLastSegmentOfPattern: getMatchesForLastSegmentOfPattern, + patternContainsDots: dotSeparatedSegments.length > 1 + }; + function skipMatch(candidate) { + return invalidPattern || !candidate; + } + function getMatchesForLastSegmentOfPattern(candidate) { + if (skipMatch(candidate)) { + return undefined; + } + return matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments)); + } + function getMatches(candidate, dottedContainer) { + if (skipMatch(candidate)) { + return undefined; + } + var candidateMatch = matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments)); + if (!candidateMatch) { + return undefined; + } + dottedContainer = dottedContainer || ""; + var containerParts = dottedContainer.split("."); + if (dotSeparatedSegments.length - 1 > containerParts.length) { + return null; + } + var totalMatch = candidateMatch; + for (var i = dotSeparatedSegments.length - 2, j = containerParts.length - 1; i >= 0; i--, j--) { + var segment = dotSeparatedSegments[i]; + var containerName = containerParts[j]; + var containerMatch = matchSegment(containerName, segment); + if (!containerMatch) { + return undefined; + } + ts.addRange(totalMatch, containerMatch); + } + return totalMatch; + } + function getWordSpans(word) { + if (!ts.hasProperty(stringToWordSpans, word)) { + stringToWordSpans[word] = breakIntoWordSpans(word); + } + return stringToWordSpans[word]; + } + function matchTextChunk(candidate, chunk, punctuationStripped) { + var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); + if (index === 0) { + if (chunk.text.length === candidate.length) { + return createPatternMatch(0, punctuationStripped, candidate === chunk.text); + } + else { + return createPatternMatch(1, punctuationStripped, startsWith(candidate, chunk.text)); + } + } + var isLowercase = chunk.isLowerCase; + if (isLowercase) { + if (index > 0) { + var wordSpans = getWordSpans(candidate); + for (var i = 0, n = wordSpans.length; i < n; i++) { + var span = wordSpans[i]; + if (partStartsWith(candidate, span, chunk.text, true)) { + return createPatternMatch(2, punctuationStripped, partStartsWith(candidate, span, chunk.text, false)); + } + } + } + } + else { + if (candidate.indexOf(chunk.text) > 0) { + return createPatternMatch(2, punctuationStripped, true); + } + } + if (!isLowercase) { + if (chunk.characterSpans.length > 0) { + var candidateParts = getWordSpans(candidate); + var camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, false); + if (camelCaseWeight !== undefined) { + return createPatternMatch(3, punctuationStripped, true, camelCaseWeight); + } + camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, true); + if (camelCaseWeight !== undefined) { + return createPatternMatch(3, punctuationStripped, false, camelCaseWeight); + } + } + } + if (isLowercase) { + if (chunk.text.length < candidate.length) { + if (index > 0 && isUpperCaseLetter(candidate.charCodeAt(index))) { + return createPatternMatch(2, punctuationStripped, false); + } + } + } + return undefined; + } + function containsSpaceOrAsterisk(text) { + for (var i = 0; i < text.length; i++) { + var ch = text.charCodeAt(i); + if (ch === 32 || ch === 42) { + return true; + } + } + return false; + } + function matchSegment(candidate, segment) { + if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) { + var match = matchTextChunk(candidate, segment.totalTextChunk, false); + if (match) { + return [match]; + } + } + var subWordTextChunks = segment.subWordTextChunks; + var matches = undefined; + for (var i = 0, n = subWordTextChunks.length; i < n; i++) { + var subWordTextChunk = subWordTextChunks[i]; + var result = matchTextChunk(candidate, subWordTextChunk, true); + if (!result) { + return undefined; + } + matches = matches || []; + matches.push(result); + } + return matches; + } + function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) { + var patternPartStart = patternSpan ? patternSpan.start : 0; + var patternPartLength = patternSpan ? patternSpan.length : pattern.length; + if (patternPartLength > candidateSpan.length) { + return false; + } + if (ignoreCase) { + for (var i = 0; i < patternPartLength; i++) { + var ch1 = pattern.charCodeAt(patternPartStart + i); + var ch2 = candidate.charCodeAt(candidateSpan.start + i); + if (toLowerCase(ch1) !== toLowerCase(ch2)) { + return false; + } + } + } + else { + for (var i = 0; i < patternPartLength; i++) { + var ch1 = pattern.charCodeAt(patternPartStart + i); + var ch2 = candidate.charCodeAt(candidateSpan.start + i); + if (ch1 !== ch2) { + return false; + } + } + } + return true; + } + function tryCamelCaseMatch(candidate, candidateParts, chunk, ignoreCase) { + var chunkCharacterSpans = chunk.characterSpans; + var currentCandidate = 0; + var currentChunkSpan = 0; + var firstMatch = undefined; + var contiguous = undefined; + while (true) { + if (currentChunkSpan === chunkCharacterSpans.length) { + var weight = 0; + if (contiguous) { + weight += 1; + } + if (firstMatch === 0) { + weight += 2; + } + return weight; + } + else if (currentCandidate === candidateParts.length) { + return undefined; + } + var candidatePart = candidateParts[currentCandidate]; + var gotOneMatchThisCandidate = false; + for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { + var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; + if (gotOneMatchThisCandidate) { + if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || + !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { + break; + } + } + if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) { + break; + } + gotOneMatchThisCandidate = true; + firstMatch = firstMatch === undefined ? currentCandidate : firstMatch; + contiguous = contiguous === undefined ? true : contiguous; + candidatePart = ts.createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length); + } + if (!gotOneMatchThisCandidate && contiguous !== undefined) { + contiguous = false; + } + currentCandidate++; + } + } + } + ts.createPatternMatcher = createPatternMatcher; + function patternMatchCompareTo(match1, match2) { + return compareType(match1, match2) || + compareCamelCase(match1, match2) || + compareCase(match1, match2) || + comparePunctuation(match1, match2); + } + function comparePunctuation(result1, result2) { + if (result1.punctuationStripped !== result2.punctuationStripped) { + return result1.punctuationStripped ? 1 : -1; + } + return 0; + } + function compareCase(result1, result2) { + if (result1.isCaseSensitive !== result2.isCaseSensitive) { + return result1.isCaseSensitive ? -1 : 1; + } + return 0; + } + function compareType(result1, result2) { + return result1.kind - result2.kind; + } + function compareCamelCase(result1, result2) { + if (result1.kind === 3 && result2.kind === 3) { + return result2.camelCaseWeight - result1.camelCaseWeight; + } + return 0; + } + function createSegment(text) { + return { + totalTextChunk: createTextChunk(text), + subWordTextChunks: breakPatternIntoTextChunks(text) + }; + } + function segmentIsInvalid(segment) { + return segment.subWordTextChunks.length === 0; + } + function isUpperCaseLetter(ch) { + if (ch >= 65 && ch <= 90) { + return true; + } + if (ch < 127 || !ts.isUnicodeIdentifierStart(ch, 2)) { + return false; + } + var str = String.fromCharCode(ch); + return str === str.toUpperCase(); + } + function isLowerCaseLetter(ch) { + if (ch >= 97 && ch <= 122) { + return true; + } + if (ch < 127 || !ts.isUnicodeIdentifierStart(ch, 2)) { + return false; + } + var str = String.fromCharCode(ch); + return str === str.toLowerCase(); + } + function containsUpperCaseLetter(string) { + for (var i = 0, n = string.length; i < n; i++) { + if (isUpperCaseLetter(string.charCodeAt(i))) { + return true; + } + } + return false; + } + function startsWith(string, search) { + for (var i = 0, n = search.length; i < n; i++) { + if (string.charCodeAt(i) !== search.charCodeAt(i)) { + return false; + } + } + return true; + } + function indexOfIgnoringCase(string, value) { + for (var i = 0, n = string.length - value.length; i <= n; i++) { + if (startsWithIgnoringCase(string, value, i)) { + return i; + } + } + return -1; + } + function startsWithIgnoringCase(string, value, start) { + for (var i = 0, n = value.length; i < n; i++) { + var ch1 = toLowerCase(string.charCodeAt(i + start)); + var ch2 = value.charCodeAt(i); + if (ch1 !== ch2) { + return false; + } + } + return true; + } + function toLowerCase(ch) { + if (ch >= 65 && ch <= 90) { + return 97 + (ch - 65); + } + if (ch < 127) { + return ch; + } + return String.fromCharCode(ch).toLowerCase().charCodeAt(0); + } + function isDigit(ch) { + return ch >= 48 && ch <= 57; + } + function isWordChar(ch) { + return isUpperCaseLetter(ch) || isLowerCaseLetter(ch) || isDigit(ch) || ch === 95 || ch === 36; + } + function breakPatternIntoTextChunks(pattern) { + var result = []; + var wordStart = 0; + var wordLength = 0; + for (var i = 0; i < pattern.length; i++) { + var ch = pattern.charCodeAt(i); + if (isWordChar(ch)) { + if (wordLength++ === 0) { + wordStart = i; + } + } + else { + if (wordLength > 0) { + result.push(createTextChunk(pattern.substr(wordStart, wordLength))); + wordLength = 0; + } + } + } + if (wordLength > 0) { + result.push(createTextChunk(pattern.substr(wordStart, wordLength))); + } + return result; + } + function createTextChunk(text) { + var textLowerCase = text.toLowerCase(); + return { + text: text, + textLowerCase: textLowerCase, + isLowerCase: text === textLowerCase, + characterSpans: breakIntoCharacterSpans(text) + }; + } + function breakIntoCharacterSpans(identifier) { + return breakIntoSpans(identifier, false); + } + ts.breakIntoCharacterSpans = breakIntoCharacterSpans; + function breakIntoWordSpans(identifier) { + return breakIntoSpans(identifier, true); + } + ts.breakIntoWordSpans = breakIntoWordSpans; + function breakIntoSpans(identifier, word) { + var result = []; + var wordStart = 0; + for (var i = 1, n = identifier.length; i < n; i++) { + var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); + var currentIsDigit = isDigit(identifier.charCodeAt(i)); + var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); + var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart); + if (charIsPunctuation(identifier.charCodeAt(i - 1)) || + charIsPunctuation(identifier.charCodeAt(i)) || + lastIsDigit != currentIsDigit || + hasTransitionFromLowerToUpper || + hasTransitionFromUpperToLower) { + if (!isAllPunctuation(identifier, wordStart, i)) { + result.push(ts.createTextSpan(wordStart, i - wordStart)); + } + wordStart = i; + } + } + if (!isAllPunctuation(identifier, wordStart, identifier.length)) { + result.push(ts.createTextSpan(wordStart, identifier.length - wordStart)); + } + return result; + } + function charIsPunctuation(ch) { + switch (ch) { + case 33: + case 34: + case 35: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 44: + case 45: + case 46: + case 47: + case 58: + case 59: + case 63: + case 64: + case 91: + case 92: + case 93: + case 95: + case 123: + case 125: + return true; + } + return false; + } + function isAllPunctuation(identifier, start, end) { + for (var i = start; i < end; i++) { + var ch = identifier.charCodeAt(i); + if (!charIsPunctuation(ch) || ch === 95 || ch === 36) { + return false; + } + } + return true; + } + function transitionFromUpperToLower(identifier, word, index, wordStart) { + if (word) { + if (index != wordStart && + index + 1 < identifier.length) { + var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); + var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1)); + if (currentIsUpper && nextIsLower) { + for (var i = wordStart; i < index; i++) { + if (!isUpperCaseLetter(identifier.charCodeAt(i))) { + return false; + } + } + return true; + } + } + } + return false; + } + function transitionFromLowerToUpper(identifier, word, index) { + var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); + var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); + var transition = word ? (currentIsUpper && !lastIsUpper) : currentIsUpper; + return transition; + } +})(ts || (ts = {})); +var ts; (function (ts) { var SignatureHelp; (function (SignatureHelp) { @@ -21010,9 +22461,10 @@ var ts; } return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); function getImmediatelyContainingArgumentInfo(node) { - if (node.parent.kind === 151 || node.parent.kind === 152) { + if (node.parent.kind === 153 || node.parent.kind === 154) { var callExpression = node.parent; - if (node.kind === 24 || node.kind === 16) { + if (node.kind === 24 || + node.kind === 16) { var list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile); var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; ts.Debug.assert(list !== undefined); @@ -21038,24 +22490,24 @@ var ts; }; } } - else if (node.kind === 10 && node.parent.kind === 153) { + else if (node.kind === 10 && node.parent.kind === 155) { if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, 0); } } - else if (node.kind === 11 && node.parent.parent.kind === 153) { + else if (node.kind === 11 && node.parent.parent.kind === 155) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 165); + ts.Debug.assert(templateExpression.kind === 167); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 169 && node.parent.parent.parent.kind === 153) { + else if (node.parent.kind === 171 && node.parent.parent.parent.kind === 155) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 165); - if (node.kind === 13 && position >= node.getEnd() && !node.isUnterminated) { + ts.Debug.assert(templateExpression.kind === 167); + if (node.kind === 13 && !ts.isInsideTemplateLiteral(node, position)) { return undefined; } var spanIndex = templateExpression.templateSpans.indexOf(templateSpan); @@ -21096,7 +22548,7 @@ var ts; var template = taggedTemplate.template; var applicableSpanStart = template.getStart(); var applicableSpanEnd = template.getEnd(); - if (template.kind === 165) { + if (template.kind === 167) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false); @@ -21105,7 +22557,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 207; n = n.parent) { + for (var n = node; n.kind !== 210; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -21159,18 +22611,24 @@ var ts; var typeParameters = candidateSignature.typeParameters; signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; suffixDisplayParts.push(ts.punctuationPart(25)); - var parameterParts = ts.mapToDisplayParts(function (writer) { return typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation); }); + var parameterParts = ts.mapToDisplayParts(function (writer) { + return typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation); + }); suffixDisplayParts.push.apply(suffixDisplayParts, parameterParts); } else { - var typeParameterParts = ts.mapToDisplayParts(function (writer) { return typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation); }); + var typeParameterParts = ts.mapToDisplayParts(function (writer) { + return typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation); + }); prefixDisplayParts.push.apply(prefixDisplayParts, typeParameterParts); prefixDisplayParts.push(ts.punctuationPart(16)); var parameters = candidateSignature.parameters; signatureHelpParameters = parameters.length > 0 ? ts.map(parameters, createSignatureHelpParameterForParameter) : emptyArray; suffixDisplayParts.push(ts.punctuationPart(17)); } - var returnTypeParts = ts.mapToDisplayParts(function (writer) { return typeInfoResolver.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, invocation); }); + var returnTypeParts = ts.mapToDisplayParts(function (writer) { + return typeInfoResolver.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, invocation); + }); suffixDisplayParts.push.apply(suffixDisplayParts, returnTypeParts); return { isVariadic: candidateSignature.hasRestParameter, @@ -21195,7 +22653,9 @@ var ts; argumentCount: argumentCount }; function createSignatureHelpParameterForParameter(parameter) { - var displayParts = ts.mapToDisplayParts(function (writer) { return typeInfoResolver.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation); }); + var displayParts = ts.mapToDisplayParts(function (writer) { + return typeInfoResolver.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation); + }); var isOptional = ts.hasQuestionToken(parameter.valueDeclaration); return { name: parameter.name, @@ -21205,7 +22665,9 @@ var ts; }; } function createSignatureHelpParameterForTypeParameter(typeParameter) { - var displayParts = ts.mapToDisplayParts(function (writer) { return typeInfoResolver.getSymbolDisplayBuilder().buildTypeParameterDisplay(typeParameter, writer, invocation); }); + var displayParts = ts.mapToDisplayParts(function (writer) { + return typeInfoResolver.getSymbolDisplayBuilder().buildTypeParameterDisplay(typeParameter, writer, invocation); + }); return { name: typeParameter.symbol.name, documentation: emptyArray, @@ -21221,10 +22683,10 @@ var ts; var ts; (function (ts) { function getEndLinePosition(line, sourceFile) { - ts.Debug.assert(line >= 1); + ts.Debug.assert(line >= 0); var lineStarts = sourceFile.getLineStarts(); - var lineIndex = line - 1; - if (lineIndex === lineStarts.length - 1) { + var lineIndex = line; + if (lineIndex + 1 === lineStarts.length) { return sourceFile.text.length - 1; } else { @@ -21238,17 +22700,12 @@ var ts; } } ts.getEndLinePosition = getEndLinePosition; - function getStartPositionOfLine(line, sourceFile) { - ts.Debug.assert(line >= 1); - return sourceFile.getLineStarts()[line - 1]; - } - ts.getStartPositionOfLine = getStartPositionOfLine; - function getStartLinePositionForPosition(position, sourceFile) { + function getLineStartPositionForPosition(position, sourceFile) { var lineStarts = sourceFile.getLineStarts(); - var line = sourceFile.getLineAndCharacterFromPosition(position).line; - return lineStarts[line - 1]; + var line = sourceFile.getLineAndCharacterOfPosition(position).line; + return lineStarts[line]; } - ts.getStartLinePositionForPosition = getStartLinePositionForPosition; + ts.getLineStartPositionForPosition = getLineStartPositionForPosition; function rangeContainsRange(r1, r2) { return startEndContainsRange(r1.pos, r1.end, r2); } @@ -21290,7 +22747,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 208 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 211 && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -21356,7 +22813,8 @@ var ts; var children = n.getChildren(); for (var i = 0, len = children.length; i < len; ++i) { var child = children[i]; - var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); + var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || + (child.pos === previousToken.end); if (shouldDiveInChildNode && nodeHasTokens(child)) { return find(child); } @@ -21394,7 +22852,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 207); + ts.Debug.assert(startNode !== undefined || n.kind === 210); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -21431,17 +22889,17 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 135 || node.kind === 151) { + if (node.kind === 137 || node.kind === 153) { return node.typeArguments; } - if (ts.isAnyFunction(node) || node.kind === 191 || node.kind === 192) { + if (ts.isAnyFunction(node) || node.kind === 194 || node.kind === 195) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; function isToken(n) { - return n.kind >= 0 && n.kind <= 120; + return n.kind >= 0 && n.kind <= 122; } ts.isToken = isToken; function isWord(kind) { @@ -21482,7 +22940,7 @@ var ts; var ts; (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 124; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 126; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -21501,15 +22959,10 @@ var ts; writeParameter: function (text) { return writeKind(text, 13); }, writeSymbol: writeSymbol, writeLine: writeLine, - increaseIndent: function () { - indent++; - }, - decreaseIndent: function () { - indent--; - }, + increaseIndent: function () { indent++; }, + decreaseIndent: function () { indent--; }, clear: resetWriter, - trackSymbol: function () { - } + trackSymbol: function () { } }; function writeIndent() { if (lineStart) { @@ -21714,17 +23167,16 @@ var ts; } savedPos = scanner.getStartPos(); } - function shouldRescanGreaterThanToken(container) { - if (container.kind !== 163) { - return false; - } - switch (container.operator) { - case 27: - case 59: - case 60: - case 42: - case 41: - return true; + function shouldRescanGreaterThanToken(node) { + if (node) { + switch (node.kind) { + case 27: + case 59: + case 60: + case 42: + case 41: + return true; + } } return false; } @@ -21732,7 +23184,8 @@ var ts; return container.kind === 9; } function shouldRescanTemplateToken(container) { - return container.kind === 12 || container.kind === 13; + return container.kind === 12 || + container.kind === 13; } function startsWithSlashToken(t) { return t === 36 || t === 56; @@ -21757,7 +23210,7 @@ var ts; var currentToken = scanner.getToken(); if (expectedScanAction === 1 && currentToken === 25) { currentToken = scanner.reScanGreaterToken(); - ts.Debug.assert(n.operator === currentToken); + ts.Debug.assert(n.kind === currentToken); lastScanAction = 1; } else if (expectedScanAction === 2 && startsWithSlashToken(currentToken)) { @@ -21861,8 +23314,8 @@ var ts; }; FormattingContext.prototype.TokensAreOnSameLine = function () { if (this.tokensAreOnSameLine === undefined) { - var startLine = this.sourceFile.getLineAndCharacterFromPosition(this.currentTokenSpan.pos).line; - var endLine = this.sourceFile.getLineAndCharacterFromPosition(this.nextTokenSpan.pos).line; + var startLine = this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(this.nextTokenSpan.pos).line; this.tokensAreOnSameLine = (startLine == endLine); } return this.tokensAreOnSameLine; @@ -21880,16 +23333,16 @@ var ts; return this.nextNodeBlockIsOnOneLine; }; FormattingContext.prototype.NodeIsOnOneLine = function (node) { - var startLine = this.sourceFile.getLineAndCharacterFromPosition(node.getStart(this.sourceFile)).line; - var endLine = this.sourceFile.getLineAndCharacterFromPosition(node.getEnd()).line; + var startLine = this.sourceFile.getLineAndCharacterOfPosition(node.getStart(this.sourceFile)).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(node.getEnd()).line; return startLine == endLine; }; FormattingContext.prototype.BlockIsOnOneLine = function (node) { var openBrace = ts.findChildOfKind(node, 14, this.sourceFile); var closeBrace = ts.findChildOfKind(node, 15, this.sourceFile); if (openBrace && closeBrace) { - var startLine = this.sourceFile.getLineAndCharacterFromPosition(openBrace.getEnd()).line; - var endLine = this.sourceFile.getLineAndCharacterFromPosition(closeBrace.getStart(this.sourceFile)).line; + var startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line; return startLine === endLine; } return false; @@ -21925,7 +23378,9 @@ var ts; this.Flag = Flag; } Rule.prototype.toString = function () { - return "[desc=" + this.Descriptor + "," + "operation=" + this.Operation + "," + "flag=" + this.Flag + "]"; + return "[desc=" + this.Descriptor + "," + + "operation=" + this.Operation + "," + + "flag=" + this.Flag + "]"; }; return Rule; })(); @@ -21955,7 +23410,8 @@ var ts; this.RightTokenRange = RightTokenRange; } RuleDescriptor.prototype.toString = function () { - return "[leftRange=" + this.LeftTokenRange + "," + "rightRange=" + this.RightTokenRange + "]"; + return "[leftRange=" + this.LeftTokenRange + "," + + "rightRange=" + this.RightTokenRange + "]"; }; RuleDescriptor.create1 = function (left, right) { return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), formatting.Shared.TokenRange.FromToken(right)); @@ -21995,7 +23451,8 @@ var ts; this.Action = null; } RuleOperation.prototype.toString = function () { - return "[context=" + this.Context + "," + "action=" + this.Action + "]"; + return "[context=" + this.Context + "," + + "action=" + this.Action + "]"; }; RuleOperation.create1 = function (action) { return RuleOperation.create2(formatting.RuleOperationContext.Any, action); @@ -22115,47 +23572,29 @@ var ts; this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.FromTokens([16, 18, 25, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(14, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8)); - this.HighPriorityCommonRules = [ - this.IgnoreBeforeComment, - this.IgnoreAfterLineComment, - this.NoSpaceBeforeColon, - this.SpaceAfterColon, - this.NoSpaceBeforeQMark, - this.SpaceAfterQMark, - this.NoSpaceBeforeDot, - this.NoSpaceAfterDot, + this.HighPriorityCommonRules = + [ + this.IgnoreBeforeComment, this.IgnoreAfterLineComment, + this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQMark, this.SpaceAfterQMark, + this.NoSpaceBeforeDot, this.NoSpaceAfterDot, this.NoSpaceAfterUnaryPrefixOperator, - this.NoSpaceAfterUnaryPreincrementOperator, - this.NoSpaceAfterUnaryPredecrementOperator, - this.NoSpaceBeforeUnaryPostincrementOperator, - this.NoSpaceBeforeUnaryPostdecrementOperator, + this.NoSpaceAfterUnaryPreincrementOperator, this.NoSpaceAfterUnaryPredecrementOperator, + this.NoSpaceBeforeUnaryPostincrementOperator, this.NoSpaceBeforeUnaryPostdecrementOperator, this.SpaceAfterPostincrementWhenFollowedByAdd, - this.SpaceAfterAddWhenFollowedByUnaryPlus, - this.SpaceAfterAddWhenFollowedByPreincrement, + this.SpaceAfterAddWhenFollowedByUnaryPlus, this.SpaceAfterAddWhenFollowedByPreincrement, this.SpaceAfterPostdecrementWhenFollowedBySubtract, - this.SpaceAfterSubtractWhenFollowedByUnaryMinus, - this.SpaceAfterSubtractWhenFollowedByPredecrement, + this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement, this.NoSpaceAfterCloseBrace, - this.SpaceAfterOpenBrace, - this.SpaceBeforeCloseBrace, - this.NewLineBeforeCloseBraceInBlockContext, - this.SpaceAfterCloseBrace, - this.SpaceBetweenCloseBraceAndElse, - this.SpaceBetweenCloseBraceAndWhile, - this.NoSpaceBetweenEmptyBraceBrackets, - this.SpaceAfterFunctionInFuncDecl, - this.NewLineAfterOpenBraceInBlockContext, - this.SpaceAfterGetSetInMember, + this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NewLineBeforeCloseBraceInBlockContext, + this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets, + this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember, this.NoSpaceBetweenReturnAndSemicolon, this.SpaceAfterCertainKeywords, this.NoSpaceBeforeOpenParenInFuncCall, - this.SpaceBeforeBinaryKeywordOperator, - this.SpaceAfterBinaryKeywordOperator, + this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, this.SpaceAfterVoidOperator, - this.NoSpaceAfterConstructor, - this.NoSpaceAfterModuleImport, - this.SpaceAfterCertainTypeScriptKeywords, - this.SpaceBeforeCertainTypeScriptKeywords, + this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, + this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, this.SpaceAfterModuleName, this.SpaceAfterArrow, this.NoSpaceAfterEllipsis, @@ -22167,20 +23606,16 @@ var ts; this.NoSpaceBeforeCloseAngularBracket, this.NoSpaceAfterCloseAngularBracket ]; - this.LowPriorityCommonRules = [ + this.LowPriorityCommonRules = + [ this.NoSpaceBeforeSemicolon, - this.SpaceBeforeOpenBraceInControl, - this.SpaceBeforeOpenBraceInFunction, - this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, + this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, this.NoSpaceBeforeComma, - this.NoSpaceBeforeOpenBracket, - this.NoSpaceAfterOpenBracket, - this.NoSpaceBeforeCloseBracket, - this.NoSpaceAfterCloseBracket, + this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterOpenBracket, + this.NoSpaceBeforeCloseBracket, this.NoSpaceAfterCloseBracket, this.SpaceAfterSemicolon, this.NoSpaceBeforeOpenParenInFuncDecl, - this.SpaceBetweenStatements, - this.SpaceAfterTryFinally + this.SpaceBetweenStatements, this.SpaceAfterTryFinally ]; this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); @@ -22213,25 +23648,27 @@ var ts; throw new Error("Unknown rule"); }; Rules.IsForContext = function (context) { - return context.contextNode.kind === 177; + return context.contextNode.kind === 179; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 163: - case 164: + case 165: + case 166: return true; - case 197: - case 188: - case 124: - case 206: + case 200: + case 191: case 126: - case 125: + case 209: + case 128: + case 127: return context.currentTokenSpan.kind === 52 || context.nextTokenSpan.kind === 52; - case 178: + case 180: return context.currentTokenSpan.kind === 85 || context.nextTokenSpan.kind === 85; + case 181: + return context.currentTokenSpan.kind === 122 || context.nextTokenSpan.kind === 122; } return false; }; @@ -22261,26 +23698,26 @@ var ts; return true; } switch (node.kind) { - case 170: - case 183: - case 148: - case 196: + case 172: + case 186: + case 150: + case 199: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 190: - case 128: - case 127: + case 193: case 130: - case 131: - case 132: - case 156: case 129: - case 157: - case 192: + case 132: + case 133: + case 134: + case 158: + case 131: + case 159: + case 195: return true; } return false; @@ -22290,52 +23727,53 @@ var ts; }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 191: - case 192: case 194: - case 139: case 195: + case 197: + case 141: + case 198: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 191: - case 195: case 194: - case 170: - case 203: - case 196: - case 183: + case 198: + case 197: + case 172: + case 206: + case 199: + case 186: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 174: - case 183: - case 177: - case 178: case 176: case 186: - case 175: - case 182: - case 203: + case 179: + case 180: + case 181: + case 178: + case 189: + case 177: + case 185: + case 206: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 148; + return context.contextNode.kind === 150; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 151; + return context.contextNode.kind === 153; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 152; + return context.contextNode.kind === 154; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -22350,38 +23788,39 @@ var ts; return context.formattingRequestKind != 2; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 195; + return context.contextNode.kind === 198; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 139; + return context.contextNode.kind === 141; }; Rules.IsTypeArgumentOrParameter = function (token, parent) { if (token.kind !== 24 && token.kind !== 25) { return false; } switch (parent.kind) { + case 137: + case 194: + case 195: + case 193: + case 158: + case 159: + case 130: + case 129: + case 134: case 135: - case 191: - case 192: - case 190: - case 156: - case 157: - case 128: - case 127: - case 132: - case 133: - case 151: - case 152: + case 153: + case 154: return true; default: return false; } }; Rules.IsTypeArgumentOrParameterContext = function (context) { - return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); + return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || + Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 98 && context.currentTokenParent.kind === 160; + return context.currentTokenSpan.kind === 98 && context.currentTokenParent.kind === 162; }; return Rules; })(); @@ -22403,7 +23842,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 120 + 1; + this.mapRowLength = 122 + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); var rulesBucketConstructionStateList = new Array(this.map.length); this.FillRules(rules, rulesBucketConstructionStateList); @@ -22421,7 +23860,8 @@ var ts; }; RulesMap.prototype.FillRule = function (rule, rulesBucketConstructionStateList) { var _this = this; - var specificRule = rule.Descriptor.LeftTokenRange != formatting.Shared.TokenRange.Any && rule.Descriptor.RightTokenRange != formatting.Shared.TokenRange.Any; + var specificRule = rule.Descriptor.LeftTokenRange != formatting.Shared.TokenRange.Any && + rule.Descriptor.RightTokenRange != formatting.Shared.TokenRange.Any; rule.Descriptor.LeftTokenRange.GetTokens().forEach(function (left) { rule.Descriptor.RightTokenRange.GetTokens().forEach(function (right) { var rulesBucketIndex = _this.GetRuleBucketIndex(left, right); @@ -22571,7 +24011,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0; token <= 120; token++) { + for (var token = 0; token <= 122; token++) { result.push(token); } return result; @@ -22613,9 +24053,9 @@ var ts; }; TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3])); - TokenRange.Keywords = TokenRange.FromRange(65, 120); + TokenRange.Keywords = TokenRange.FromRange(65, 122); TokenRange.BinaryOperators = TokenRange.FromRange(24, 63); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([85, 86]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([85, 86, 122]); TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([38, 39, 47, 46]); TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([7, 64, 16, 18, 14, 92, 87]); TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([64, 16, 92, 87]); @@ -22623,7 +24063,7 @@ var ts; TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([64, 16, 92, 87]); TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([64, 17, 19, 87]); TokenRange.Comments = TokenRange.FromTokens([2, 3]); - TokenRange.TypeNames = TokenRange.FromTokens([64, 117, 119, 111, 98, 110]); + TokenRange.TypeNames = TokenRange.FromTokens([64, 117, 119, 111, 120, 98, 110]); return TokenRange; })(); Shared.TokenRange = TokenRange; @@ -22724,8 +24164,8 @@ var ts; Constants[Constants["Unknown"] = -1] = "Unknown"; })(Constants || (Constants = {})); function formatOnEnter(position, sourceFile, rulesProvider, options) { - var line = sourceFile.getLineAndCharacterFromPosition(position).line; - if (line === 1) { + var line = sourceFile.getLineAndCharacterOfPosition(position).line; + if (line === 0) { return []; } var span = { @@ -22753,7 +24193,7 @@ var ts; formatting.formatDocument = formatDocument; function formatSelection(start, end, sourceFile, rulesProvider, options) { var span = { - pos: ts.getStartLinePositionForPosition(start, sourceFile), + pos: ts.getLineStartPositionForPosition(start, sourceFile), end: end }; return formatSpan(span, sourceFile, options, rulesProvider, 1); @@ -22765,35 +24205,40 @@ var ts; return []; } var span = { - pos: ts.getStartLinePositionForPosition(parent.getStart(sourceFile), sourceFile), + pos: ts.getLineStartPositionForPosition(parent.getStart(sourceFile), sourceFile), end: parent.end }; return formatSpan(span, sourceFile, options, rulesProvider, requestKind); } function findOutermostParent(position, expectedTokenKind, sourceFile) { var precedingToken = ts.findPrecedingToken(position, sourceFile); - if (!precedingToken || precedingToken.kind !== expectedTokenKind || position !== precedingToken.getEnd()) { + if (!precedingToken || + precedingToken.kind !== expectedTokenKind || + position !== precedingToken.getEnd()) { return undefined; } var current = precedingToken; - while (current && current.parent && current.parent.end === precedingToken.end && !isListElement(current.parent, current)) { + while (current && + current.parent && + current.parent.end === precedingToken.end && + !isListElement(current.parent, current)) { current = current.parent; } return current; } function isListElement(parent, node) { switch (parent.kind) { - case 191: - case 192: - return ts.rangeContainsRange(parent.members, node); + case 194: case 195: + return ts.rangeContainsRange(parent.members, node); + case 198: var body = parent.body; - return body && body.kind === 170 && ts.rangeContainsRange(body.statements, node); - case 207: - case 170: - case 196: + return body && body.kind === 172 && ts.rangeContainsRange(body.statements, node); + case 210: + case 172: + case 199: return ts.rangeContainsRange(parent.statements, node); - case 203: + case 206: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -22857,7 +24302,7 @@ var ts; var previousLine = -1; var childKind = 0; while (n) { - var line = sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)).line; + var line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line; if (previousLine !== -1 && line !== previousLine) { break; } @@ -22883,7 +24328,7 @@ var ts; var edits = []; formattingScanner.advance(); if (formattingScanner.isOnToken()) { - var startLine = sourceFile.getLineAndCharacterFromPosition(enclosingNode.getStart(sourceFile)).line; + var startLine = sourceFile.getLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line; var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile); processNode(enclosingNode, enclosingNode, startLine, initialIndentation, delta); } @@ -22896,8 +24341,8 @@ var ts; } } else { - var startLine = sourceFile.getLineAndCharacterFromPosition(startPos).line; - var startLinePosition = ts.getStartLinePositionForPosition(startPos, sourceFile); + var startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line; + var startLinePosition = ts.getLineStartPositionForPosition(startPos, sourceFile); var column = formatting.SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options); if (startLine !== parentStartLine || startPos === column) { return column; @@ -22909,7 +24354,10 @@ var ts; var indentation = inheritedIndentation; if (indentation === -1) { if (isSomeBlock(node.kind)) { - if (isSomeBlock(parent.kind) || parent.kind === 207 || parent.kind === 200 || parent.kind === 201) { + if (isSomeBlock(parent.kind) || + parent.kind === 210 || + parent.kind === 203 || + parent.kind === 204) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -22998,7 +24446,7 @@ var ts; } function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, isListItem) { var childStartPos = child.getStart(sourceFile); - var childStart = sourceFile.getLineAndCharacterFromPosition(childStartPos); + var childStart = sourceFile.getLineAndCharacterOfPosition(childStartPos); var childIndentationAmount = -1; if (isListItem) { childIndentationAmount = tryComputeIndentationForListItem(childStartPos, child.end, parentStartLine, originalRange, inheritedIndentation); @@ -23045,7 +24493,7 @@ var ts; break; } else if (tokenInfo.token.kind === listStartToken) { - startLine = sourceFile.getLineAndCharacterFromPosition(tokenInfo.token.pos).line; + startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; var indentation = computeIndentation(tokenInfo.token, startLine, -1, parent, parentDynamicIndentation, startLine); listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation.indentation, indentation.delta); consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); @@ -23077,7 +24525,7 @@ var ts; } var lineAdded; var isTokenInRange = ts.rangeContainsRange(originalRange, currentTokenInfo.token); - var tokenStart = sourceFile.getLineAndCharacterFromPosition(currentTokenInfo.token.pos); + var tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos); if (isTokenInRange) { var rangeHasError = rangeContainsError(currentTokenInfo.token); var prevStartLine = previousRangeStartLine; @@ -23105,7 +24553,7 @@ var ts; if (!ts.rangeContainsRange(originalRange, triviaItem)) { continue; } - var triviaStartLine = sourceFile.getLineAndCharacterFromPosition(triviaItem.pos).line; + var triviaStartLine = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos).line; switch (triviaItem.kind) { case 3: var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); @@ -23138,7 +24586,7 @@ var ts; for (var i = 0, len = trivia.length; i < len; ++i) { var triviaItem = trivia[i]; if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { - var triviaItemStart = sourceFile.getLineAndCharacterFromPosition(triviaItem.pos); + var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation); } } @@ -23148,11 +24596,12 @@ var ts; var lineAdded; if (!rangeHasError && !previousRangeHasError) { if (!previousRange) { - var originalStart = sourceFile.getLineAndCharacterFromPosition(originalRange.pos); + var originalStart = sourceFile.getLineAndCharacterOfPosition(originalRange.pos); trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); } else { - lineAdded = processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); + lineAdded = + processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); } } previousRange = range; @@ -23180,7 +24629,9 @@ var ts; dynamicIndentation.recomputeIndentation(true); } } - trimTrailingWhitespaces = (rule.Operation.Action & (4 | 2)) && rule.Flag !== 1; + trimTrailingWhitespaces = + (rule.Operation.Action & (4 | 2)) && + rule.Flag !== 1; } else { trimTrailingWhitespaces = true; @@ -23196,16 +24647,16 @@ var ts; recordReplace(pos, 0, indentationString); } else { - var tokenStart = sourceFile.getLineAndCharacterFromPosition(pos); - if (indentation !== tokenStart.character - 1) { + var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos); + if (indentation !== tokenStart.character) { var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile); - recordReplace(startLinePosition, tokenStart.character - 1, indentationString); + recordReplace(startLinePosition, tokenStart.character, indentationString); } } } function indentMultilineComment(commentRange, indentation, firstLineIsIndented) { - var startLine = sourceFile.getLineAndCharacterFromPosition(commentRange.pos).line; - var endLine = sourceFile.getLineAndCharacterFromPosition(commentRange.end).line; + var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; + var endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line; if (startLine === endLine) { if (!firstLineIsIndented) { insertIndentation(commentRange.pos, indentation, false); @@ -23309,20 +24760,20 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 170: - case 196: + case 172: + case 199: return true; } return false; } function getOpenTokenForList(node, list) { switch (node.kind) { + case 131: + case 193: + case 158: + case 130: case 129: - case 190: - case 156: - case 128: - case 127: - case 157: + case 159: if (node.typeParameters === list) { return 24; } @@ -23330,8 +24781,8 @@ var ts; return 16; } break; - case 151: - case 152: + case 153: + case 154: if (node.typeArguments === list) { return 24; } @@ -23339,7 +24790,7 @@ var ts; return 16; } break; - case 135: + case 137: if (node.typeArguments === list) { return 24; } @@ -23414,12 +24865,17 @@ var ts; if (!precedingToken) { return 0; } - var precedingTokenIsLiteral = precedingToken.kind === 8 || precedingToken.kind === 9 || precedingToken.kind === 10 || precedingToken.kind === 11 || precedingToken.kind === 12 || precedingToken.kind === 13; + var precedingTokenIsLiteral = precedingToken.kind === 8 || + precedingToken.kind === 9 || + precedingToken.kind === 10 || + precedingToken.kind === 11 || + precedingToken.kind === 12 || + precedingToken.kind === 13; if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) { return 0; } - var lineAtPosition = sourceFile.getLineAndCharacterFromPosition(position).line; - if (precedingToken.kind === 23 && precedingToken.parent.kind !== 163) { + var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; + if (precedingToken.kind === 23 && precedingToken.parent.kind !== 165) { var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1) { return actualIndentation; @@ -23454,7 +24910,7 @@ var ts; } SmartIndenter.getIndentation = getIndentation; function getIndentationForNode(n, ignoreActualIndentationRange, sourceFile, options) { - var start = sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)); + var start = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, 0, sourceFile, options); } SmartIndenter.getIndentationForNode = getIndentationForNode; @@ -23474,7 +24930,8 @@ var ts; } } parentStart = getParentStart(parent, current, sourceFile); - var parentAndChildShareLine = parentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); + var parentAndChildShareLine = parentStart.line === currentStart.line || + childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); if (useActualIndentation) { var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options); if (actualIndentation !== -1) { @@ -23493,9 +24950,9 @@ var ts; function getParentStart(parent, child, sourceFile) { var containingList = getContainingList(child, sourceFile); if (containingList) { - return sourceFile.getLineAndCharacterFromPosition(containingList.pos); + return sourceFile.getLineAndCharacterOfPosition(containingList.pos); } - return sourceFile.getLineAndCharacterFromPosition(parent.getStart(sourceFile)); + return sourceFile.getLineAndCharacterOfPosition(parent.getStart(sourceFile)); } function getActualIndentationForListItemBeforeComma(commaToken, sourceFile, options) { var commaItemInfo = ts.findListItemInfo(commaToken); @@ -23503,7 +24960,8 @@ var ts; return deriveActualIndentationFromList(commaItemInfo.list.getChildren(), commaItemInfo.listItemIndex - 1, sourceFile, options); } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { - var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && (parent.kind === 207 || !parentAndChildShareLine); + var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && + (parent.kind === 210 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -23524,13 +24982,13 @@ var ts; return false; } function getStartLineAndCharacterForNode(n, sourceFile) { - return sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)); + return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function positionBelongsToNode(candidate, position, sourceFile) { return candidate.end > position || !isCompletedNode(candidate, sourceFile); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 174 && parent.elseStatement === child) { + if (parent.kind === 176 && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 75, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -23542,37 +25000,41 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 135: - if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { + case 137: + if (node.parent.typeArguments && + ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 148: + case 150: return node.parent.properties; - case 147: + case 149: return node.parent.elements; - case 190: - case 156: - case 157: - case 128: - case 127: - case 132: - case 133: + case 193: + case 158: + case 159: + case 130: + case 129: + case 134: + case 135: var start = node.getStart(sourceFile); - if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { + if (node.parent.typeParameters && + ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { return node.parent.typeParameters; } if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { return node.parent.parameters; } break; - case 152: - case 151: + case 154: + case 153: var start = node.getStart(sourceFile); - if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { + if (node.parent.typeArguments && + ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { return node.parent.typeArguments; } - if (node.parent.arguments && ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) { + if (node.parent.arguments && + ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) { return node.parent.arguments; } break; @@ -23596,7 +25058,7 @@ var ts; if (list[i].kind === 23) { continue; } - var prevEndLine = sourceFile.getLineAndCharacterFromPosition(list[i].end).line; + var prevEndLine = sourceFile.getLineAndCharacterOfPosition(list[i].end).line; if (prevEndLine !== lineAndCharacter.line) { return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options); } @@ -23605,7 +25067,7 @@ var ts; return -1; } function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options) { - var lineStart = sourceFile.getPositionFromLineAndCharacter(lineAndCharacter.line, 1); + var lineStart = sourceFile.getPositionOfLineAndCharacter(lineAndCharacter.line, 0); return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options); } function findFirstNonWhitespaceColumn(startPos, endPos, sourceFile, options) { @@ -23627,25 +25089,25 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 191: - case 192: case 194: - case 147: - case 170: - case 196: - case 148: - case 139: - case 183: + case 195: + case 197: + case 149: + case 172: + case 199: + case 150: + case 141: + case 186: + case 204: + case 203: + case 157: + case 153: + case 154: + case 173: + case 191: case 201: - case 200: - case 155: - case 151: - case 152: - case 171: - case 188: - case 198: - case 181: - case 164: + case 184: + case 166: return true; } return false; @@ -23655,20 +25117,21 @@ var ts; return true; } switch (parent) { - case 175: - case 176: - case 178: case 177: - case 174: - case 190: - case 156: - case 128: - case 127: - case 157: - case 129: + case 178: + case 180: + case 181: + case 179: + case 176: + case 193: + case 158: case 130: + case 129: + case 159: case 131: - return child !== 170; + case 132: + case 133: + return child !== 172; default: return false; } @@ -23692,44 +25155,44 @@ var ts; return false; } switch (n.kind) { - case 191: - case 192: case 194: - case 148: - case 170: - case 196: - case 183: - return nodeEndsWith(n, 15, sourceFile); - case 203: - return isCompletedNode(n.block, sourceFile); - case 155: - case 132: - case 151: - case 133: - return nodeEndsWith(n, 17, sourceFile); - case 190: - case 156: - case 128: - case 127: - case 157: - return !n.body || isCompletedNode(n.body, sourceFile); case 195: + case 197: + case 150: + case 172: + case 199: + case 186: + return nodeEndsWith(n, 15, sourceFile); + case 206: + return isCompletedNode(n.block, sourceFile); + case 157: + case 134: + case 153: + case 135: + return nodeEndsWith(n, 17, sourceFile); + case 193: + case 158: + case 130: + case 129: + case 159: + return !n.body || isCompletedNode(n.body, sourceFile); + case 198: return n.body && isCompletedNode(n.body, sourceFile); - case 174: + case 176: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 173: - return isCompletedNode(n.expression, sourceFile); - case 147: - return nodeEndsWith(n, 19, sourceFile); - case 200: - case 201: - return false; - case 176: - return isCompletedNode(n.statement, sourceFile); case 175: + return isCompletedNode(n.expression, sourceFile); + case 149: + return nodeEndsWith(n, 19, sourceFile); + case 203: + case 204: + return false; + case 178: + return isCompletedNode(n.statement, sourceFile); + case 177: var hasWhileKeyword = ts.findChildOfKind(n, 99, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 17, sourceFile); @@ -23825,7 +25288,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(208, nodes.pos, nodes.end, 512, this); + var list = createNode(211, nodes.pos, nodes.end, 512, this); list._children = []; var pos = nodes.pos; for (var i = 0, len = nodes.length; i < len; i++) { @@ -23843,7 +25306,7 @@ var ts; }; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; - if (this.kind >= 121) { + if (this.kind >= 123) { scanner.setText((sourceFile || this.getSourceFile()).text); var children = []; var pos = this.pos; @@ -23888,7 +25351,7 @@ var ts; var children = this.getChildren(); for (var i = 0; i < children.length; i++) { var child = children[i]; - if (child.kind < 121) { + if (child.kind < 123) { return child; } return child.getFirstToken(sourceFile); @@ -23898,7 +25361,7 @@ var ts; var children = this.getChildren(sourceFile); for (var i = children.length - 1; i >= 0; i--) { var child = children[i]; - if (child.kind < 121) { + if (child.kind < 123) { return child; } return child.getLastToken(sourceFile); @@ -23944,7 +25407,7 @@ var ts; ts.forEach(declarations, function (declaration, indexOfDeclaration) { if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { var sourceFileOfDeclaration = ts.getSourceFileOfNode(declaration); - if (canUseParsedParamTagComments && declaration.kind === 124) { + if (canUseParsedParamTagComments && declaration.kind === 126) { ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedParamJsDocComment) { @@ -23952,13 +25415,13 @@ var ts; } }); } - if (declaration.kind === 195 && declaration.body.kind === 195) { + if (declaration.kind === 198 && declaration.body.kind === 198) { return; } - while (declaration.kind === 195 && declaration.parent.kind === 195) { + while (declaration.kind === 198 && declaration.parent.kind === 198) { declaration = declaration.parent; } - ts.forEach(getJsDocCommentTextRange(declaration.kind === 188 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 191 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedJsDocComment) { jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment); @@ -23994,7 +25457,10 @@ var ts; return pos; } function isName(pos, end, sourceFile, name) { - return pos + name.length < end && sourceFile.text.substr(pos, name.length) === name && (ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)) || ts.isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); + return pos + name.length < end && + sourceFile.text.substr(pos, name.length) === name && + (ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)) || + ts.isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); } function isParamTag(pos, end, sourceFile) { return isName(pos, end, sourceFile, paramTag); @@ -24140,7 +25606,7 @@ var ts; return; } if (paramHelpStringMargin === undefined) { - paramHelpStringMargin = sourceFile.getLineAndCharacterFromPosition(firstLineParamHelpStringPos).character - 1; + paramHelpStringMargin = sourceFile.getLineAndCharacterOfPosition(firstLineParamHelpStringPos).character; } var startOfLinePos = pos; pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile, paramHelpStringMargin); @@ -24224,14 +25690,14 @@ var ts; SourceFileObject.prototype.update = function (newText, textChangeRange) { return ts.updateSourceFile(this, newText, textChangeRange); }; - SourceFileObject.prototype.getLineAndCharacterFromPosition = function (position) { + SourceFileObject.prototype.getLineAndCharacterOfPosition = function (position) { return ts.getLineAndCharacterOfPosition(this, position); }; SourceFileObject.prototype.getLineStarts = function () { return ts.getLineStarts(this); }; - SourceFileObject.prototype.getPositionFromLineAndCharacter = function (line, character) { - return ts.getPositionFromLineAndCharacter(this, line, character); + SourceFileObject.prototype.getPositionOfLineAndCharacter = function (line, character) { + return ts.getPositionOfLineAndCharacter(this, line, character); }; SourceFileObject.prototype.getNamedDeclarations = function () { if (!this.namedDeclarations) { @@ -24239,9 +25705,9 @@ var ts; var namedDeclarations = []; ts.forEachChild(sourceFile, function visit(node) { switch (node.kind) { - case 190: - case 128: - case 127: + case 193: + case 130: + case 129: var functionDeclaration = node; if (functionDeclaration.name && functionDeclaration.name.getFullWidth() > 0) { var lastDeclaration = namedDeclarations.length > 0 ? namedDeclarations[namedDeclarations.length - 1] : undefined; @@ -24256,44 +25722,44 @@ var ts; ts.forEachChild(node, visit); } break; - case 191: - case 192: - case 193: case 194: case 195: + case 196: case 197: - case 130: - case 131: - case 139: + case 198: + case 200: + case 132: + case 133: + case 141: if (node.name) { namedDeclarations.push(node); } - case 129: - case 171: - case 189: - case 144: - case 145: - case 196: + case 131: + case 173: + case 192: + case 146: + case 147: + case 199: ts.forEachChild(node, visit); break; - case 170: + case 172: if (ts.isFunctionBlock(node)) { ts.forEachChild(node, visit); } break; - case 124: + case 126: if (!(node.flags & 112)) { break; } - case 188: - case 146: + case 191: + case 148: if (ts.isBindingPattern(node.name)) { ts.forEachChild(node.name, visit); break; } - case 206: - case 126: - case 125: + case 209: + case 128: + case 127: namedDeclarations.push(node); break; } @@ -24346,6 +25812,9 @@ var ts; EndOfLineState[EndOfLineState["InMultiLineCommentTrivia"] = 1] = "InMultiLineCommentTrivia"; EndOfLineState[EndOfLineState["InSingleQuoteStringLiteral"] = 2] = "InSingleQuoteStringLiteral"; EndOfLineState[EndOfLineState["InDoubleQuoteStringLiteral"] = 3] = "InDoubleQuoteStringLiteral"; + EndOfLineState[EndOfLineState["InTemplateHeadOrNoSubstitutionTemplate"] = 4] = "InTemplateHeadOrNoSubstitutionTemplate"; + EndOfLineState[EndOfLineState["InTemplateMiddleOrTail"] = 5] = "InTemplateMiddleOrTail"; + EndOfLineState[EndOfLineState["InTemplateSubstitutionPosition"] = 6] = "InTemplateSubstitutionPosition"; })(ts.EndOfLineState || (ts.EndOfLineState = {})); var EndOfLineState = ts.EndOfLineState; (function (TokenClass) { @@ -24427,13 +25896,6 @@ var ts; return ClassificationTypeNames; })(); ts.ClassificationTypeNames = ClassificationTypeNames; - var MatchKind; - (function (MatchKind) { - MatchKind[MatchKind["none"] = 0] = "none"; - MatchKind[MatchKind["exact"] = 1] = "exact"; - MatchKind[MatchKind["substring"] = 2] = "substring"; - MatchKind[MatchKind["prefix"] = 3] = "prefix"; - })(MatchKind || (MatchKind = {})); function displayPartsToString(displayParts) { if (displayParts) { return ts.map(displayParts, function (displayPart) { return displayPart.text; }).join(""); @@ -24446,14 +25908,14 @@ var ts; return false; } return ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 156) { + if (declaration.kind === 158) { return true; } - if (declaration.kind !== 188 && declaration.kind !== 190) { + if (declaration.kind !== 191 && declaration.kind !== 193) { return false; } for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { - if (parent.kind === 207 || parent.kind === 196) { + if (parent.kind === 210 || parent.kind === 199) { return false; } } @@ -24611,24 +26073,11 @@ var ts; } ts.createLanguageServiceSourceFile = createLanguageServiceSourceFile; ts.disableIncrementalParsing = false; - function updateLanguageServiceSourceFile(sourceFile, scriptSnapshot, version, textChangeRange) { - if (textChangeRange && ts.Debug.shouldAssert(1)) { - var oldText = sourceFile.scriptSnapshot; - var newText = scriptSnapshot; - ts.Debug.assert((oldText.getLength() - textChangeRange.span.length + textChangeRange.newLength) === newText.getLength()); - if (ts.Debug.shouldAssert(3)) { - var oldTextPrefix = oldText.getText(0, textChangeRange.span.start); - var newTextPrefix = newText.getText(0, textChangeRange.span.start); - ts.Debug.assert(oldTextPrefix === newTextPrefix); - var oldTextSuffix = oldText.getText(ts.textSpanEnd(textChangeRange.span), oldText.getLength()); - var newTextSuffix = newText.getText(ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange)), newText.getLength()); - ts.Debug.assert(oldTextSuffix === newTextSuffix); - } - } + function updateLanguageServiceSourceFile(sourceFile, scriptSnapshot, version, textChangeRange, aggressiveChecks) { if (textChangeRange) { if (version !== sourceFile.version) { if (!ts.disableIncrementalParsing) { - var newSourceFile = ts.updateSourceFile(sourceFile, scriptSnapshot.getText(0, scriptSnapshot.getLength()), textChangeRange); + var newSourceFile = ts.updateSourceFile(sourceFile, scriptSnapshot.getText(0, scriptSnapshot.getLength()), textChangeRange, aggressiveChecks); setSourceFileFields(newSourceFile, scriptSnapshot, version); newSourceFile.nameTable = undefined; return newSourceFile; @@ -24771,7 +26220,7 @@ var ts; ts.preProcessFile = preProcessFile; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 184 && referenceNode.label.text === labelName) { + if (referenceNode.kind === 187 && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -24779,13 +26228,17 @@ var ts; return undefined; } function isJumpStatementTarget(node) { - return node.kind === 64 && (node.parent.kind === 180 || node.parent.kind === 179) && node.parent.label === node; + return node.kind === 64 && + (node.parent.kind === 183 || node.parent.kind === 182) && + node.parent.label === node; } function isLabelOfLabeledStatement(node) { - return node.kind === 64 && node.parent.kind === 184 && node.parent.label === node; + return node.kind === 64 && + node.parent.kind === 187 && + node.parent.label === node; } function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 184; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 187; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -24796,46 +26249,48 @@ var ts; return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); } function isRightSideOfQualifiedName(node) { - return node.parent.kind === 121 && node.parent.right === node; + return node.parent.kind === 123 && node.parent.right === node; } function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 149 && node.parent.name === node; + return node && node.parent && node.parent.kind === 151 && node.parent.name === node; } function isCallExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 151 && node.parent.expression === node; + return node && node.parent && node.parent.kind === 153 && node.parent.expression === node; } function isNewExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 152 && node.parent.expression === node; + return node && node.parent && node.parent.kind === 154 && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 195 && node.parent.name === node; + return node.parent.kind === 198 && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { - return node.kind === 64 && ts.isAnyFunction(node.parent) && node.parent.name === node; + return node.kind === 64 && + ts.isAnyFunction(node.parent) && node.parent.name === node; } function isNameOfPropertyAssignment(node) { - return (node.kind === 64 || node.kind === 8 || node.kind === 7) && (node.parent.kind === 204 || node.parent.kind === 205) && node.parent.name === node; + return (node.kind === 64 || node.kind === 8 || node.kind === 7) && + (node.parent.kind === 207 || node.parent.kind === 208) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 8 || node.kind === 7) { switch (node.parent.kind) { - case 126: - case 125: - case 204: - case 206: case 128: case 127: + case 207: + case 209: case 130: - case 131: - case 195: + case 129: + case 132: + case 133: + case 198: return node.parent.name === node; - case 150: + case 152: return node.parent.argumentExpression === node; } } @@ -24843,12 +26298,15 @@ var ts; } function isNameOfExternalModuleImportOrDeclaration(node) { if (node.kind === 8) { - return isNameOfModuleDeclaration(node) || (ts.isExternalModuleImportDeclaration(node.parent.parent) && ts.getExternalModuleImportDeclarationExpression(node.parent.parent) === node); + return isNameOfModuleDeclaration(node) || + (ts.isExternalModuleImportDeclaration(node.parent.parent) && ts.getExternalModuleImportDeclarationExpression(node.parent.parent) === node); } return false; } function isInsideComment(sourceFile, token, position) { - return position <= token.getStart(sourceFile) && (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); + return position <= token.getStart(sourceFile) && + (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || + isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); function isInsideCommentRange(comments) { return ts.forEach(comments, function (comment) { if (comment.pos < position && position < comment.end) { @@ -24861,7 +26319,8 @@ var ts; return true; } else { - return !(text.charCodeAt(comment.end - 1) === 47 && text.charCodeAt(comment.end - 2) === 42); + return !(text.charCodeAt(comment.end - 1) === 47 && + text.charCodeAt(comment.end - 2) === 42); } } return false; @@ -24884,13 +26343,65 @@ var ts; BreakContinueSearchType[BreakContinueSearchType["All"] = 3] = "All"; })(BreakContinueSearchType || (BreakContinueSearchType = {})); var keywordCompletions = []; - for (var i = 65; i <= 120; i++) { + for (var i = 65; i <= 122; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ScriptElementKind.keyword, kindModifiers: ScriptElementKindModifier.none }); } + function getContainerNode(node) { + while (true) { + node = node.parent; + if (!node) { + return undefined; + } + switch (node.kind) { + case 210: + case 130: + case 129: + case 193: + case 158: + case 132: + case 133: + case 194: + case 195: + case 197: + case 198: + return node; + } + } + } + ts.getContainerNode = getContainerNode; + function getNodeKind(node) { + switch (node.kind) { + case 198: return ScriptElementKind.moduleElement; + case 194: return ScriptElementKind.classElement; + case 195: return ScriptElementKind.interfaceElement; + case 196: return ScriptElementKind.typeElement; + case 197: return ScriptElementKind.enumElement; + case 191: + return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; + case 193: return ScriptElementKind.functionElement; + case 132: return ScriptElementKind.memberGetAccessorElement; + case 133: return ScriptElementKind.memberSetAccessorElement; + case 130: + case 129: + return ScriptElementKind.memberFunctionElement; + case 128: + case 127: + return ScriptElementKind.memberVariableElement; + case 136: return ScriptElementKind.indexSignatureElement; + case 135: return ScriptElementKind.constructSignatureElement; + case 134: return ScriptElementKind.callSignatureElement; + case 131: return ScriptElementKind.constructorImplementationElement; + case 125: return ScriptElementKind.typeParameterElement; + case 209: return ScriptElementKind.variableElement; + case 126: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + } + return ScriptElementKind.unknown; + } + ts.getNodeKind = getNodeKind; function createLanguageService(host, documentRegistry) { if (documentRegistry === void 0) { documentRegistry = createDocumentRegistry(); } var syntaxTreeCache = new SyntaxTreeCache(host); @@ -24940,8 +26451,7 @@ var ts; useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; }, getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, - writeFile: function (fileName, data, writeByteOrderMark) { - }, + writeFile: function (fileName, data, writeByteOrderMark) { }, getCurrentDirectory: function () { return host.getCurrentDirectory(); } }); if (program) { @@ -24957,7 +26467,6 @@ var ts; typeInfoResolver = program.getTypeChecker(); return; function getOrCreateSourceFile(fileName) { - cancellationToken.throwIfCancellationRequested(); var hostFileInformation = hostCache.getOrCreateEntry(fileName); if (!hostFileInformation) { return undefined; @@ -25004,9 +26513,7 @@ var ts; } function dispose() { if (program) { - ts.forEach(program.getSourceFiles(), function (f) { - documentRegistry.releaseDocument(f.fileName, program.getCompilerOptions()); - }); + ts.forEach(program.getSourceFiles(), function (f) { documentRegistry.releaseDocument(f.fileName, program.getCompilerOptions()); }); } } function getSyntacticDiagnostics(fileName) { @@ -25036,7 +26543,8 @@ var ts; if ((symbol.flags & 1536) && (firstCharCode === 39 || firstCharCode === 34)) { return undefined; } - if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) && (firstCharCode === 39 || firstCharCode === 34)) { + if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) && + (firstCharCode === 39 || firstCharCode === 34)) { displayName = displayName.substring(1, displayName.length - 1); } var isValid = ts.isIdentifierStart(displayName.charCodeAt(0), target); @@ -25089,11 +26597,11 @@ var ts; } var node; var isRightOfDot; - if (previousToken && previousToken.kind === 20 && previousToken.parent.kind === 149) { + if (previousToken && previousToken.kind === 20 && previousToken.parent.kind === 151) { node = previousToken.parent.expression; isRightOfDot = true; } - else if (previousToken && previousToken.kind === 20 && previousToken.parent.kind === 121) { + else if (previousToken && previousToken.kind === 20 && previousToken.parent.kind === 123) { node = previousToken.parent.left; isRightOfDot = true; } @@ -25115,7 +26623,7 @@ var ts; var symbols = []; var isMemberCompletion = true; var isNewIdentifierLocation = false; - if (node.kind === 64 || node.kind === 121 || node.kind === 149) { + if (node.kind === 64 || node.kind === 123 || node.kind === 151) { var symbol = typeInfoResolver.getSymbolAtLocation(node); if (symbol && symbol.flags & 8388608) { symbol = typeInfoResolver.getAliasedSymbol(symbol); @@ -25187,7 +26695,9 @@ var ts; } function isCompletionListBlocker(previousToken) { var start = new Date().getTime(); - var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || isIdentifierDefinitionLocation(previousToken) || isRightOfIllegalDot(previousToken); + var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || + isIdentifierDefinitionLocation(previousToken) || + isRightOfIllegalDot(previousToken); log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start)); return result; } @@ -25196,27 +26706,27 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 151 || containingNodeKind === 129 || containingNodeKind === 152 || containingNodeKind === 147 || containingNodeKind === 163; + return containingNodeKind === 153 || containingNodeKind === 131 || containingNodeKind === 154 || containingNodeKind === 149 || containingNodeKind === 165; case 16: - return containingNodeKind === 151 || containingNodeKind === 129 || containingNodeKind === 152 || containingNodeKind === 155; + return containingNodeKind === 153 || containingNodeKind === 131 || containingNodeKind === 154 || containingNodeKind === 157; case 18: - return containingNodeKind === 147; + return containingNodeKind === 149; case 115: return true; case 20: - return containingNodeKind === 195; + return containingNodeKind === 198; case 14: - return containingNodeKind === 191; + return containingNodeKind === 194; case 52: - return containingNodeKind === 188 || containingNodeKind === 163; + return containingNodeKind === 191 || containingNodeKind === 165; case 11: - return containingNodeKind === 165; + return containingNodeKind === 167; case 12: - return containingNodeKind === 169; + return containingNodeKind === 171; case 107: case 105: case 106: - return containingNodeKind === 126; + return containingNodeKind === 128; } switch (previousToken.getText()) { case "public": @@ -25246,7 +26756,7 @@ var ts; switch (previousToken.kind) { case 14: case 23: - if (parent && parent.kind === 148) { + if (parent && parent.kind === 150) { return parent; } break; @@ -25256,16 +26766,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 156: - case 157: - case 190: - case 128: - case 127: + case 158: + case 159: + case 193: case 130: - case 131: + case 129: case 132: case 133: case 134: + case 135: + case 136: return true; } return false; @@ -25275,27 +26785,47 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 188 || containingNodeKind === 189 || containingNodeKind === 171 || containingNodeKind === 194 || isFunction(containingNodeKind) || containingNodeKind === 191 || containingNodeKind === 190 || containingNodeKind === 192 || containingNodeKind === 145 || containingNodeKind === 144; + return containingNodeKind === 191 || + containingNodeKind === 192 || + containingNodeKind === 173 || + containingNodeKind === 197 || + isFunction(containingNodeKind) || + containingNodeKind === 194 || + containingNodeKind === 193 || + containingNodeKind === 195 || + containingNodeKind === 147 || + containingNodeKind === 146; case 20: - return containingNodeKind === 145; + return containingNodeKind === 147; case 18: - return containingNodeKind === 145; + return containingNodeKind === 147; case 16: - return containingNodeKind === 203 || isFunction(containingNodeKind); + return containingNodeKind === 206 || + isFunction(containingNodeKind); case 14: - return containingNodeKind === 194 || containingNodeKind === 192 || containingNodeKind === 139 || containingNodeKind === 144; + return containingNodeKind === 197 || + containingNodeKind === 195 || + containingNodeKind === 141 || + containingNodeKind === 146; case 22: - return containingNodeKind === 125 && (previousToken.parent.parent.kind === 192 || previousToken.parent.parent.kind === 139); + return containingNodeKind === 127 && + (previousToken.parent.parent.kind === 195 || + previousToken.parent.parent.kind === 141); case 24: - return containingNodeKind === 191 || containingNodeKind === 190 || containingNodeKind === 192 || isFunction(containingNodeKind); + return containingNodeKind === 194 || + containingNodeKind === 193 || + containingNodeKind === 195 || + isFunction(containingNodeKind); case 108: - return containingNodeKind === 126; + return containingNodeKind === 128; case 21: - return containingNodeKind === 124 || containingNodeKind === 129 || (previousToken.parent.parent.kind === 145); + return containingNodeKind === 126 || + containingNodeKind === 131 || + (previousToken.parent.parent.kind === 147); case 107: case 105: case 106: - return containingNodeKind === 124; + return containingNodeKind === 126; case 68: case 76: case 102: @@ -25337,7 +26867,7 @@ var ts; } var existingMemberNames = {}; ts.forEach(existingMembers, function (m) { - if (m.kind !== 204 && m.kind !== 205) { + if (m.kind !== 207 && m.kind !== 208) { return; } if (m.getStart() <= position && position <= m.getEnd()) { @@ -25385,28 +26915,6 @@ var ts; }; } } - function getContainerNode(node) { - while (true) { - node = node.parent; - if (!node) { - return undefined; - } - switch (node.kind) { - case 207: - case 128: - case 127: - case 190: - case 156: - case 130: - case 131: - case 191: - case 192: - case 194: - case 195: - return node; - } - } - } function getSymbolKind(symbol, typeResolver, location) { var flags = symbol.getFlags(); if (flags & 32) @@ -25493,40 +27001,12 @@ var ts; return ScriptElementKind.interfaceElement; if (flags & 512) return ScriptElementKind.typeParameterElement; - if (flags & 127) + if (flags & 1048703) return ScriptElementKind.primitiveType; if (flags & 256) return ScriptElementKind.primitiveType; return ScriptElementKind.unknown; } - function getNodeKind(node) { - switch (node.kind) { - case 195: return ScriptElementKind.moduleElement; - case 191: return ScriptElementKind.classElement; - case 192: return ScriptElementKind.interfaceElement; - case 193: return ScriptElementKind.typeElement; - case 194: return ScriptElementKind.enumElement; - case 188: - return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 190: return ScriptElementKind.functionElement; - case 130: return ScriptElementKind.memberGetAccessorElement; - case 131: return ScriptElementKind.memberSetAccessorElement; - case 128: - case 127: - return ScriptElementKind.memberFunctionElement; - case 126: - case 125: - return ScriptElementKind.memberVariableElement; - case 134: return ScriptElementKind.indexSignatureElement; - case 133: return ScriptElementKind.constructSignatureElement; - case 132: return ScriptElementKind.callSignatureElement; - case 129: return ScriptElementKind.constructorImplementationElement; - case 123: return ScriptElementKind.typeParameterElement; - case 206: return ScriptElementKind.variableElement; - case 124: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - } - return ScriptElementKind.unknown; - } function getSymbolModifiers(symbol) { return symbol && symbol.declarations && symbol.declarations.length > 0 ? ts.getNodeModifiers(symbol.declarations[0]) : ScriptElementKindModifier.none; } @@ -25543,14 +27023,14 @@ var ts; } var type = typeResolver.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 149) { + if (location.parent && location.parent.kind === 151) { var right = location.parent.name; if (right === location || (right && right.getFullWidth() === 0)) { location = location.parent; } } var callExpression; - if (location.kind === 151 || location.kind === 152) { + if (location.kind === 153 || location.kind === 154) { callExpression = location; } else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { @@ -25562,7 +27042,7 @@ var ts; if (!signature && candidateSignatures.length) { signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 152 || callExpression.expression.kind === 90; + var useConstructSignatures = callExpression.kind === 154 || callExpression.expression.kind === 90; var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target || signature)) { signature = allSignatures.length ? allSignatures[0] : undefined; @@ -25611,22 +27091,24 @@ var ts; hasAddedSymbolInfo = true; } } - else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || (location.kind === 112 && location.parent.kind === 129)) { + else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || + (location.kind === 112 && location.parent.kind === 131)) { var signature; var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 129 ? type.getConstructSignatures() : type.getCallSignatures(); + var allSignatures = functionDeclaration.kind === 131 ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeResolver.isImplementationOfOverload(functionDeclaration)) { signature = typeResolver.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 129) { + if (functionDeclaration.kind === 131) { symbolKind = ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 132 && !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 134 && + !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); hasAddedSymbolInfo = true; @@ -25648,7 +27130,7 @@ var ts; } if (symbolFlags & 524288) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(120)); + displayParts.push(ts.keywordPart(121)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); displayParts.push(ts.spacePart()); @@ -25687,13 +27169,13 @@ var ts; writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); } else { - var signatureDeclaration = ts.getDeclarationOfKind(symbol, 123).parent; + var signatureDeclaration = ts.getDeclarationOfKind(symbol, 125).parent; var signature = typeResolver.getSignatureFromDeclaration(signatureDeclaration); - if (signatureDeclaration.kind === 133) { + if (signatureDeclaration.kind === 135) { displayParts.push(ts.keywordPart(87)); displayParts.push(ts.spacePart()); } - else if (signatureDeclaration.kind !== 132 && signatureDeclaration.name) { + else if (signatureDeclaration.kind !== 134 && signatureDeclaration.name) { addFullSymbolName(signatureDeclaration.symbol); } displayParts.push.apply(displayParts, ts.signatureToDisplayParts(typeResolver, signature, sourceFile, 32)); @@ -25702,7 +27184,7 @@ var ts; if (symbolFlags & 8) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 206) { + if (declaration.kind === 209) { var constantValue = typeResolver.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -25718,7 +27200,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 197) { + if (declaration.kind === 200) { var importDeclaration = declaration; if (ts.isExternalModuleImportDeclaration(importDeclaration)) { displayParts.push(ts.spacePart()); @@ -25746,7 +27228,9 @@ var ts; if (symbolKind !== ScriptElementKind.unknown) { if (type) { addPrefixForAnyFunctionOrVar(symbol, symbolKind); - if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & 3 || symbolKind === ScriptElementKind.localVariableElement) { + if (symbolKind === ScriptElementKind.memberVariableElement || + symbolFlags & 3 || + symbolKind === ScriptElementKind.localVariableElement) { displayParts.push(ts.punctuationPart(51)); displayParts.push(ts.spacePart()); if (type.symbol && type.symbol.flags & 262144) { @@ -25759,7 +27243,12 @@ var ts; displayParts.push.apply(displayParts, ts.typeToDisplayParts(typeResolver, type, enclosingDeclaration)); } } - else if (symbolFlags & 16 || symbolFlags & 8192 || symbolFlags & 16384 || symbolFlags & 131072 || symbolFlags & 98304 || symbolKind === ScriptElementKind.memberFunctionElement) { + else if (symbolFlags & 16 || + symbolFlags & 8192 || + symbolFlags & 16384 || + symbolFlags & 131072 || + symbolFlags & 98304 || + symbolKind === ScriptElementKind.memberFunctionElement) { var allSignatures = type.getCallSignatures(); addSignatureDisplayParts(allSignatures[0], allSignatures); } @@ -25824,8 +27313,8 @@ var ts; if (!symbol) { switch (node.kind) { case 64: - case 149: - case 121: + case 151: + case 123: case 92: case 90: var type = typeInfoResolver.getTypeAtLocation(node); @@ -25868,13 +27357,13 @@ var ts; var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); if (referenceFile) { return [{ - fileName: referenceFile.fileName, - textSpan: ts.createTextSpanFromBounds(0, 0), - kind: ScriptElementKind.scriptElement, - name: comment.fileName, - containerName: undefined, - containerKind: undefined - }]; + fileName: referenceFile.fileName, + textSpan: ts.createTextSpanFromBounds(0, 0), + kind: ScriptElementKind.scriptElement, + name: comment.fileName, + containerName: undefined, + containerKind: undefined + }]; } return undefined; } @@ -25883,7 +27372,7 @@ var ts; return undefined; } var result = []; - if (node.parent.kind === 205) { + if (node.parent.kind === 208) { var shorthandSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); var shorthandDeclarations = shorthandSymbol.getDeclarations(); var shorthandSymbolKind = getSymbolKind(shorthandSymbol, typeInfoResolver, node); @@ -25899,7 +27388,8 @@ var ts; var symbolKind = getSymbolKind(symbol, typeInfoResolver, node); var containerSymbol = symbol.parent; var containerName = containerSymbol ? typeInfoResolver.symbolToString(containerSymbol, node) : ""; - if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { + if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && + !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { ts.forEach(declarations, function (declaration) { result.push(getDefinitionInfo(declaration, symbolKind, symbolName, containerName)); }); @@ -25919,7 +27409,8 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 129) || (!selectConstructors && (d.kind === 190 || d.kind === 128 || d.kind === 127))) { + if ((selectConstructors && d.kind === 131) || + (!selectConstructors && (d.kind === 193 || d.kind === 130 || d.kind === 129))) { declarations.push(d); if (d.body) definition = d; @@ -25939,7 +27430,7 @@ var ts; if (isNewExpressionTarget(location) || location.kind === 112) { if (symbol.flags & 32) { var classDeclaration = symbol.getDeclarations()[0]; - ts.Debug.assert(classDeclaration && classDeclaration.kind === 191); + ts.Debug.assert(classDeclaration && classDeclaration.kind === 194); return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result); } } @@ -25960,84 +27451,88 @@ var ts; if (!node) { return undefined; } - if (node.kind === 64 || node.kind === 92 || node.kind === 90 || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { + if (node.kind === 64 || node.kind === 92 || node.kind === 90 || + isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { return getReferencesForNode(node, [sourceFile], true, false, false); } switch (node.kind) { case 83: case 75: - if (hasKind(node.parent, 174)) { + if (hasKind(node.parent, 176)) { return getIfElseOccurrences(node.parent); } break; case 89: - if (hasKind(node.parent, 181)) { + if (hasKind(node.parent, 184)) { return getReturnOccurrences(node.parent); } break; case 93: - if (hasKind(node.parent, 185)) { + if (hasKind(node.parent, 188)) { return getThrowOccurrences(node.parent); } break; case 67: - if (hasKind(parent(parent(node)), 186)) { + if (hasKind(parent(parent(node)), 189)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; case 95: case 80: - if (hasKind(parent(node), 186)) { + if (hasKind(parent(node), 189)) { return getTryCatchFinallyOccurrences(node.parent); } break; case 91: - if (hasKind(node.parent, 183)) { + if (hasKind(node.parent, 186)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; case 66: case 72: - if (hasKind(parent(parent(node)), 183)) { + if (hasKind(parent(parent(node)), 186)) { return getSwitchCaseDefaultOccurrences(node.parent.parent); } break; case 65: case 70: - if (hasKind(node.parent, 180) || hasKind(node.parent, 179)) { + if (hasKind(node.parent, 183) || hasKind(node.parent, 182)) { return getBreakOrContinueStatementOccurences(node.parent); } break; case 81: - if (hasKind(node.parent, 177) || hasKind(node.parent, 178)) { + if (hasKind(node.parent, 179) || + hasKind(node.parent, 180) || + hasKind(node.parent, 181)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 99: case 74: - if (hasKind(node.parent, 176) || hasKind(node.parent, 175)) { + if (hasKind(node.parent, 178) || hasKind(node.parent, 177)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 112: - if (hasKind(node.parent, 129)) { + if (hasKind(node.parent, 131)) { return getConstructorOccurrences(node.parent); } break; case 114: case 118: - if (hasKind(node.parent, 130) || hasKind(node.parent, 131)) { + if (hasKind(node.parent, 132) || hasKind(node.parent, 133)) { return getGetAndSetOccurrences(node.parent); } default: - if (ts.isModifier(node.kind) && node.parent && (ts.isDeclaration(node.parent) || node.parent.kind === 171)) { + if (ts.isModifier(node.kind) && node.parent && + (ts.isDeclaration(node.parent) || node.parent.kind === 173)) { return getModifierOccurrences(node.kind, node.parent); } } return undefined; function getIfElseOccurrences(ifStatement) { var keywords = []; - while (hasKind(ifStatement.parent, 174) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 176) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } while (ifStatement) { @@ -26048,7 +27543,7 @@ var ts; break; } } - if (!hasKind(ifStatement.elseStatement, 174)) { + if (!hasKind(ifStatement.elseStatement, 176)) { break; } ifStatement = ifStatement.elseStatement; @@ -26081,7 +27576,7 @@ var ts; } function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); - if (!(func && hasKind(func.body, 170))) { + if (!(func && hasKind(func.body, 172))) { return undefined; } var keywords = []; @@ -26114,10 +27609,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 185) { + if (node.kind === 188) { statementAccumulator.push(node); } - else if (node.kind === 186) { + else if (node.kind === 189) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -26139,10 +27634,10 @@ var ts; var child = throwStatement; while (child.parent) { var parent = child.parent; - if (ts.isFunctionBlock(parent) || parent.kind === 207) { + if (ts.isFunctionBlock(parent) || parent.kind === 210) { return parent; } - if (parent.kind === 186) { + if (parent.kind === 189) { var tryStatement = parent; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; @@ -26167,7 +27662,7 @@ var ts; function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 81, 99, 74)) { - if (loopNode.kind === 175) { + if (loopNode.kind === 177) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 99)) { @@ -26202,12 +27697,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { + case 179: + case 180: + case 181: case 177: case 178: - case 175: - case 176: return getLoopBreakContinueOccurrences(owner); - case 183: + case 186: return getSwitchCaseDefaultOccurrences(owner); } } @@ -26218,7 +27714,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 180 || node.kind === 179) { + if (node.kind === 183 || node.kind === 182) { statementAccumulator.push(node); } else if (!ts.isAnyFunction(node)) { @@ -26234,14 +27730,15 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node = statement.parent; node; node = node.parent) { switch (node.kind) { - case 183: - if (statement.kind === 179) { + case 186: + if (statement.kind === 182) { continue; } - case 177: + case 179: + case 180: + case 181: case 178: - case 176: - case 175: + case 177: if (!statement.label || isLabeledBy(node, statement.label.text)) { return node; } @@ -26267,8 +27764,8 @@ var ts; } function getGetAndSetOccurrences(accessorDeclaration) { var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 130); - tryPushAccessorKeyword(accessorDeclaration.symbol, 131); + tryPushAccessorKeyword(accessorDeclaration.symbol, 132); + tryPushAccessorKeyword(accessorDeclaration.symbol, 133); return ts.map(keywords, getReferenceEntryFromNode); function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); @@ -26280,17 +27777,18 @@ var ts; function getModifierOccurrences(modifier, declaration) { var container = declaration.parent; if (declaration.flags & 112) { - if (!(container.kind === 191 || (declaration.kind === 124 && hasKind(container, 129)))) { + if (!(container.kind === 194 || + (declaration.kind === 126 && hasKind(container, 131)))) { return undefined; } } else if (declaration.flags & 128) { - if (container.kind !== 191) { + if (container.kind !== 194) { return undefined; } } else if (declaration.flags & (1 | 2)) { - if (!(container.kind === 196 || container.kind === 207)) { + if (!(container.kind === 199 || container.kind === 210)) { return undefined; } } @@ -26301,18 +27799,18 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 196: - case 207: + case 199: + case 210: nodes = container.statements; break; - case 129: + case 131: nodes = container.parameters.concat(container.parent.members); break; - case 191: + case 194: nodes = container.members; if (modifierFlag & 112) { var constructor = ts.forEach(container.members, function (member) { - return member.kind === 129 && member; + return member.kind === 131 && member; }); if (constructor) { nodes = nodes.concat(constructor.parameters); @@ -26379,7 +27877,9 @@ var ts; if (!node) { return undefined; } - if (node.kind !== 64 && !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && !isNameOfExternalModuleImportOrDeclaration(node)) { + if (node.kind !== 64 && + !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && + !isNameOfExternalModuleImportOrDeclaration(node)) { return undefined; } ts.Debug.assert(node.kind === 64 || node.kind === 7 || node.kind === 8); @@ -26462,7 +27962,7 @@ var ts; return stripQuotes(name); } function getInternedName(symbol, declarations) { - var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 156 ? d : undefined; }); + var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 158 ? d : undefined; }); if (functionExpression && functionExpression.name) { var name = functionExpression.name.text; } @@ -26483,7 +27983,7 @@ var ts; if (symbol.getFlags() && (4 | 8192)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 191); + return ts.getAncestor(privateDeclaration, 194); } } if (symbol.parent || (symbol.getFlags() & 268435456)) { @@ -26500,7 +28000,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (container.kind === 207 && !ts.isExternalModule(container)) { + if (container.kind === 210 && !ts.isExternalModule(container)) { return undefined; } scope = container; @@ -26522,7 +28022,8 @@ var ts; if (position > end) break; var endPosition = position + symbolNameLength; - if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2)) && (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2))) { + if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2)) && + (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2))) { positions.push(position); } position = text.indexOf(symbolName, position + symbolNameLength + 1); @@ -26540,7 +28041,8 @@ var ts; if (!node || node.getWidth() !== labelName.length) { return; } - if (node === targetLabel || (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) { + if (node === targetLabel || + (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) { result.push(getReferenceEntryFromNode(node)); } }); @@ -26552,7 +28054,8 @@ var ts; case 64: return node.getWidth() === searchSymbolName.length; case 8: - if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { + if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || + isNameOfExternalModuleImportOrDeclaration(node)) { return node.getWidth() === searchSymbolName.length + 2; } break; @@ -26575,7 +28078,8 @@ var ts; cancellationToken.throwIfCancellationRequested(); var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); if (!isValidReferencePosition(referenceLocation, searchText)) { - if ((findInStrings && isInString(position)) || (findInComments && isInComment(position))) { + if ((findInStrings && isInString(position)) || + (findInComments && isInComment(position))) { result.push({ fileName: sourceFile.fileName, textSpan: ts.createTextSpan(position, searchText.length), @@ -26627,13 +28131,13 @@ var ts; } var staticFlag = 128; switch (searchSpaceNode.kind) { - case 126: - case 125: case 128: case 127: - case 129: case 130: + case 129: case 131: + case 132: + case 133: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; @@ -26660,31 +28164,31 @@ var ts; var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); var staticFlag = 128; switch (searchSpaceNode.kind) { - case 128: - case 127: + case 130: + case 129: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } - case 126: - case 125: - case 129: - case 130: + case 128: + case 127: case 131: + case 132: + case 133: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; - case 207: + case 210: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - case 190: - case 156: + case 193: + case 158: break; default: return undefined; } var result = []; - if (searchSpaceNode.kind === 207) { + if (searchSpaceNode.kind === 210) { ts.forEach(sourceFiles, function (sourceFile) { var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, result); @@ -26705,25 +28209,25 @@ var ts; } var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { - case 156: - case 190: + case 158: + case 193: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 128: - case 127: + case 130: + case 129: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 191: + case 194: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 207: - if (container.kind === 207 && !ts.isExternalModule(container)) { + case 210: + if (container.kind === 210 && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -26755,11 +28259,11 @@ var ts; function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 | 64)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 191) { + if (declaration.kind === 194) { getPropertySymbolFromTypeReference(ts.getClassBaseTypeNode(declaration)); ts.forEach(ts.getClassImplementedTypeNodes(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 192) { + else if (declaration.kind === 195) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -26865,75 +28369,19 @@ var ts; } var parent = node.parent; if (parent) { - if (parent.kind === 162 || parent.kind === 161) { + if (parent.kind === 164 || parent.kind === 163) { return true; } - else if (parent.kind === 163 && parent.left === node) { - var operator = parent.operator; + else if (parent.kind === 165 && parent.left === node) { + var operator = parent.operatorToken.kind; return 52 <= operator && operator <= 63; } } return false; } - function getNavigateToItems(searchValue) { + function getNavigateToItems(searchValue, maxResultCount) { synchronizeHostData(); - var terms = searchValue.split(" "); - var searchTerms = ts.map(terms, function (t) { return ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t }); }); - var items = []; - ts.forEach(program.getSourceFiles(), function (sourceFile) { - cancellationToken.throwIfCancellationRequested(); - var fileName = sourceFile.fileName; - var declarations = sourceFile.getNamedDeclarations(); - for (var i = 0, n = declarations.length; i < n; i++) { - var declaration = declarations[i]; - var name = declaration.name.text; - var matchKind = getMatchKind(searchTerms, name); - if (matchKind !== 0) { - var container = getContainerNode(declaration); - items.push({ - name: name, - kind: getNodeKind(declaration), - kindModifiers: ts.getNodeModifiers(declaration), - matchKind: MatchKind[matchKind], - fileName: fileName, - textSpan: ts.createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), - containerName: container && container.name ? container.name.text : "", - containerKind: container && container.name ? getNodeKind(container) : "" - }); - } - } - }); - return items; - function hasAnyUpperCaseCharacter(s) { - for (var i = 0, n = s.length; i < n; i++) { - var c = s.charCodeAt(i); - if ((65 <= c && c <= 90) || (c >= 127 && s.charAt(i).toLocaleLowerCase() !== s.charAt(i))) { - return true; - } - } - return false; - } - function getMatchKind(searchTerms, name) { - var matchKind = 0; - if (name) { - for (var j = 0, n = searchTerms.length; j < n; j++) { - var searchTerm = searchTerms[j]; - var nameToSearch = searchTerm.caseSensitive ? name : name.toLocaleLowerCase(); - var index = nameToSearch.indexOf(searchTerm.term); - if (index < 0) { - return 0; - } - var termKind = 2; - if (index === 0) { - termKind = name.length === searchTerm.term.length ? 1 : 3; - } - if (matchKind === 0 || termKind < matchKind) { - matchKind = termKind; - } - } - } - return matchKind; - } + return ts.NavigateTo.getNavigateToItems(program, cancellationToken, searchValue, maxResultCount); } function containErrors(diagnostics) { return ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === 1; }); @@ -26958,33 +28406,33 @@ var ts; } function getMeaningFromDeclaration(node) { switch (node.kind) { - case 124: - case 188: - case 146: case 126: - case 125: - case 204: - case 205: - case 206: + case 191: + case 148: case 128: case 127: - case 129: + case 207: + case 208: + case 209: case 130: + case 129: case 131: - case 190: - case 156: - case 157: - case 203: - return 1; - case 123: - case 192: + case 132: + case 133: case 193: - case 139: - return 2; - case 191: - case 194: - return 1 | 2; + case 158: + case 159: + case 206: + return 1; + case 125: case 195: + case 196: + case 141: + return 2; + case 194: + case 197: + return 1 | 2; + case 198: if (node.name.kind === 8) { return 4 | 1; } @@ -26994,9 +28442,9 @@ var ts; else { return 4; } - case 197: + case 200: return 1 | 2 | 4; - case 207: + case 210: return 4 | 1; } ts.Debug.fail("Unknown declaration type"); @@ -27005,33 +28453,35 @@ var ts; if (isRightSideOfQualifiedName(node)) { node = node.parent; } - return node.parent.kind === 135; + return node.parent.kind === 137; } function isNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 121) { - while (root.parent && root.parent.kind === 121) + if (root.parent.kind === 123) { + while (root.parent && root.parent.kind === 123) root = root.parent; isLastClause = root.right === node; } - return root.parent.kind === 135 && !isLastClause; + return root.parent.kind === 137 && !isLastClause; } function isInRightSideOfImport(node) { - while (node.parent.kind === 121) { + while (node.parent.kind === 123) { node = node.parent; } return ts.isInternalModuleImportDeclaration(node.parent) && node.parent.moduleReference === node; } function getMeaningFromRightHandSideOfImport(node) { ts.Debug.assert(node.kind === 64); - if (node.parent.kind === 121 && node.parent.right === node && node.parent.parent.kind === 197) { + if (node.parent.kind === 123 && + node.parent.right === node && + node.parent.parent.kind === 200) { return 1 | 2 | 4; } return 4; } function getMeaningFromLocation(node) { - if (node.parent.kind === 198) { + if (node.parent.kind === 201) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -27068,8 +28518,8 @@ var ts; return; } switch (node.kind) { - case 149: - case 121: + case 151: + case 123: case 8: case 79: case 94: @@ -27087,7 +28537,8 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 195 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { + if (nodeForStartPos.parent.parent.kind === 198 && + nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } else { @@ -27135,14 +28586,15 @@ var ts; } } else if (flags & 1536) { - if (meaningAtPosition & 4 || (meaningAtPosition & 1 && hasValueSideModule(symbol))) { + if (meaningAtPosition & 4 || + (meaningAtPosition & 1 && hasValueSideModule(symbol))) { return ClassificationTypeNames.moduleName; } } return undefined; function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 195 && ts.getModuleInstanceState(declaration) == 1; + return declaration.kind === 198 && ts.getModuleInstanceState(declaration) == 1; }); } } @@ -27261,11 +28713,16 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 52) { - if (token.parent.kind === 188 || token.parent.kind === 126 || token.parent.kind === 124) { + if (token.parent.kind === 191 || + token.parent.kind === 128 || + token.parent.kind === 126) { return ClassificationTypeNames.operator; } } - if (token.parent.kind === 163 || token.parent.kind === 161 || token.parent.kind === 162 || token.parent.kind === 164) { + if (token.parent.kind === 165 || + token.parent.kind === 163 || + token.parent.kind === 164 || + token.parent.kind === 166) { return ClassificationTypeNames.operator; } } @@ -27286,27 +28743,27 @@ var ts; else if (tokenKind === 64) { if (token) { switch (token.parent.kind) { - case 191: + case 194: if (token.parent.name === token) { return ClassificationTypeNames.className; } return; - case 123: + case 125: if (token.parent.name === token) { return ClassificationTypeNames.typeParameterName; } return; - case 192: + case 195: if (token.parent.name === token) { return ClassificationTypeNames.interfaceName; } return; - case 194: + case 197: if (token.parent.name === token) { return ClassificationTypeNames.enumName; } return; - case 195: + case 198: if (token.parent.name === token) { return ClassificationTypeNames.moduleName; } @@ -27416,7 +28873,6 @@ var ts; var sourceFile = getValidSourceFile(fileName); cancellationToken.throwIfCancellationRequested(); var fileContents = sourceFile.text; - cancellationToken.throwIfCancellationRequested(); var result = []; if (descriptors.length > 0) { var regExp = getTodoCommentsRegExp(); @@ -27466,7 +28922,9 @@ var ts; return new RegExp(regExpString, "gim"); } function isLetterOrDigit(char) { - return (char >= 97 && char <= 122) || (char >= 65 && char <= 90) || (char >= 48 && char <= 57); + return (char >= 97 && char <= 122) || + (char >= 65 && char <= 90) || + (char >= 48 && char <= 57); } } function getRenameInfo(fileName, position) { @@ -27479,11 +28937,13 @@ var ts; if (symbol) { var declarations = symbol.getDeclarations(); if (declarations && declarations.length > 0) { - var defaultLibFile = ts.getDefaultLibFileName(host.getCompilationSettings()); - for (var i = 0; i < declarations.length; i++) { - var sourceFile = declarations[i].getSourceFile(); - if (sourceFile && endsWith(sourceFile.fileName, defaultLibFile)) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key)); + var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); + if (defaultLibFileName) { + for (var i = 0; i < declarations.length; i++) { + var sourceFile = declarations[i].getSourceFile(); + if (sourceFile && getCanonicalFileName(ts.normalizePath(sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { + return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key)); + } } } var kind = getSymbolKind(symbol, typeInfoResolver, node); @@ -27502,9 +28962,6 @@ var ts; } } return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element.key)); - function endsWith(string, value) { - return string.lastIndexOf(value) + value.length === string.length; - } function getRenameInfoError(localizedErrorMessage) { return { canRename: false, @@ -27566,6 +29023,7 @@ var ts; noRegexTable[15] = true; noRegexTable[94] = true; noRegexTable[79] = true; + var templateStack = []; function isAccessibilityModifier(kind) { switch (kind) { case 107: @@ -27577,17 +29035,23 @@ var ts; } function canFollow(keyword1, keyword2) { if (isAccessibilityModifier(keyword1)) { - if (keyword2 === 114 || keyword2 === 118 || keyword2 === 112 || keyword2 === 108) { + if (keyword2 === 114 || + keyword2 === 118 || + keyword2 === 112 || + keyword2 === 108) { return true; } return false; } return true; } - function getClassificationsForLine(text, lexState, classifyKeywordsInGenerics) { + function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) { var offset = 0; var token = 0; var lastNonTriviaToken = 0; + while (templateStack.length > 0) { + templateStack.pop(); + } switch (lexState) { case 3: text = '"\\\n' + text; @@ -27601,6 +29065,16 @@ var ts; text = "/*\n" + text; offset = 3; break; + case 4: + text = "`\n" + text; + offset = 2; + break; + case 5: + text = "}\n" + text; + offset = 2; + case 6: + templateStack.push(11); + break; } scanner.setText(text); var result = { @@ -27622,17 +29096,48 @@ var ts; else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { token = 64; } - else if (lastNonTriviaToken === 64 && token === 24) { + else if (lastNonTriviaToken === 64 && + token === 24) { angleBracketStack++; } else if (token === 25 && angleBracketStack > 0) { angleBracketStack--; } - else if (token === 110 || token === 119 || token === 117 || token === 111) { - if (angleBracketStack > 0 && !classifyKeywordsInGenerics) { + else if (token === 110 || + token === 119 || + token === 117 || + token === 111 || + token === 120) { + if (angleBracketStack > 0 && !syntacticClassifierAbsent) { token = 64; } } + else if (token === 11) { + templateStack.push(token); + } + else if (token === 14) { + if (templateStack.length > 0) { + templateStack.push(token); + } + } + else if (token === 15) { + if (templateStack.length > 0) { + var lastTemplateStackToken = ts.lastOrUndefined(templateStack); + if (lastTemplateStackToken === 11) { + token = scanner.reScanTemplateToken(); + if (token === 13) { + templateStack.pop(); + } + else { + ts.Debug.assert(token === 12, "Should have been a template middle. Was " + token); + } + } + else { + ts.Debug.assert(lastTemplateStackToken === 14, "Should have been an open brace. Was: " + token); + templateStack.pop(); + } + } + } lastNonTriviaToken = token; } processToken(); @@ -27662,6 +29167,22 @@ var ts; result.finalLexState = 1; } } + else if (ts.isTemplateLiteralKind(token)) { + if (scanner.isUnterminated()) { + if (token === 13) { + result.finalLexState = 5; + } + else if (token === 10) { + result.finalLexState = 4; + } + else { + ts.Debug.fail("Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #" + token); + } + } + } + else if (templateStack.length > 0 && ts.lastOrUndefined(templateStack) === 11) { + result.finalLexState = 6; + } } } function addResult(length, classification) { @@ -27712,7 +29233,8 @@ var ts; case 52: case 23: return true; - default: return false; + default: + return false; } } function isPrefixUnaryExpressionOperatorToken(token) { @@ -27729,7 +29251,7 @@ var ts; } } function isKeyword(token) { - return token >= 65 && token <= 120; + return token >= 65 && token <= 122; } function classFromKind(token) { if (isKeyword(token)) { @@ -27753,9 +29275,13 @@ var ts; case 2: return 3; case 5: + case 4: return 4; case 64: default: + if (ts.isTemplateLiteralKind(token)) { + return 7; + } return 5; } } @@ -27774,7 +29300,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 207 ? new SourceFileObject() : new NodeObject(); + var proto = kind === 210 ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = 0; proto.end = 0; @@ -27799,10 +29325,10 @@ var ts; return undefined; } var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position); - var lineOfPosition = sourceFile.getLineAndCharacterFromPosition(position).line; - if (sourceFile.getLineAndCharacterFromPosition(tokenAtLocation.getStart()).line > lineOfPosition) { + var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line; + if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart()).line > lineOfPosition) { tokenAtLocation = ts.findPrecedingToken(tokenAtLocation.pos, sourceFile); - if (!tokenAtLocation || sourceFile.getLineAndCharacterFromPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { + if (!tokenAtLocation || sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { return undefined; } } @@ -27814,7 +29340,7 @@ var ts; return ts.createTextSpanFromBounds(startNode.getStart(), (endNode || startNode).getEnd()); } function spanInNodeIfStartsOnSameLine(node, otherwiseOnNode) { - if (node && lineOfPosition === sourceFile.getLineAndCharacterFromPosition(node.getStart()).line) { + if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart()).line) { return spanInNode(node); } return spanInNode(otherwiseOnNode); @@ -27828,93 +29354,94 @@ var ts; function spanInNode(node) { if (node) { if (ts.isExpression(node)) { - if (node.parent.kind === 175) { + if (node.parent.kind === 177) { return spanInPreviousNode(node); } - if (node.parent.kind === 177) { + if (node.parent.kind === 179) { return textSpan(node); } - if (node.parent.kind === 163 && node.parent.operator === 23) { + if (node.parent.kind === 165 && node.parent.operatorToken.kind === 23) { return textSpan(node); } - if (node.parent.kind == 157 && node.parent.body == node) { + if (node.parent.kind == 159 && node.parent.body == node) { return textSpan(node); } } switch (node.kind) { - case 171: + case 173: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 188: - case 126: - case 125: - return spanInVariableDeclaration(node); - case 124: - return spanInParameterDeclaration(node); - case 190: + case 191: case 128: case 127: + return spanInVariableDeclaration(node); + case 126: + return spanInParameterDeclaration(node); + case 193: case 130: - case 131: case 129: - case 156: - case 157: + case 132: + case 133: + case 131: + case 158: + case 159: return spanInFunctionDeclaration(node); - case 170: + case 172: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 196: + case 199: return spanInBlock(node); - case 203: + case 206: return spanInBlock(node.block); - case 173: - return textSpan(node.expression); - case 181: - return textSpan(node.getChildAt(0), node.expression); - case 176: - return textSpan(node, ts.findNextToken(node.expression, node)); case 175: - return spanInNode(node.statement); - case 187: - return textSpan(node.getChildAt(0)); - case 174: - return textSpan(node, ts.findNextToken(node.expression, node)); + return textSpan(node.expression); case 184: - return spanInNode(node.statement); - case 180: - case 179: - return textSpan(node.getChildAt(0), node.label); - case 177: - return spanInForStatement(node); + return textSpan(node.getChildAt(0), node.expression); case 178: return textSpan(node, ts.findNextToken(node.expression, node)); + case 177: + return spanInNode(node.statement); + case 190: + return textSpan(node.getChildAt(0)); + case 176: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 187: + return spanInNode(node.statement); case 183: + case 182: + return textSpan(node.getChildAt(0), node.label); + case 179: + return spanInForStatement(node); + case 180: + case 181: return textSpan(node, ts.findNextToken(node.expression, node)); - case 200: - case 201: - return spanInNode(node.statements[0]); case 186: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 203: + case 204: + return spanInNode(node.statements[0]); + case 189: return spanInBlock(node.tryBlock); - case 185: + case 188: return textSpan(node, node.expression); - case 198: + case 201: return textSpan(node, node.exportName); - case 197: + case 200: return textSpan(node, node.moduleReference); - case 195: + case 198: if (ts.getModuleInstanceState(node) !== 1) { return undefined; } - case 191: case 194: - case 206: - case 151: - case 152: + case 197: + case 209: + case 153: + case 154: return textSpan(node); - case 182: + case 185: return spanInNode(node.statement); - case 192: - case 193: + case 195: + case 196: return undefined; case 22: case 1: @@ -27941,10 +29468,10 @@ var ts; case 80: return spanInNextNode(node); default: - if (node.parent.kind === 204 && node.parent.name === node) { + if (node.parent.kind === 207 && node.parent.name === node) { return spanInNode(node.parent.initializer); } - if (node.parent.kind === 154 && node.parent.type === node) { + if (node.parent.kind === 156 && node.parent.type === node) { return spanInNode(node.parent.expression); } if (ts.isAnyFunction(node.parent) && node.parent.type === node) { @@ -27954,11 +29481,12 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 178) { + if (variableDeclaration.parent.parent.kind === 180 || + variableDeclaration.parent.parent.kind === 181) { return spanInNode(variableDeclaration.parent.parent); } - var isParentVariableStatement = variableDeclaration.parent.parent.kind === 171; - var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 177 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); + var isParentVariableStatement = variableDeclaration.parent.parent.kind === 173; + var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 179 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement ? variableDeclaration.parent.parent.initializer.declarations : undefined; if (variableDeclaration.initializer || (variableDeclaration.flags & 1)) { if (declarations && declarations[0] === variableDeclaration) { @@ -27980,7 +29508,8 @@ var ts; } } function canHaveSpanInParameterDeclaration(parameter) { - return !!parameter.initializer || parameter.dotDotDotToken !== undefined || !!(parameter.flags & 16) || !!(parameter.flags & 32); + return !!parameter.initializer || parameter.dotDotDotToken !== undefined || + !!(parameter.flags & 16) || !!(parameter.flags & 32); } function spanInParameterDeclaration(parameter) { if (canHaveSpanInParameterDeclaration(parameter)) { @@ -27998,7 +29527,8 @@ var ts; } } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { - return !!(functionDeclaration.flags & 1) || (functionDeclaration.parent.kind === 191 && functionDeclaration.kind !== 129); + return !!(functionDeclaration.flags & 1) || + (functionDeclaration.parent.kind === 194 && functionDeclaration.kind !== 131); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -28018,22 +29548,23 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 195: + case 198: if (ts.getModuleInstanceState(block.parent) !== 1) { return undefined; } - case 176: - case 174: case 178: + case 176: + case 180: + case 181: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); - case 177: + case 179: 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 === 189) { + if (forStatement.initializer.kind === 192) { var variableDeclarationList = forStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -28052,34 +29583,34 @@ var ts; } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 194: + case 197: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 191: + case 194: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 183: + case 186: return spanInNodeIfStartsOnSameLine(node.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 196: + case 199: if (ts.getModuleInstanceState(node.parent.parent) !== 1) { return undefined; } + case 197: case 194: - case 191: return textSpan(node); - case 170: + case 172: if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 203: + case 206: return spanInNode(node.parent.statements[node.parent.statements.length - 1]); ; - case 183: + case 186: var switchStatement = node.parent; var lastClause = switchStatement.clauses[switchStatement.clauses.length - 1]; if (lastClause) { @@ -28091,24 +29622,24 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 175) { + if (node.parent.kind === 177) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInCloseParenToken(node) { switch (node.parent.kind) { - case 156: - case 190: - case 157: - case 128: - case 127: + case 158: + case 193: + case 159: case 130: - case 131: case 129: - case 176: - case 175: + case 132: + case 133: + case 131: + case 178: case 177: + case 179: return spanInPreviousNode(node); default: return spanInNode(node.parent); @@ -28116,19 +29647,19 @@ var ts; return spanInNode(node.parent); } function spanInColonToken(node) { - if (ts.isAnyFunction(node.parent) || node.parent.kind === 204) { + if (ts.isAnyFunction(node.parent) || node.parent.kind === 207) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 154) { + if (node.parent.kind === 156) { return spanInNode(node.parent.expression); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 175) { + if (node.parent.kind === 177) { return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); } return spanInNode(node.parent); @@ -28221,7 +29752,7 @@ var ts; return this.shimHost.getCurrentDirectory(); }; LanguageServiceShimHostAdapter.prototype.getDefaultLibFileName = function (options) { - return ""; + return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); }; return LanguageServiceShimHostAdapter; })(); @@ -28461,10 +29992,10 @@ var ts; return edits; }); }; - LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue) { + LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue, maxResultCount) { var _this = this; - return this.forwardJSONCall("getNavigateToItems('" + searchValue + "')", function () { - var items = _this.languageService.getNavigateToItems(searchValue); + return this.forwardJSONCall("getNavigateToItems('" + searchValue + "', " + maxResultCount + ")", function () { + var items = _this.languageService.getNavigateToItems(searchValue, maxResultCount); return items; }); }; diff --git a/bin/typescriptServices_internal.d.ts b/bin/typescriptServices_internal.d.ts index c6ba4f561f0..12860e9edc8 100644 --- a/bin/typescriptServices_internal.d.ts +++ b/bin/typescriptServices_internal.d.ts @@ -159,6 +159,7 @@ declare module ts { function getFullWidth(node: Node): number; function containsParseError(node: Node): boolean; function getSourceFileOfNode(node: Node): SourceFile; + function getStartPositionOfLine(line: number, sourceFile: SourceFile): number; function nodePosToString(node: Node): string; function getStartPosOfNode(node: Node): number; function nodeIsMissing(node: Node): boolean; @@ -216,6 +217,26 @@ declare module ts { function getFileReferenceFromReferencePath(comment: string, commentRange: CommentRange): ReferencePathMatchResult; function isKeyword(token: SyntaxKind): boolean; function isTrivia(token: SyntaxKind): boolean; + /** + * A declaration has a dynamic name if both of the following are true: + * 1. The declaration has a computed property name + * 2. The computed name is *not* expressed as Symbol., where name + * is a property of the Symbol constructor that denotes a built in + * Symbol. + */ + function hasDynamicName(declaration: Declaration): boolean; + /** + * Checks if the expression is of the form: + * Symbol.name + * where Symbol is literally the word "Symbol", and name is any identifierName + */ + function isWellKnownSymbolSyntactically(node: Expression): boolean; + function getPropertyNameForPropertyNameNode(name: DeclarationName): string; + function getPropertyNameForKnownSymbolName(symbolName: string): string; + /** + * Includes the word "Symbol" with unicode escapes + */ + function isESSymbolIdentifier(node: Node): boolean; function isModifier(token: SyntaxKind): boolean; function textSpanEnd(span: TextSpan): number; function textSpanIsEmpty(span: TextSpan): boolean; @@ -255,8 +276,7 @@ declare module ts { list: Node; } function getEndLinePosition(line: number, sourceFile: SourceFile): number; - function getStartPositionOfLine(line: number, sourceFile: SourceFile): number; - function getStartLinePositionForPosition(position: number, sourceFile: SourceFile): number; + function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number; function rangeContainsRange(r1: TextRange, r2: TextRange): boolean; function startEndContainsRange(start: number, end: number, range: TextRange): boolean; function rangeContainsStartEnd(range: TextRange, start: number, end: number): boolean; diff --git a/bin/typescript_internal.d.ts b/bin/typescript_internal.d.ts index b7def7258d9..3a11b69cb91 100644 --- a/bin/typescript_internal.d.ts +++ b/bin/typescript_internal.d.ts @@ -159,6 +159,7 @@ declare module "typescript" { function getFullWidth(node: Node): number; function containsParseError(node: Node): boolean; function getSourceFileOfNode(node: Node): SourceFile; + function getStartPositionOfLine(line: number, sourceFile: SourceFile): number; function nodePosToString(node: Node): string; function getStartPosOfNode(node: Node): number; function nodeIsMissing(node: Node): boolean; @@ -216,6 +217,26 @@ declare module "typescript" { function getFileReferenceFromReferencePath(comment: string, commentRange: CommentRange): ReferencePathMatchResult; function isKeyword(token: SyntaxKind): boolean; function isTrivia(token: SyntaxKind): boolean; + /** + * A declaration has a dynamic name if both of the following are true: + * 1. The declaration has a computed property name + * 2. The computed name is *not* expressed as Symbol., where name + * is a property of the Symbol constructor that denotes a built in + * Symbol. + */ + function hasDynamicName(declaration: Declaration): boolean; + /** + * Checks if the expression is of the form: + * Symbol.name + * where Symbol is literally the word "Symbol", and name is any identifierName + */ + function isWellKnownSymbolSyntactically(node: Expression): boolean; + function getPropertyNameForPropertyNameNode(name: DeclarationName): string; + function getPropertyNameForKnownSymbolName(symbolName: string): string; + /** + * Includes the word "Symbol" with unicode escapes + */ + function isESSymbolIdentifier(node: Node): boolean; function isModifier(token: SyntaxKind): boolean; function textSpanEnd(span: TextSpan): number; function textSpanIsEmpty(span: TextSpan): boolean; @@ -255,8 +276,7 @@ declare module "typescript" { list: Node; } function getEndLinePosition(line: number, sourceFile: SourceFile): number; - function getStartPositionOfLine(line: number, sourceFile: SourceFile): number; - function getStartLinePositionForPosition(position: number, sourceFile: SourceFile): number; + function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number; function rangeContainsRange(r1: TextRange, r2: TextRange): boolean; function startEndContainsRange(start: number, end: number, range: TextRange): boolean; function rangeContainsStartEnd(range: TextRange, start: number, end: number): boolean; diff --git a/package.json b/package.json index 2bd89706606..9261174b68f 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,10 @@ "url": "https://github.com/Microsoft/TypeScript.git" }, "preferGlobal": true, - "main": "./bin/typescriptServices.js", + "main": "./bin/typescript.js", "bin": { - "tsc": "./bin/tsc" + "tsc": "./bin/tsc", + "tsserver": "./bin/tsserver" }, "engines": { "node": ">=0.8.0" diff --git a/scripts/VSDevMode.ps1 b/scripts/VSDevMode.ps1 new file mode 100644 index 00000000000..21cc1f48ac1 --- /dev/null +++ b/scripts/VSDevMode.ps1 @@ -0,0 +1,49 @@ +<# +.SYNOPSIS +Run this PowerShell script to enable dev mode and/or a custom script for the TypeScript language service, e.g. + +PS C:\> .\scripts\VSDevMode.ps1 -enableDevMode -tsScript C:\src\TypeScript\built\local\typescriptServices.js + +Note: If you get security errors, try running powershell as an Administrator and with the "-executionPolicy remoteSigned" switch + +.PARAMETER vsVersion +Set to "12" for Dev12 (VS2013) or "14" (the default) for Dev14 (VS2015) + +.PARAMETER enableDevMode +Pass this switch to enable attaching a debugger to the language service + +.PARAMETER tsScript +The path to a custom language service script to use, e.g. "C:\src\TypeScript\built\local\typescriptServices.js" +#> +Param( + [int]$vsVersion = 14, + [switch]$enableDevMode, + [string]$tsScript +) + +$vsRegKey = "HKCU:\Software\Microsoft\VisualStudio\${vsVersion}.0" +$tsRegKey = "${vsRegKey}\TypeScriptLanguageService" + +if($enableDevMode -ne $true -and $tsScript -eq ""){ + Throw "You must either enable language service debugging (-enableDevMode), set a custom script (-tsScript), or both" +} + +if(!(Test-Path $vsRegKey)){ + Throw "Visual Studio ${vsVersion} is not installed" +} +if(!(Test-Path $tsRegKey)){ + # Create the TypeScript subkey if it doesn't exist + New-Item -path $tsRegKey +} + +if($tsScript -ne ""){ + if(!(Test-Path $tsScript)){ + Throw "Could not locate the TypeScript language service script at ${tsScript}" + } + Set-ItemProperty -path $tsRegKey -name CustomTypeScriptServicesFileLocation -value "${tsScript}" + Write-Host "Enabled custom TypeScript language service at ${tsScript} for Dev${vsVersion}" +} +if($enableDevMode){ + Set-ItemProperty -path $tsRegKey -name EnableDevMode -value 1 + Write-Host "Enabled developer mode for Dev${vsVersion}" +} diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index d13d7289b9e..c26d3369f3f 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -51,17 +51,6 @@ module ts { } } - /** - * A declaration has a dynamic name if both of the following are true: - * 1. The declaration has a computed property name - * 2. The computed name is *not* expressed as Symbol., where name - * is a property of the Symbol constructor that denotes a built in - * Symbol. - */ - export function hasDynamicName(declaration: Declaration): boolean { - return declaration.name && declaration.name.kind === SyntaxKind.ComputedPropertyName; - } - export function bindSourceFile(file: SourceFile): void { var start = new Date().getTime(); bindSourceFileWorker(file); @@ -98,13 +87,18 @@ module ts { if (symbolKind & SymbolFlags.Value && !symbol.valueDeclaration) symbol.valueDeclaration = node; } - // Should not be called on a declaration with a computed property name. + // Should not be called on a declaration with a computed property name, + // unless it is a well known Symbol. function getDeclarationName(node: Declaration): string { if (node.name) { if (node.kind === SyntaxKind.ModuleDeclaration && node.name.kind === SyntaxKind.StringLiteral) { return '"' + (node.name).text + '"'; } - Debug.assert(!hasDynamicName(node)); + if (node.name.kind === SyntaxKind.ComputedPropertyName) { + var nameExpression = (node.name).expression; + Debug.assert(isWellKnownSymbolSyntactically(nameExpression)); + return getPropertyNameForKnownSymbolName((nameExpression).name.text); + } return (node.name).text; } switch (node.kind) { @@ -501,9 +495,20 @@ module ts { break; } case SyntaxKind.Block: + // do not treat function block a block-scope container + // all block-scope locals that reside in this block should go to the function locals. + // Otherwise this won't be considered as redeclaration of a block scoped local: + // function foo() { + // let x; + // var x; + // } + // 'var x' will be placed into the function locals and 'let x' - into the locals of the block + bindChildren(node, 0, /*isBlockScopeContainer*/ !isAnyFunction(node.parent)); + break; case SyntaxKind.CatchClause: case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.SwitchStatement: bindChildren(node, 0, /*isBlockScopeContainer*/ true); break; diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index bb250c3f9d5..acb90c4767b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -67,6 +67,7 @@ module ts { var stringType = createIntrinsicType(TypeFlags.String, "string"); var numberType = createIntrinsicType(TypeFlags.Number, "number"); var booleanType = createIntrinsicType(TypeFlags.Boolean, "boolean"); + var esSymbolType = createIntrinsicType(TypeFlags.ESSymbol, "symbol"); var voidType = createIntrinsicType(TypeFlags.Void, "void"); var undefinedType = createIntrinsicType(TypeFlags.Undefined | TypeFlags.ContainsUndefinedOrNull, "undefined"); var nullType = createIntrinsicType(TypeFlags.Null | TypeFlags.ContainsUndefinedOrNull, "null"); @@ -84,6 +85,7 @@ module ts { var globals: SymbolTable = {}; var globalArraySymbol: Symbol; + var globalESSymbolConstructorSymbol: Symbol; var globalObjectType: ObjectType; var globalFunctionType: ObjectType; @@ -93,6 +95,7 @@ module ts { var globalBooleanType: ObjectType; var globalRegExpType: ObjectType; var globalTemplateStringsArrayType: ObjectType; + var globalESSymbolType: ObjectType; var anyArrayType: Type; @@ -120,6 +123,10 @@ module ts { "boolean": { type: booleanType, flags: TypeFlags.Boolean + }, + "symbol": { + type: esSymbolType, + flags: TypeFlags.ESSymbol } }; @@ -818,9 +825,15 @@ module ts { return type; } - // A reserved member name starts with two underscores followed by a non-underscore + // A reserved member name starts with two underscores, but the third character cannot be an underscore + // or the @ symbol. A third underscore indicates an escaped form of an identifer that started + // with at least two underscores. The @ character indicates that the name is denoted by a well known ES + // Symbol instance. function isReservedMemberName(name: string) { - return name.charCodeAt(0) === CharacterCodes._ && name.charCodeAt(1) === CharacterCodes._ && name.charCodeAt(2) !== CharacterCodes._; + return name.charCodeAt(0) === CharacterCodes._ && + name.charCodeAt(1) === CharacterCodes._ && + name.charCodeAt(2) !== CharacterCodes._ && + name.charCodeAt(2) !== CharacterCodes.at; } function getNamedMembers(members: SymbolTable): Symbol[] { @@ -1820,8 +1833,8 @@ module ts { } } else { - // For an array binding element the specified or inferred type of the parent must be assignable to any[] - if (!isTypeAssignableTo(parentType, anyArrayType)) { + // For an array binding element the specified or inferred type of the parent must be an array-like type + if (!isArrayLikeType(parentType)) { error(pattern, Diagnostics.Type_0_is_not_an_array_type, typeToString(parentType)); return unknownType; } @@ -2601,9 +2614,9 @@ module ts { return getPropertiesOfObjectType(getApparentType(type)); } - // For a type parameter, return the base constraint of the type parameter. For the string, number, and - // boolean primitive types, return the corresponding object types.Otherwise return the type itself. - // Note that the apparent type of a union type is the union type itself. + // 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 + // type itself. Note that the apparent type of a union type is the union type itself. function getApparentType(type: Type): Type { if (type.flags & TypeFlags.TypeParameter) { do { @@ -2622,6 +2635,9 @@ module ts { else if (type.flags & TypeFlags.Boolean) { type = globalBooleanType; } + else if (type.flags & TypeFlags.ESSymbol) { + type = globalESSymbolType; + } return type; } @@ -3111,12 +3127,24 @@ module ts { return type; } - function getGlobalSymbol(name: string): Symbol { - return resolveName(undefined, name, SymbolFlags.Type, Diagnostics.Cannot_find_global_type_0, name); + function getGlobalValueSymbol(name: string): Symbol { + return getGlobalSymbol(name, SymbolFlags.Value, Diagnostics.Cannot_find_global_value_0); + } + + function getGlobalTypeSymbol(name: string): Symbol { + return getGlobalSymbol(name, SymbolFlags.Type, Diagnostics.Cannot_find_global_type_0); + } + + function getGlobalSymbol(name: string, meaning: SymbolFlags, diagnostic: DiagnosticMessage): Symbol { + return resolveName(undefined, name, meaning, diagnostic, name); } function getGlobalType(name: string): ObjectType { - return getTypeOfGlobalSymbol(getGlobalSymbol(name), 0); + return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), 0); + } + + function getGlobalESSymbolConstructorSymbol() { + return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); } function createArrayType(elementType: Type): Type { @@ -3286,6 +3314,8 @@ module ts { return numberType; case SyntaxKind.BooleanKeyword: return booleanType; + case SyntaxKind.SymbolKeyword: + return esSymbolType; case SyntaxKind.VoidKeyword: return voidType; case SyntaxKind.StringLiteral: @@ -3491,7 +3521,7 @@ module ts { return isContextSensitive((node).whenTrue) || isContextSensitive((node).whenFalse); case SyntaxKind.BinaryExpression: - return (node).operator === SyntaxKind.BarBarToken && + return (node).operatorToken.kind === SyntaxKind.BarBarToken && (isContextSensitive((node).left) || isContextSensitive((node).right)); case SyntaxKind.PropertyAssignment: return isContextSensitive((node).initializer); @@ -4272,6 +4302,11 @@ module ts { return type.flags & TypeFlags.Reference && (type).target === globalArrayType; } + function isArrayLikeType(type: Type): boolean { + // A type is array-like if it is not the undefined or null type and if it is assignable to any[] + return !(type.flags & (TypeFlags.Undefined | TypeFlags.Null)) && isTypeAssignableTo(type, anyArrayType); + } + function isTupleLikeType(type: Type): boolean { return !!getPropertyOfType(type, "0"); } @@ -4673,7 +4708,7 @@ module ts { return links.assignmentChecks[symbol.id] = isAssignedIn(node); function isAssignedInBinaryExpression(node: BinaryExpression) { - if (node.operator >= SyntaxKind.FirstAssignment && node.operator <= SyntaxKind.LastAssignment) { + if (node.operatorToken.kind >= SyntaxKind.FirstAssignment && node.operatorToken.kind <= SyntaxKind.LastAssignment) { var n = node.left; while (n.kind === SyntaxKind.ParenthesizedExpression) { n = (n).expression; @@ -4724,6 +4759,7 @@ module ts { case SyntaxKind.WhileStatement: case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.ReturnStatement: case SyntaxKind.WithStatement: case SyntaxKind.SwitchStatement: @@ -4805,10 +4841,10 @@ module ts { case SyntaxKind.BinaryExpression: // In the right operand of an && or ||, narrow based on left operand if (child === (node).right) { - if ((node).operator === SyntaxKind.AmpersandAmpersandToken) { + if ((node).operatorToken.kind === SyntaxKind.AmpersandAmpersandToken) { narrowedType = narrowType(type, (node).left, /*assumeTrue*/ true); } - else if ((node).operator === SyntaxKind.BarBarToken) { + else if ((node).operatorToken.kind === SyntaxKind.BarBarToken) { narrowedType = narrowType(type, (node).left, /*assumeTrue*/ false); } } @@ -4846,13 +4882,13 @@ module ts { return type; } var typeInfo = primitiveTypeInfo[right.text]; - if (expr.operator === SyntaxKind.ExclamationEqualsEqualsToken) { + if (expr.operatorToken.kind === SyntaxKind.ExclamationEqualsEqualsToken) { assumeTrue = !assumeTrue; } 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, /*isOfTypeKind*/ true); + return removeTypesFromUnionType(type, /*typeKind*/ TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.Boolean | TypeFlags.ESSymbol, /*isOfTypeKind*/ true); } // Check was for a primitive type, return that primitive type if it is a subtype if (isTypeSubtypeOf(typeInfo.type, type)) { @@ -4936,7 +4972,7 @@ module ts { case SyntaxKind.ParenthesizedExpression: return narrowType(type, (expr).expression, assumeTrue); case SyntaxKind.BinaryExpression: - var operator = (expr).operator; + var operator = (expr).operatorToken.kind; if (operator === SyntaxKind.EqualsEqualsEqualsToken || operator === SyntaxKind.ExclamationEqualsEqualsToken) { return narrowTypeByEquality(type, expr, assumeTrue); } @@ -5297,7 +5333,7 @@ module ts { function getContextualTypeForBinaryOperand(node: Expression): Type { var binaryExpression = node.parent; - var operator = binaryExpression.operator; + var operator = binaryExpression.operatorToken.kind; if (operator >= SyntaxKind.FirstAssignment && operator <= SyntaxKind.LastAssignment) { // In an assignment expression, the right operand is contextually typed by the type of the left operand. if (node === binaryExpression.right) { @@ -5547,7 +5583,7 @@ module ts { // an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ p: a}] = xxx'. function isAssignmentTarget(node: Node): boolean { var parent = node.parent; - if (parent.kind === SyntaxKind.BinaryExpression && (parent).operator === SyntaxKind.EqualsToken && (parent).left === node) { + if (parent.kind === SyntaxKind.BinaryExpression && (parent).operatorToken.kind === SyntaxKind.EqualsToken && (parent).left === node) { return true; } if (parent.kind === SyntaxKind.PropertyAssignment) { @@ -5561,7 +5597,7 @@ module ts { function checkSpreadElementExpression(node: SpreadElementExpression, contextualMapper?: TypeMapper): Type { var type = checkExpressionCached(node.expression, contextualMapper); - if (!isTypeAssignableTo(type, anyArrayType)) { + if (!isArrayLikeType(type)) { error(node.expression, Diagnostics.Type_0_is_not_an_array_type, typeToString(type)); return unknownType; } @@ -5601,7 +5637,7 @@ module ts { function isNumericComputedName(name: ComputedPropertyName): boolean { // It seems odd to consider an expression of type Any to result in a numeric name, // but this behavior is consistent with checkIndexedAccess - return isTypeOfKind(checkComputedPropertyName(name), TypeFlags.Any | TypeFlags.NumberLike); + return allConstituentTypesHaveKind(checkComputedPropertyName(name), TypeFlags.Any | TypeFlags.NumberLike); } function isNumericLiteralName(name: string) { @@ -5634,10 +5670,13 @@ module ts { if (!links.resolvedType) { links.resolvedType = checkExpression(node.expression); - // This will allow types number, string, or any. It will also allow enums, the unknown + // This will allow types number, string, symbol or any. It will also allow enums, the unknown // type, and any union of these types (like string | number). - if (!isTypeOfKind(links.resolvedType, TypeFlags.Any | TypeFlags.NumberLike | TypeFlags.StringLike)) { - error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_or_any); + if (!allConstituentTypesHaveKind(links.resolvedType, TypeFlags.Any | TypeFlags.NumberLike | TypeFlags.StringLike | TypeFlags.ESSymbol)) { + error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); + } + else { + checkThatExpressionIsProperSymbolReference(node.expression, links.resolvedType, /*reportError*/ true); } } @@ -5886,8 +5925,8 @@ module ts { // See if we can index as a property. if (node.argumentExpression) { - if (node.argumentExpression.kind === SyntaxKind.StringLiteral || node.argumentExpression.kind === SyntaxKind.NumericLiteral) { - var name = (node.argumentExpression).text; + var name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (name !== undefined) { var prop = getPropertyOfType(objectType, name); if (prop) { getNodeLinks(node).resolvedSymbol = prop; @@ -5901,10 +5940,10 @@ module ts { } // Check for compatible indexer types. - if (isTypeOfKind(indexType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike)) { + if (allConstituentTypesHaveKind(indexType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbol)) { // Try to use a number indexer. - if (isTypeOfKind(indexType, TypeFlags.Any | TypeFlags.NumberLike)) { + if (allConstituentTypesHaveKind(indexType, TypeFlags.Any | TypeFlags.NumberLike)) { var numberIndexType = getIndexTypeOfType(objectType, IndexKind.Number); if (numberIndexType) { return numberIndexType; @@ -5926,11 +5965,78 @@ module ts { } // REVIEW: Users should know the type that was actually used. - error(node, Diagnostics.An_index_expression_argument_must_be_of_type_string_number_or_any); + error(node, Diagnostics.An_index_expression_argument_must_be_of_type_string_number_symbol_or_any); return unknownType; } + /** + * If indexArgumentExpression is a string literal or number literal, returns its text. + * 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. + */ + function getPropertyNameForIndexedAccess(indexArgumentExpression: Expression, indexArgumentType: Type): string { + if (indexArgumentExpression.kind === SyntaxKind.StringLiteral || indexArgumentExpression.kind === SyntaxKind.NumericLiteral) { + return (indexArgumentExpression).text; + } + if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, /*reportError*/ false)) { + var rightHandSideName = ((indexArgumentExpression).name).text; + return getPropertyNameForKnownSymbolName(rightHandSideName); + } + + return undefined; + } + + /** + * A proper symbol reference requires the following: + * 1. The property access denotes a property that exists + * 2. The expression is of the form Symbol. + * 3. The property access is of the primitive type symbol. + * 4. Symbol in this context resolves to the global Symbol object + */ + function checkThatExpressionIsProperSymbolReference(expression: Expression, expressionType: Type, reportError: boolean): boolean { + if (expressionType === unknownType) { + // There is already an error, so no need to report one. + return false; + } + + if (!isWellKnownSymbolSyntactically(expression)) { + return false; + } + + // Make sure the property type is the primitive symbol type + if ((expressionType.flags & TypeFlags.ESSymbol) === 0) { + if (reportError) { + error(expression, Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, getTextOfNode(expression)); + } + return false; + } + + // The name is Symbol., so make sure Symbol actually resolves to the + // global Symbol object + var leftHandSide = (expression).expression; + var leftHandSideSymbol = getResolvedSymbol(leftHandSide); + if (!leftHandSideSymbol) { + return false; + } + + var globalESSymbol = getGlobalESSymbolConstructorSymbol(); + if (!globalESSymbol) { + // Already errored when we tried to look up the symbol + return false; + } + + if (leftHandSideSymbol !== globalESSymbol) { + if (reportError) { + error(leftHandSide, Diagnostics.Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object); + } + return false; + } + + return true; + } + function resolveUntypedCall(node: CallLikeExpression): Signature { if (node.kind === SyntaxKind.TaggedTemplateExpression) { checkExpression((node).template); @@ -6845,7 +6951,7 @@ module ts { } function checkArithmeticOperandType(operand: Node, type: Type, diagnostic: DiagnosticMessage): boolean { - if (!isTypeOfKind(type, TypeFlags.Any | TypeFlags.NumberLike)) { + if (!allConstituentTypesHaveKind(type, TypeFlags.Any | TypeFlags.NumberLike)) { error(operand, diagnostic); return false; } @@ -6961,6 +7067,9 @@ module ts { case SyntaxKind.PlusToken: case SyntaxKind.MinusToken: case SyntaxKind.TildeToken: + if (someConstituentTypeHasKind(operandType, TypeFlags.ESSymbol)) { + error(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(node.operator)); + } return numberType; case SyntaxKind.ExclamationToken: return booleanType; @@ -6996,8 +7105,26 @@ module ts { return numberType; } - // Return true if type has the given flags, or is a union type composed of types that all have those flags - function isTypeOfKind(type: Type, kind: TypeFlags): boolean { + // Just like isTypeOfKind below, except that it returns true if *any* constituent + // has this kind. + function someConstituentTypeHasKind(type: Type, kind: TypeFlags): boolean { + if (type.flags & kind) { + return true; + } + if (type.flags & TypeFlags.Union) { + var types = (type).types; + for (var i = 0; i < types.length; i++) { + if (types[i].flags & kind) { + return true; + } + } + return false; + } + return false; + } + + // Return true if type has the given flags, or is a union type composed of types that all have those flags. + function allConstituentTypesHaveKind(type: Type, kind: TypeFlags): boolean { if (type.flags & kind) { return true; } @@ -7027,7 +7154,7 @@ module ts { // 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 (isTypeOfKind(leftType, TypeFlags.Primitive)) { + if (allConstituentTypesHaveKind(leftType, TypeFlags.Primitive)) { error(node.left, 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 @@ -7042,10 +7169,10 @@ module ts { // 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 (!isTypeOfKind(leftType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike)) { - error(node.left, Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number); + if (!allConstituentTypesHaveKind(leftType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbol)) { + error(node.left, Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } - if (!isTypeOfKind(rightType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { + if (!allConstituentTypesHaveKind(rightType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { error(node.right, Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; @@ -7078,7 +7205,7 @@ module ts { function checkArrayLiteralAssignment(node: ArrayLiteralExpression, sourceType: Type, contextualMapper?: TypeMapper): Type { // TODOO(andersh): Allow iterable source type in ES6 - if (!isTypeAssignableTo(sourceType, anyArrayType)) { + if (!isArrayLikeType(sourceType)) { error(node, Diagnostics.Type_0_is_not_an_array_type, typeToString(sourceType)); return sourceType; } @@ -7112,7 +7239,7 @@ module ts { } function checkDestructuringAssignment(target: Expression, sourceType: Type, contextualMapper?: TypeMapper): Type { - if (target.kind === SyntaxKind.BinaryExpression && (target).operator === SyntaxKind.EqualsToken) { + if (target.kind === SyntaxKind.BinaryExpression && (target).operatorToken.kind === SyntaxKind.EqualsToken) { checkBinaryExpression(target, contextualMapper); target = (target).left; } @@ -7135,13 +7262,13 @@ module ts { function checkBinaryExpression(node: BinaryExpression, contextualMapper?: TypeMapper) { // Grammar checking - if (isLeftHandSideExpression(node.left) && isAssignmentOperator(node.operator)) { + if (isLeftHandSideExpression(node.left) && 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) checkGrammarEvalOrArgumentsInStrictMode(node, node.left); } - var operator = node.operator; + var operator = node.operatorToken.kind; if (operator === SyntaxKind.EqualsToken && (node.left.kind === SyntaxKind.ObjectLiteralExpression || node.left.kind === SyntaxKind.ArrayLiteralExpression)) { return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); } @@ -7182,8 +7309,8 @@ module ts { // try and return them a helpful suggestion if ((leftType.flags & TypeFlags.Boolean) && (rightType.flags & TypeFlags.Boolean) && - (suggestedOperator = getSuggestedBooleanOperator(node.operator)) !== undefined) { - error(node, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(node.operator), tokenToString(suggestedOperator)); + (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { + error(node, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(node.operatorToken.kind), tokenToString(suggestedOperator)); } else { // otherwise just check each operand separately and report errors as normal @@ -7206,19 +7333,26 @@ module ts { if (rightType.flags & (TypeFlags.Undefined | TypeFlags.Null)) rightType = leftType; var resultType: Type; - if (isTypeOfKind(leftType, TypeFlags.NumberLike) && isTypeOfKind(rightType, TypeFlags.NumberLike)) { + if (allConstituentTypesHaveKind(leftType, TypeFlags.NumberLike) && allConstituentTypesHaveKind(rightType, TypeFlags.NumberLike)) { // Operands of an enum type are treated as having the primitive type Number. // If both operands are of the Number primitive type, the result is of the Number primitive type. resultType = numberType; } - else if (isTypeOfKind(leftType, TypeFlags.StringLike) || isTypeOfKind(rightType, TypeFlags.StringLike)) { - // If one or both operands are of the String primitive type, the result is of the String primitive type. - resultType = stringType; - } - else if (leftType.flags & TypeFlags.Any || rightType.flags & TypeFlags.Any) { - // Otherwise, the result is of type Any. - // NOTE: unknown type here denotes error type. Old compiler treated this case as any type so do we. - resultType = anyType; + else { + if (allConstituentTypesHaveKind(leftType, TypeFlags.StringLike) || allConstituentTypesHaveKind(rightType, TypeFlags.StringLike)) { + // If one or both operands are of the String primitive type, the result is of the String primitive type. + resultType = stringType; + } + else if (leftType.flags & TypeFlags.Any || rightType.flags & TypeFlags.Any) { + // Otherwise, the result is of type Any. + // NOTE: unknown type here denotes error type. Old compiler treated this case as any type so do we. + resultType = anyType; + } + + // Symbols are not allowed at all in arithmetic expressions + if (resultType && !checkForDisallowedESSymbolOperand(operator)) { + return resultType; + } } if (!resultType) { @@ -7230,14 +7364,18 @@ module ts { checkAssignmentOperator(resultType); } return resultType; - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.EqualsEqualsEqualsToken: - case SyntaxKind.ExclamationEqualsEqualsToken: case SyntaxKind.LessThanToken: case SyntaxKind.GreaterThanToken: case SyntaxKind.LessThanEqualsToken: case SyntaxKind.GreaterThanEqualsToken: + if (!checkForDisallowedESSymbolOperand(operator)) { + return booleanType; + } + // Fall through + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.EqualsEqualsEqualsToken: + case SyntaxKind.ExclamationEqualsEqualsToken: if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { reportOperatorError(); } @@ -7257,6 +7395,20 @@ module ts { return rightType; } + // Return type is true if there was no error, false if there was an error. + function checkForDisallowedESSymbolOperand(operator: SyntaxKind): boolean { + var offendingSymbolOperand = + someConstituentTypeHasKind(leftType, TypeFlags.ESSymbol) ? node.left : + someConstituentTypeHasKind(rightType, TypeFlags.ESSymbol) ? node.right : + undefined; + if (offendingSymbolOperand) { + error(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(operator)); + return false; + } + + return true; + } + function getSuggestedBooleanOperator(operator: SyntaxKind): SyntaxKind { switch (operator) { case SyntaxKind.BarToken: @@ -7291,7 +7443,7 @@ module ts { } function reportOperatorError() { - error(node, Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, tokenToString(node.operator), typeToString(leftType), typeToString(rightType)); + error(node, Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, tokenToString(node.operatorToken.kind), typeToString(leftType), typeToString(rightType)); } } @@ -7342,7 +7494,10 @@ module ts { } function checkPropertyAssignment(node: PropertyAssignment, contextualMapper?: TypeMapper): Type { - if (hasDynamicName(node)) { + // 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 === SyntaxKind.ComputedPropertyName) { checkComputedPropertyName(node.name); } @@ -7353,7 +7508,10 @@ module ts { // Grammar checking checkGrammarMethod(node); - if (hasDynamicName(node)) { + // 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 === SyntaxKind.ComputedPropertyName) { checkComputedPropertyName(node.name); } @@ -7616,7 +7774,7 @@ module ts { function checkPropertyDeclaration(node: PropertyDeclaration) { // Grammar checking - checkGrammarModifiers(node) || checkGrammarProperty(node); + checkGrammarModifiers(node) || checkGrammarProperty(node) || checkGrammarComputedPropertyName(node.name); checkVariableLikeDeclaration(node); } @@ -8165,12 +8323,16 @@ module ts { function checkFunctionLikeDeclaration(node: FunctionLikeDeclaration): void { checkSignatureDeclaration(node); - if (hasDynamicName(node)) { + // 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 === SyntaxKind.ComputedPropertyName) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); } - else { + + if (!hasDynamicName(node)) { // first we want to check the local symbol that contain this declaration // - if node.localSymbol !== undefined - this is current declaration is exported and localSymbol points to the local symbol // - if node.localSymbol === undefined - this node is non-exported so we can just pick the result of getSymbolOfNode @@ -8207,7 +8369,7 @@ module ts { function checkBlock(node: Block) { // Grammar checking for SyntaxKind.Block if (node.kind === SyntaxKind.Block) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); } forEach(node.statements, checkSourceElement); @@ -8324,32 +8486,61 @@ module ts { } } - function checkCollisionWithConstDeclarations(node: VariableLikeDeclaration) { + function checkVarDeclaredNamesNotShadowed(node: VariableDeclaration | BindingElement) { + // - ScriptBody : StatementList + // It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList + // also occurs in the VarDeclaredNames of StatementList. + + // - Block : { StatementList } + // It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList + // also occurs in the VarDeclaredNames of StatementList. + // Variable declarations are hoisted to the top of their function scope. They can shadow // block scoped declarations, which bind tighter. this will not be flagged as duplicate definition // by the binder as the declaration scope is different. // 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 var declarations will not - // step on a const variable. + // step on a let/const variable. // Do not consider let and const declarations, as duplicate block-scoped declarations // are handled by the binder. - // We are only looking for var declarations that step on const declarations from a + // We are only looking for var declarations that step on let\const declarations from a // different scope. e.g.: - // var x = 0; // { - // const x = 0; - // var x = 0; + // const x = 0; // localDeclarationSymbol obtained after name resolution will correspond to this declaration + // var x = 0; // symbol for this declaration will be 'symbol' // } if (node.initializer && (getCombinedNodeFlags(node) & NodeFlags.BlockScoped) === 0) { var symbol = getSymbolOfNode(node); if (symbol.flags & SymbolFlags.FunctionScopedVariable) { var localDeclarationSymbol = resolveName(node, (node.name).text, SymbolFlags.Variable, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined); - if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & SymbolFlags.BlockScopedVariable) { - if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & NodeFlags.Const) { - error(node, Diagnostics.Cannot_redeclare_block_scoped_variable_0, symbolToString(localDeclarationSymbol)); + if (localDeclarationSymbol && + localDeclarationSymbol !== symbol && + localDeclarationSymbol.flags & SymbolFlags.BlockScopedVariable) { + if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & NodeFlags.BlockScoped) { + + var varDeclList = getAncestor(localDeclarationSymbol.valueDeclaration, SyntaxKind.VariableDeclarationList); + var container = + varDeclList.parent.kind === SyntaxKind.VariableStatement && + varDeclList.parent.parent; + + // 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 === SyntaxKind.Block && isAnyFunction(container.parent) || + (container.kind === SyntaxKind.ModuleBlock && container.kind === SyntaxKind.ModuleDeclaration) || + container.kind === SyntaxKind.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 + // since LHS will be block scoped name instead of function scoped + if (!namesShareScope) { + var name = symbolToString(localDeclarationSymbol); + error(getErrorSpanForNode(node), Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); + } } } } @@ -8399,12 +8590,14 @@ module ts { function checkVariableLikeDeclaration(node: VariableLikeDeclaration) { checkSourceElement(node.type); // For a computed property, just check the initializer and exit - if (hasDynamicName(node)) { + // 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 === SyntaxKind.ComputedPropertyName) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } - return; } // For a binding pattern, check contained binding elements if (isBindingPattern(node.name)) { @@ -8446,7 +8639,9 @@ module ts { if (node.kind !== SyntaxKind.PropertyDeclaration && node.kind !== SyntaxKind.PropertySignature) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - checkCollisionWithConstDeclarations(node); + if (node.kind === SyntaxKind.VariableDeclaration || node.kind === SyntaxKind.BindingElement) { + checkVarDeclaredNamesNotShadowed(node); + } checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -8490,14 +8685,14 @@ module ts { function checkExpressionStatement(node: ExpressionStatement) { // Grammar checking - checkGrammarForStatementInAmbientContext(node) + checkGrammarStatementInAmbientContext(node) checkExpression(node.expression); } function checkIfStatement(node: IfStatement) { // Grammar checking - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); @@ -8506,7 +8701,7 @@ module ts { function checkDoStatement(node: DoStatement) { // Grammar checking - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkSourceElement(node.statement); checkExpression(node.expression); @@ -8514,7 +8709,7 @@ module ts { function checkWhileStatement(node: WhileStatement) { // Grammar checking - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.statement); @@ -8522,7 +8717,7 @@ module ts { function checkForStatement(node: ForStatement) { // Grammar checking - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { if (node.initializer && node.initializer.kind == SyntaxKind.VariableDeclarationList) { checkGrammarVariableDeclarationList(node.initializer); } @@ -8542,18 +8737,14 @@ module ts { checkSourceElement(node.statement); } + function checkForOfStatement(node: ForOfStatement) { + // TODO: not yet implemented + checkGrammarForOfStatement(node); + } + function checkForInStatement(node: ForInStatement) { // Grammar checking - if (!checkGrammarForStatementInAmbientContext(node)) { - if (node.initializer.kind === SyntaxKind.VariableDeclarationList) { - var variableList = node.initializer; - if (!checkGrammarVariableDeclarationList(variableList)) { - if (variableList.declarations.length > 1) { - grammarErrorOnFirstToken(variableList.declarations[1], Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement); - } - } - } - } + checkGrammarForInOrForOfStatement(node); // TypeScript 1.0 spec (April 2014): 5.4 // In a 'for-in' statement of the form @@ -8565,9 +8756,6 @@ module ts { if (variableDeclarationList.declarations.length >= 1) { var decl = variableDeclarationList.declarations[0]; checkVariableDeclaration(decl); - if (decl.type) { - error(decl, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation); - } } } else { @@ -8577,7 +8765,7 @@ module ts { // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var exprType = checkExpression(varExpr); - if (exprType !== anyType && exprType !== stringType) { + if (!allConstituentTypesHaveKind(exprType, TypeFlags.Any | TypeFlags.StringLike)) { error(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); } else { @@ -8589,7 +8777,7 @@ module ts { var exprType = checkExpression(node.expression); // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved // in this case error about missing name is already reported - do not report extra one - if (!isTypeOfKind(exprType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { + if (!allConstituentTypesHaveKind(exprType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { error(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } @@ -8598,7 +8786,7 @@ module ts { function checkBreakOrContinueStatement(node: BreakOrContinueStatement) { // Grammar checking - checkGrammarForStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); + checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); // TODO: Check that target label is valid } @@ -8609,7 +8797,7 @@ module ts { function checkReturnStatement(node: ReturnStatement) { // Grammar checking - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { var functionBlock = getContainingFunction(node); if (!functionBlock) { grammarErrorOnFirstToken(node, Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); @@ -8640,7 +8828,7 @@ module ts { function checkWithStatement(node: WithStatement) { // Grammar checking for withStatement - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { if (node.parserContextFlags & ParserContextFlags.StrictMode) { grammarErrorOnFirstToken(node, Diagnostics.with_statements_are_not_allowed_in_strict_mode); } @@ -8652,7 +8840,7 @@ module ts { function checkSwitchStatement(node: SwitchStatement) { // Grammar checking - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); var firstDefaultClause: CaseOrDefaultClause; var hasDuplicateDefaultClause = false; @@ -8689,7 +8877,7 @@ module ts { function checkLabeledStatement(node: LabeledStatement) { // Grammar checking - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { var current = node.parent; while (current) { if (isAnyFunction(current)) { @@ -8710,7 +8898,7 @@ module ts { function checkThrowStatement(node: ThrowStatement) { // Grammar checking - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { if (node.expression === undefined) { grammarErrorAfterFirstToken(node, Diagnostics.Line_break_not_permitted_here); } @@ -8723,7 +8911,7 @@ module ts { function checkTryStatement(node: TryStatement) { // Grammar checking - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkBlock(node.tryBlock); var catchClause = node.catchClause; @@ -8840,6 +9028,7 @@ module ts { case "number": case "boolean": case "string": + case "symbol": case "void": error(name, message, (name).text); } @@ -9058,7 +9247,7 @@ module ts { var typeName1 = typeToString(existing.containingType); var typeName2 = typeToString(base); - var errorInfo = chainDiagnosticMessages(undefined, Diagnostics.Named_properties_0_of_types_1_and_2_are_not_identical, prop.name, typeName1, typeName2); + var errorInfo = chainDiagnosticMessages(undefined, Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2); errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); diagnostics.add(createDiagnosticForNodeFromMessageChain(typeNode, errorInfo)); } @@ -9194,7 +9383,7 @@ module ts { if (right === undefined) { return undefined; } - switch ((e).operator) { + switch ((e).operatorToken.kind) { case SyntaxKind.BarToken: return left | right; case SyntaxKind.AmpersandToken: return left & right; case SyntaxKind.GreaterThanGreaterThanToken: return left >> right; @@ -9586,6 +9775,8 @@ module ts { return checkForStatement(node); case SyntaxKind.ForInStatement: return checkForInStatement(node); + case SyntaxKind.ForOfStatement: + return checkForOfStatement(node); case SyntaxKind.ContinueStatement: case SyntaxKind.BreakStatement: return checkBreakOrContinueStatement(node); @@ -9624,10 +9815,10 @@ module ts { case SyntaxKind.ExportAssignment: return checkExportAssignment(node); case SyntaxKind.EmptyStatement: - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); return; case SyntaxKind.DebuggerStatement: - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); return; } } @@ -9699,6 +9890,7 @@ module ts { case SyntaxKind.WhileStatement: case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.ContinueStatement: case SyntaxKind.BreakStatement: case SyntaxKind.ReturnStatement: @@ -9895,6 +10087,7 @@ module ts { case SyntaxKind.NumberKeyword: case SyntaxKind.StringKeyword: case SyntaxKind.BooleanKeyword: + case SyntaxKind.SymbolKeyword: return true; case SyntaxKind.VoidKeyword: return node.parent.kind !== SyntaxKind.VoidExpression; @@ -10521,7 +10714,7 @@ module ts { getSymbolLinks(unknownSymbol).type = unknownType; globals[undefinedSymbol.name] = undefinedSymbol; // Initialize special types - globalArraySymbol = getGlobalSymbol("Array"); + globalArraySymbol = getGlobalTypeSymbol("Array"); globalArrayType = getTypeOfGlobalSymbol(globalArraySymbol, 1); globalObjectType = getGlobalType("Object"); globalFunctionType = getGlobalType("Function"); @@ -10529,11 +10722,24 @@ module ts { globalNumberType = getGlobalType("Number"); globalBooleanType = getGlobalType("Boolean"); globalRegExpType = getGlobalType("RegExp"); + // If we're in ES6 mode, load the TemplateStringsArray. // Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios. - globalTemplateStringsArrayType = languageVersion >= ScriptTarget.ES6 - ? getGlobalType("TemplateStringsArray") - : unknownType; + if (languageVersion >= ScriptTarget.ES6) { + globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); + globalESSymbolType = getGlobalType("Symbol"); + globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); + } + else { + globalTemplateStringsArrayType = unknownType; + + // Consider putting Symbol interface in lib.d.ts. On the plus side, putting it in lib.d.ts would make it + // extensible for Polyfilling Symbols. But putting it into lib.d.ts could also break users that have + // a global Symbol already, particularly if it is a class. + globalESSymbolType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + globalESSymbolConstructorSymbol = undefined; + } + anyArrayType = createArrayType(anyType); } @@ -10750,25 +10956,25 @@ module ts { return grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_exactly_one_parameter); } } - else if (parameter.dotDotDotToken) { + if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, Diagnostics.An_index_signature_cannot_have_a_rest_parameter); } - else if (parameter.flags & NodeFlags.Modifier) { + if (parameter.flags & NodeFlags.Modifier) { return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); } - else if (parameter.questionToken) { + if (parameter.questionToken) { return grammarErrorOnNode(parameter.questionToken, Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark); } - else if (parameter.initializer) { + if (parameter.initializer) { return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_an_initializer); } - else if (!parameter.type) { + if (!parameter.type) { return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - else if (parameter.type.kind !== SyntaxKind.StringKeyword && parameter.type.kind !== SyntaxKind.NumberKeyword) { + if (parameter.type.kind !== SyntaxKind.StringKeyword && parameter.type.kind !== SyntaxKind.NumberKeyword) { return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } - else if (!node.type) { + if (!node.type) { return grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_a_type_annotation); } } @@ -10901,10 +11107,7 @@ module ts { } var computedPropertyName = node; - if (languageVersion < ScriptTarget.ES6) { - return grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher); - } - else if (computedPropertyName.expression.kind === SyntaxKind.BinaryExpression && (computedPropertyName.expression).operator === SyntaxKind.CommaToken) { + if (computedPropertyName.expression.kind === SyntaxKind.BinaryExpression && (computedPropertyName.expression).operatorToken.kind === SyntaxKind.CommaToken) { return grammarErrorOnNode(computedPropertyName.expression, Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } @@ -10999,6 +11202,49 @@ module ts { } } + function checkGrammarForInOrForOfStatement(forInOrOfStatement: ForInStatement | ForOfStatement): boolean { + if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { + return true; + } + + if (forInOrOfStatement.initializer.kind === SyntaxKind.VariableDeclarationList) { + var variableList = forInOrOfStatement.initializer; + if (!checkGrammarVariableDeclarationList(variableList)) { + if (variableList.declarations.length > 1) { + var diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement + ? Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement + : 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 === SyntaxKind.ForInStatement + ? Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer + : 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 === SyntaxKind.ForInStatement + ? Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation + : Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + return grammarErrorOnNode(firstDeclaration, diagnostic); + } + } + } + + return false; + } + + function checkGrammarForOfStatement(forOfStatement: ForOfStatement): boolean { + // Temporarily disallow for-of statements until type check work is complete. + return grammarErrorOnFirstToken(forOfStatement, Diagnostics.for_of_statements_are_not_currently_supported); + if (languageVersion < ScriptTarget.ES6) { + return grammarErrorOnFirstToken(forOfStatement, Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher); + } + + return checkGrammarForInOrForOfStatement(forOfStatement); + } + function checkGrammarAccessor(accessor: MethodDeclaration): boolean { var kind = accessor.kind; if (languageVersion < ScriptTarget.ES5) { @@ -11041,8 +11287,8 @@ module ts { } } - function checkGrammarForDisallowedComputedProperty(node: DeclarationName, message: DiagnosticMessage) { - if (node.kind === SyntaxKind.ComputedPropertyName) { + function checkGrammarForNonSymbolComputedProperty(node: DeclarationName, message: DiagnosticMessage) { + if (node.kind === SyntaxKind.ComputedPropertyName && !isWellKnownSymbolSyntactically((node).expression)) { return grammarErrorOnNode(node, message); } } @@ -11073,17 +11319,17 @@ module ts { // and accessors are not allowed in ambient contexts in general, // so this error only really matters for methods. if (isInAmbientContext(node)) { - return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_an_ambient_context); + return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol); } else if (!node.body) { - return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_method_overloads); + return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } else if (node.parent.kind === SyntaxKind.InterfaceDeclaration) { - return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_interfaces); + return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } else if (node.parent.kind === SyntaxKind.TypeLiteral) { - return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_type_literals); + return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -11091,6 +11337,7 @@ module ts { switch (node.kind) { case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.DoStatement: case SyntaxKind.WhileStatement: return true; @@ -11247,6 +11494,7 @@ module ts { case SyntaxKind.WithStatement: case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: return false; case SyntaxKind.LabeledStatement: return allowLetAndConstDeclarations(parent.parent); @@ -11297,6 +11545,9 @@ module ts { var inAmbientContext = isInAmbientContext(enumDecl); for (var i = 0, n = enumDecl.members.length; i < n; i++) { var node = enumDecl.members[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 === SyntaxKind.ComputedPropertyName) { hasError = grammarErrorOnNode(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums); } @@ -11377,17 +11628,17 @@ module ts { function checkGrammarProperty(node: PropertyDeclaration) { if (node.parent.kind === SyntaxKind.ClassDeclaration) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, Diagnostics.A_class_member_cannot_be_declared_optional) || - checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_class_property_declarations)) { + checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } else if (node.parent.kind === SyntaxKind.InterfaceDeclaration) { - if (checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_interfaces)) { + if (checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } } else if (node.parent.kind === SyntaxKind.TypeLiteral) { - if (checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_type_literals)) { + if (checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } } @@ -11436,7 +11687,7 @@ module ts { return isInAmbientContext(node) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node); } - function checkGrammarForStatementInAmbientContext(node: Node): boolean { + function checkGrammarStatementInAmbientContext(node: Node): boolean { if (isInAmbientContext(node)) { // An accessors is already reported about the ambient context if (isAccessor(node.parent.kind)) { diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index a6c9b5399d1..9169a7bf688 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -123,12 +123,12 @@ module ts { An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." }, yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: DiagnosticCategory.Error, key: "'yield' expression must be contained_within a generator declaration." }, Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums." }, - Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in an ambient context." }, - Computed_property_names_are_not_allowed_in_class_property_declarations: { code: 1166, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in class property declarations." }, + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: DiagnosticCategory.Error, key: "A computed property name in an ambient context must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: DiagnosticCategory.Error, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: DiagnosticCategory.Error, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, - Computed_property_names_are_not_allowed_in_method_overloads: { code: 1168, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in method overloads." }, - Computed_property_names_are_not_allowed_in_interfaces: { code: 1169, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in interfaces." }, - Computed_property_names_are_not_allowed_in_type_literals: { code: 1170, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in type literals." }, + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: DiagnosticCategory.Error, key: "A computed property name in a method overload must directly refer to a built-in symbol." }, + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: DiagnosticCategory.Error, key: "A computed property name in an interface must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: DiagnosticCategory.Error, key: "A computed property name in a type literal must directly refer to a built-in symbol." }, A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: DiagnosticCategory.Error, key: "A comma expression is not allowed in a computed property name." }, extends_clause_already_seen: { code: 1172, category: DiagnosticCategory.Error, key: "'extends' clause already seen." }, extends_clause_must_precede_implements_clause: { code: 1173, category: DiagnosticCategory.Error, key: "'extends' clause must precede 'implements' clause." }, @@ -147,10 +147,13 @@ module ts { Merge_conflict_marker_encountered: { code: 1185, category: DiagnosticCategory.Error, key: "Merge conflict marker encountered." }, A_rest_element_cannot_have_an_initializer: { code: 1186, category: DiagnosticCategory.Error, key: "A rest element cannot have an initializer." }, A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: DiagnosticCategory.Error, key: "A parameter property may not be a binding pattern." }, - An_import_declaration_cannot_have_modifiers: { code: 1188, category: DiagnosticCategory.Error, key: "An import declaration cannot have modifiers." }, - External_module_0_has_no_default_export_or_export_assignment: { code: 1189, category: DiagnosticCategory.Error, key: "External module '{0}' has no default export or export assignment." }, - An_export_declaration_cannot_have_modifiers: { code: 1190, category: DiagnosticCategory.Error, key: "An export declaration cannot have modifiers." }, - Export_declarations_are_not_permitted_in_an_internal_module: { code: 1191, category: DiagnosticCategory.Error, key: "Export declarations are not permitted in an internal module." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...of' statement." }, + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: DiagnosticCategory.Error, key: "The variable declaration of a 'for...in' statement cannot have an initializer." }, + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: DiagnosticCategory.Error, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, + An_import_declaration_cannot_have_modifiers: { code: 1191, category: DiagnosticCategory.Error, key: "An import declaration cannot have modifiers." }, + External_module_0_has_no_default_export_or_export_assignment: { code: 1192, category: DiagnosticCategory.Error, key: "External module '{0}' has no default export or export assignment." }, + An_export_declaration_cannot_have_modifiers: { code: 1193, category: DiagnosticCategory.Error, key: "An export declaration cannot have modifiers." }, + Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: DiagnosticCategory.Error, key: "Export declarations are not permitted in an internal module." }, Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 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: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, @@ -170,7 +173,7 @@ module ts { Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: DiagnosticCategory.Error, key: "Global type '{0}' must be a class or interface type." }, Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: DiagnosticCategory.Error, key: "Global type '{0}' must have {1} type parameter(s)." }, Cannot_find_global_type_0: { code: 2318, category: DiagnosticCategory.Error, key: "Cannot find global type '{0}'." }, - Named_properties_0_of_types_1_and_2_are_not_identical: { code: 2319, category: DiagnosticCategory.Error, key: "Named properties '{0}' of types '{1}' and '{2}' are not identical." }, + Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: DiagnosticCategory.Error, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: DiagnosticCategory.Error, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: DiagnosticCategory.Error, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, Type_0_is_not_assignable_to_type_1: { code: 2322, category: DiagnosticCategory.Error, key: "Type '{0}' is not assignable to type '{1}'." }, @@ -192,7 +195,7 @@ module ts { Property_0_does_not_exist_on_type_1: { code: 2339, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on type '{1}'." }, Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: DiagnosticCategory.Error, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: DiagnosticCategory.Error, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_or_any: { code: 2342, category: DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', or 'any'." }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: DiagnosticCategory.Error, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: DiagnosticCategory.Error, key: "Supplied parameters do not match any signature of call target." }, @@ -208,7 +211,7 @@ module ts { The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: DiagnosticCategory.Error, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: DiagnosticCategory.Error, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: DiagnosticCategory.Error, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, - The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number: { code: 2360, category: DiagnosticCategory.Error, key: "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'." }, + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: DiagnosticCategory.Error, key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: DiagnosticCategory.Error, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: DiagnosticCategory.Error, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: DiagnosticCategory.Error, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, @@ -303,12 +306,27 @@ module ts { Type_0_is_not_an_array_type: { code: 2461, category: DiagnosticCategory.Error, key: "Type '{0}' is not an array type." }, A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: DiagnosticCategory.Error, key: "A rest element must be last in an array destructuring pattern" }, A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: DiagnosticCategory.Error, key: "A binding pattern parameter cannot be optional in an implementation signature." }, - A_computed_property_name_must_be_of_type_string_number_or_any: { code: 2464, category: DiagnosticCategory.Error, key: "A computed property name must be of type 'string', 'number', or 'any'." }, + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: DiagnosticCategory.Error, key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a computed property name." }, super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: DiagnosticCategory.Error, key: "'super' cannot be referenced in a computed property name." }, - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2466, category: DiagnosticCategory.Error, key: "A computed property name cannot reference a type parameter from its containing type." }, - Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2468, category: DiagnosticCategory.Error, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, - Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2469, category: DiagnosticCategory.Error, key: "Export declaration conflicts with exported declaration of '{0}'" }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: DiagnosticCategory.Error, key: "A computed property name cannot reference a type parameter from its containing type." }, + Cannot_find_global_value_0: { code: 2468, category: DiagnosticCategory.Error, key: "Cannot find global value '{0}'." }, + The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: DiagnosticCategory.Error, key: "The '{0}' operator cannot be applied to type 'symbol'." }, + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: DiagnosticCategory.Error, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: DiagnosticCategory.Error, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: DiagnosticCategory.Error, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, + Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: DiagnosticCategory.Error, key: "Enum declarations must all be const or non-const." }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: DiagnosticCategory.Error, key: "In 'const' enum declarations member initializer must be constant expression." }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: DiagnosticCategory.Error, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: DiagnosticCategory.Error, key: "A const enum member can only be accessed using a string literal." }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to a non-finite value." }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, + Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: DiagnosticCategory.Error, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: DiagnosticCategory.Error, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, + for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: DiagnosticCategory.Error, key: "'for...of' statements are only available when targeting ECMAScript 6 or higher." }, + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, + Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: DiagnosticCategory.Error, key: "Export declaration conflicts with exported declaration of '{0}'" }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -378,14 +396,6 @@ module ts { Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: DiagnosticCategory.Error, key: "Exported type alias '{0}' has or is using private name '{1}'." }, - Enum_declarations_must_all_be_const_or_non_const: { code: 4082, category: DiagnosticCategory.Error, key: "Enum declarations must all be const or non-const." }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 4083, category: DiagnosticCategory.Error, key: "In 'const' enum declarations member initializer must be constant expression." }, - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 4084, category: DiagnosticCategory.Error, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 4085, category: DiagnosticCategory.Error, key: "A const enum member can only be accessed using a string literal." }, - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 4086, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to a non-finite value." }, - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 4087, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, - Property_0_does_not_exist_on_const_enum_1: { code: 4088, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, - let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 4089, category: DiagnosticCategory.Error, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: DiagnosticCategory.Error, key: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: DiagnosticCategory.Error, key: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: DiagnosticCategory.Error, key: "Cannot read file '{0}': {1}" }, @@ -462,5 +472,6 @@ module ts { yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." }, Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." }, The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, + for_of_statements_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "'for...of' statements are not currently supported." }, }; } \ No newline at end of file diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 16cfe5e10e8..38a67dc6ed4 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -483,11 +483,11 @@ "category": "Error", "code": 1164 }, - "Computed property names are not allowed in an ambient context.": { + "A computed property name in an ambient context must directly refer to a built-in symbol.": { "category": "Error", "code": 1165 }, - "Computed property names are not allowed in class property declarations.": { + "A computed property name in a class property declaration must directly refer to a built-in symbol.": { "category": "Error", "code": 1166 }, @@ -495,15 +495,15 @@ "category": "Error", "code": 1167 }, - "Computed property names are not allowed in method overloads.": { + "A computed property name in a method overload must directly refer to a built-in symbol.": { "category": "Error", "code": 1168 }, - "Computed property names are not allowed in interfaces.": { + "A computed property name in an interface must directly refer to a built-in symbol.": { "category": "Error", "code": 1169 }, - "Computed property names are not allowed in type literals.": { + "A computed property name in a type literal must directly refer to a built-in symbol.": { "category": "Error", "code": 1170 }, @@ -579,22 +579,34 @@ "category": "Error", "code": 1187 }, - "An import declaration cannot have modifiers.": { + "Only a single variable declaration is allowed in a 'for...of' statement.": { "category": "Error", "code": 1188 }, - "External module '{0}' has no default export or export assignment.": { + "The variable declaration of a 'for...in' statement cannot have an initializer.": { "category": "Error", "code": 1189 }, - "An export declaration cannot have modifiers.": { + "The variable declaration of a 'for...of' statement cannot have an initializer.": { "category": "Error", "code": 1190 }, - "Export declarations are not permitted in an internal module.": { + "An import declaration cannot have modifiers.": { "category": "Error", "code": 1191 }, + "External module '{0}' has no default export or export assignment.": { + "category": "Error", + "code": 1192 + }, + "An export declaration cannot have modifiers.": { + "category": "Error", + "code": 1193 + }, + "Export declarations are not permitted in an internal module.": { + "category": "Error", + "code": 1194 + }, "Duplicate identifier '{0}'.": { "category": "Error", @@ -672,7 +684,7 @@ "category": "Error", "code": 2318 }, - "Named properties '{0}' of types '{1}' and '{2}' are not identical.": { + "Named property '{0}' of types '{1}' and '{2}' are not identical.": { "category": "Error", "code": 2319 }, @@ -760,7 +772,7 @@ "category": "Error", "code": 2341 }, - "An index expression argument must be of type 'string', 'number', or 'any'.": { + "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'.": { "category": "Error", "code": 2342 }, @@ -824,7 +836,7 @@ "category": "Error", "code": 2359 }, - "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.": { + "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.": { "category": "Error", "code": 2360 }, @@ -1204,7 +1216,7 @@ "category": "Error", "code": 2463 }, - "A computed property name must be of type 'string', 'number', or 'any'.": { + "A computed property name must be of type 'string', 'number', 'symbol', or 'any'.": { "category": "Error", "code": 2464 }, @@ -1218,16 +1230,76 @@ }, "A computed property name cannot reference a type parameter from its containing type.": { "category": "Error", - "code": 2466 + "code": 2467 }, - "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher.": { + "Cannot find global value '{0}'.": { "category": "Error", "code": 2468 }, - "Export declaration conflicts with exported declaration of '{0}'": { + "The '{0}' operator cannot be applied to type 'symbol'.": { "category": "Error", "code": 2469 }, + "'Symbol' reference does not refer to the global Symbol constructor object.": { + "category": "Error", + "code": 2470 + }, + "A computed property name of the form '{0}' must be of type 'symbol'.": { + "category": "Error", + "code": 2471 + }, + "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher.": { + "category": "Error", + "code": 2472 + }, + "Enum declarations must all be const or non-const.": { + "category": "Error", + "code": 2473 + }, + "In 'const' enum declarations member initializer must be constant expression.": { + "category": "Error", + "code": 2474 + }, + "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.": { + "category": "Error", + "code": 2475 + }, + "A const enum member can only be accessed using a string literal.": { + "category": "Error", + "code": 2476 + }, + "'const' enum member initializer was evaluated to a non-finite value.": { + "category": "Error", + "code": 2477 + }, + "'const' enum member initializer was evaluated to disallowed value 'NaN'.": { + "category": "Error", + "code": 2478 + }, + "Property '{0}' does not exist on 'const' enum '{1}'.": { + "category": "Error", + "code": 2479 + }, + "'let' is not allowed to be used as a name in 'let' or 'const' declarations.": { + "category": "Error", + "code": 2480 + }, + "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'.": { + "category": "Error", + "code": 2481 + }, + "'for...of' statements are only available when targeting ECMAScript 6 or higher.": { + "category": "Error", + "code": 2482 + }, + "The left-hand side of a 'for...of' statement cannot use a type annotation.": { + "category": "Error", + "code": 2483 + }, + "Export declaration conflicts with exported declaration of '{0}'": { + "category": "Error", + "code": 2484 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", @@ -1504,39 +1576,7 @@ "Exported type alias '{0}' has or is using private name '{1}'.": { "category": "Error", "code": 4081 - }, - "Enum declarations must all be const or non-const.": { - "category": "Error", - "code": 4082 - }, - "In 'const' enum declarations member initializer must be constant expression.": { - "category": "Error", - "code": 4083 - }, - "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.": { - "category": "Error", - "code": 4084 - }, - "A const enum member can only be accessed using a string literal.": { - "category": "Error", - "code": 4085 - }, - "'const' enum member initializer was evaluated to a non-finite value.": { - "category": "Error", - "code": 4086 - }, - "'const' enum member initializer was evaluated to disallowed value 'NaN'.": { - "category": "Error", - "code": 4087 - }, - "Property '{0}' does not exist on 'const' enum '{1}'.": { - "category": "Error", - "code": 4088 - }, - "'let' is not allowed to be used as a name in 'let' or 'const' declarations.": { - "category": "Error", - "code": 4089 - }, + }, "The current host does not support the '{0}' option.": { "category": "Error", "code": 5001 @@ -1841,5 +1881,9 @@ "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.": { "category": "Error", "code": 9002 + }, + "'for...of' statements are not currently supported.": { + "category": "Error", + "code": 9003 } } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index e060d6fcbb8..3330003f681 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -27,6 +27,12 @@ module ts { diagnosticMessage: DiagnosticMessage; typeName?: DeclarationName; } + + interface SynthesizedNode extends Node { + leadingCommentRanges?: CommentRange[]; + trailingCommentRanges?: CommentRange[]; + } + type GetSymbolAccessibilityDiagnostic = (symbolAccesibilityResult: SymbolAccessiblityResult) => SymbolAccessibilityDiagnostic; interface EmitTextWriterWithSymbolWriter extends EmitTextWriter, SymbolWriter { @@ -176,16 +182,17 @@ module ts { function writeCommentRange(currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string){ if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) { var firstCommentLineAndCharacter = getLineAndCharacterOfPosition(currentSourceFile, comment.pos); - var lastLine = getLineStarts(currentSourceFile).length; + var lineCount = getLineStarts(currentSourceFile).length; var firstCommentLineIndent: number; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = currentLine === lastLine ? (comment.end + 1) : getPositionFromLineAndCharacter(currentSourceFile, currentLine + 1, /*character*/1); + var nextLineStart = (currentLine + 1) === lineCount + ? currentSourceFile.text.length + 1 + : getStartPositionOfLine(currentLine + 1, currentSourceFile); 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(getPositionFromLineAndCharacter(currentSourceFile, firstCommentLineAndCharacter.line, /*character*/1), - comment.pos); + firstCommentLineIndent = calculateIndent(getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); } // These are number of spaces writer is going to write at current indent @@ -201,7 +208,7 @@ module ts { // } // module m { // /* this is line 1 -- Assume current writer indent 8 - // * line --3 = 8 - 4 + 5 + // * line --3 = 8 - 4 + 5 // More right indented comment */ --4 = 8 - 4 + 11 // class c { } // } @@ -277,11 +284,11 @@ module ts { }); } - function getAllAccessorDeclarations(node: ClassDeclaration, accessor: AccessorDeclaration) { + function getAllAccessorDeclarations(declarations: NodeArray, accessor: AccessorDeclaration) { var firstAccessor: AccessorDeclaration; var getAccessor: AccessorDeclaration; var setAccessor: AccessorDeclaration; - if (accessor.name.kind === SyntaxKind.ComputedPropertyName) { + if (hasDynamicName(accessor)) { firstAccessor = accessor; if (accessor.kind === SyntaxKind.GetAccessor) { getAccessor = accessor; @@ -294,20 +301,23 @@ module ts { } } else { - forEach(node.members,(member: Declaration) => { - if ((member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) && - (member.name).text === (accessor.name).text && - (member.flags & NodeFlags.Static) === (accessor.flags & NodeFlags.Static)) { - if (!firstAccessor) { - firstAccessor = member; - } + forEach(declarations, (member: Declaration) => { + if ((member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) + && (member.flags & NodeFlags.Static) === (accessor.flags & NodeFlags.Static)) { + var memberName = getPropertyNameForPropertyNameNode(member.name); + var accessorName = getPropertyNameForPropertyNameNode(accessor.name); + if (memberName === accessorName) { + if (!firstAccessor) { + firstAccessor = member; + } - if (member.kind === SyntaxKind.GetAccessor && !getAccessor) { - getAccessor = member; - } + if (member.kind === SyntaxKind.GetAccessor && !getAccessor) { + getAccessor = member; + } - if (member.kind === SyntaxKind.SetAccessor && !setAccessor) { - setAccessor = member; + if (member.kind === SyntaxKind.SetAccessor && !setAccessor) { + setAccessor = member; + } } } }); @@ -365,8 +375,8 @@ module ts { var aliasDeclarationEmitInfo: AliasDeclarationEmitInfo[] = []; - // Contains the reference paths that needs to go in the declaration file. - // Collecting this separately because reference paths need to be first thing in the declaration file + // Contains the reference paths that needs to go in the declaration file. + // Collecting this separately because reference paths need to be first thing in the declaration file // and we could be collecting these paths from multiple files into single one with --out option var referencePathsOutput = ""; @@ -473,7 +483,7 @@ module ts { // Eg. // export function bar(a: foo.Foo) { } // import foo = require("foo"); - // Writing of function bar would mark alias declaration foo as visible but we haven't yet visited that declaration so do nothing, + // 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 (aliasEmitInfo) { createAndSetNewTextWriterWithSymbolWriter(); @@ -585,6 +595,7 @@ module ts { case SyntaxKind.StringKeyword: case SyntaxKind.NumberKeyword: case SyntaxKind.BooleanKeyword: + case SyntaxKind.SymbolKeyword: case SyntaxKind.VoidKeyword: case SyntaxKind.StringLiteral: return writeTextOfNode(currentSourceFile, type); @@ -614,7 +625,7 @@ module ts { } function emitEntityName(entityName: EntityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, + var visibilityResult = resolver.isEntityNameVisible(entityName, // Aliases can be written asynchronously so use correct enclosing declaration entityName.parent.kind === SyntaxKind.ImportEqualsDeclaration ? entityName.parent : enclosingDeclaration); @@ -698,7 +709,7 @@ module 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 the node is exported + // If the node is exported if (node.flags & NodeFlags.Export) { write("export "); } @@ -1089,7 +1100,7 @@ module ts { } function emitTypeOfVariableDeclarationFromTypeLiteral(node: VariableLikeDeclaration) { - // if this is property of type literal, + // if this is property of type literal, // or is parameter of method/call/construct/index signature of type literal // emit only if type is specified if (node.type) { @@ -1122,8 +1133,8 @@ module ts { if (hasDynamicName(node)) { return; } - - var accessors = getAllAccessorDeclarations(node.parent, node); + + var accessors = getAllAccessorDeclarations((node.parent).members, node); if (node === accessors.firstAccessor) { emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); @@ -1504,7 +1515,7 @@ module ts { referencePathsOutput += "/// " + newLine; } } - + export function getDeclarationDiagnostics(host: EmitHost, resolver: EmitResolver, targetSourceFile: SourceFile): Diagnostic[] { var diagnostics: Diagnostic[] = []; var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, ".js"); @@ -1600,7 +1611,7 @@ module ts { var emitEnd = function (node: Node) { }; /** Emit the text for the given token that comes after startPos - * This by default writes the text provided with the given tokenKind + * 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 @@ -1686,13 +1697,13 @@ module ts { // 1. Relative Column 0 based sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); - // 2. Relative sourceIndex + // 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 + // 4. Relative sourceColumn 0 based sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); // 5. Relative namePosition 0 based @@ -1742,6 +1753,11 @@ module ts { function recordSourceMapSpan(pos: number) { var sourceLinePos = getLineAndCharacterOfPosition(currentSourceFile, pos); + + // Convert the location to be one-based. + sourceLinePos.line++; + sourceLinePos.character++; + var emittedLine = writer.getLine(); var emittedColumn = writer.getColumn(); @@ -1750,8 +1766,8 @@ module ts { lastRecordedSourceMapSpan.emittedLine != emittedLine || lastRecordedSourceMapSpan.emittedColumn != emittedColumn || (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && - (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || - (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || + (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { // Encode the last recordedSpan before assigning new encodeLastRecordedSourceMapSpan(); @@ -1792,7 +1808,7 @@ module ts { function recordNewSourceFileStart(node: SourceFile) { // Add the file to tsFilePaths - // If sourceroot option: Use the relative path corresponding to the common directory path + // 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; @@ -1932,7 +1948,7 @@ module ts { sourceMapDecodedMappings: [] }; - // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the + // 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) !== CharacterCodes.slash) { @@ -2010,13 +2026,20 @@ module ts { return result; } - function recordTempDeclaration(name: Identifier) { + function recordTempDeclaration(name: Identifier): void { if (!tempVariables) { tempVariables = []; } tempVariables.push(name); } + function createAndRecordTempVariable(location: Node): Identifier { + var temp = createTempVariable(location, /*forLoopVariable*/ false); + recordTempDeclaration(temp); + + return temp; + } + function emitTempDeclarations(newLine: boolean) { if (tempVariables) { if (newLine) { @@ -2065,10 +2088,53 @@ module ts { } } - function emitList(nodes: Node[], start: number, count: number, multiLine: boolean, trailingComma: boolean) { - if (multiLine) { - increaseIndent(); + function emitLinePreservingList(parent: Node, nodes: NodeArray, allowTrailingComma: boolean, spacesBetweenBraces: boolean) { + 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]); + } + + var closeTokenIsOnSameLineAsLastElement = nodeEndPositionsAreOnSameLine(parent, lastOrUndefined(nodes)); + + if (nodes.hasTrailingComma && allowTrailingComma) { + write(","); + } + + decreaseIndent(); + + if (closeTokenIsOnSameLineAsLastElement) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + } + + function emitList(nodes: Node[], start: number, count: number, multiLine: boolean, trailingComma: boolean) { for (var i = 0; i < count; i++) { if (multiLine) { if (i) { @@ -2087,7 +2153,6 @@ module ts { write(","); } if (multiLine) { - decreaseIndent(); writeLine(); } } @@ -2098,12 +2163,6 @@ module ts { } } - function emitMultiLineList(nodes: Node[]) { - if (nodes) { - emitList(nodes, 0, nodes.length, /*multiline*/ true, /*trailingComma*/ false); - } - } - function emitLines(nodes: Node[]) { emitLinesStartingAt(nodes, /*startIndex*/ 0); } @@ -2130,7 +2189,7 @@ module ts { function emitLiteral(node: LiteralExpression) { var text = languageVersion < ScriptTarget.ES6 && isTemplateLiteralKind(node.kind) ? getTemplateLiteralAsStringLiteral(node) : node.parent ? getSourceTextOfNodeFromSourceFile(currentSourceFile, node) : - node.text; + node.text; if (compilerOptions.sourceMap && (node.kind === SyntaxKind.StringLiteral || isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } @@ -2248,15 +2307,15 @@ module ts { // 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, + // 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 SyntaxKind.BinaryExpression: - switch ((expression).operator) { + switch ((expression).operatorToken.kind) { case SyntaxKind.AsteriskToken: case SyntaxKind.SlashToken: case SyntaxKind.PercentToken: @@ -2282,7 +2341,10 @@ module ts { // 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: DeclarationName) { + Debug.assert(node.kind !== SyntaxKind.BindingElement); + if (node.kind === SyntaxKind.StringLiteral) { emitLiteral(node); } @@ -2456,7 +2518,13 @@ module ts { i++; } write("["); + if (multiLine) { + increaseIndent(); + } emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); + if (multiLine) { + decreaseIndent(); + } write("]"); pos = i; } @@ -2467,15 +2535,18 @@ module ts { } } + function isSpreadElementExpression(node: Node) { + return node.kind === SyntaxKind.SpreadElementExpression; + } + function emitArrayLiteral(node: ArrayLiteralExpression) { var elements = node.elements; if (elements.length === 0) { write("[]"); } - else if (languageVersion >= ScriptTarget.ES6) { + else if (languageVersion >= ScriptTarget.ES6 || !forEach(elements, isSpreadElementExpression)) { write("["); - emitList(elements, 0, elements.length, /*multiLine*/ (node.flags & NodeFlags.MultiLine) !== 0, - /*trailingComma*/ elements.hasTrailingComma); + emitLinePreservingList(node, node.elements, elements.hasTrailingComma, /*spacesBetweenBraces:*/ false); write("]"); } else { @@ -2484,20 +2555,246 @@ module ts { } } - function emitObjectLiteral(node: ObjectLiteralExpression) { - write("{"); - var properties = node.properties; - if (properties.length) { - var multiLine = (node.flags & NodeFlags.MultiLine) !== 0; - if (!multiLine) { - write(" "); + function createSynthesizedNode(kind: SyntaxKind): Node { + var node = createNode(kind); + node.pos = -1; + node.end = -1; + + return node; + } + + function emitDownlevelObjectLiteralWithComputedProperties(node: ObjectLiteralExpression, firstComputedPropertyIndex: number): void { + var parenthesizedObjectLiteral = createDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex); + return emit(parenthesizedObjectLiteral); + } + + function createDownlevelObjectLiteralWithComputedProperties(originalObjectLiteral: ObjectLiteralExpression, firstComputedPropertyIndex: number): ParenthesizedExpression { + // 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(originalObjectLiteral); + + // Hold onto the initial non-computed properties in a new object literal, + // then create the rest through property accesses on the temp variable. + var initialObjectLiteral = createSynthesizedNode(SyntaxKind.ObjectLiteralExpression); + initialObjectLiteral.properties = >originalObjectLiteral.properties.slice(0, firstComputedPropertyIndex); + initialObjectLiteral.flags |= NodeFlags.MultiLine; + + // The comma expressions that will patch the object literal. + // This will end up being something like '_a = { ... }, _a.x = 10, _a.y = 20, _a'. + var propertyPatches = createBinaryExpression(tempVar, SyntaxKind.EqualsToken, initialObjectLiteral); + + ts.forEach(originalObjectLiteral.properties, property => { + var patchedProperty = tryCreatePatchingPropertyAssignment(originalObjectLiteral, tempVar, property); + if (patchedProperty) { + // TODO(drosen): Preserve comments + //var leadingComments = getLeadingCommentRanges(currentSourceFile.text, property.pos); + //var trailingComments = getTrailingCommentRanges(currentSourceFile.text, property.end); + //addCommentsToSynthesizedNode(patchedProperty, leadingComments, trailingComments); + + propertyPatches = createBinaryExpression(propertyPatches, SyntaxKind.CommaToken, patchedProperty); } - emitList(properties, 0, properties.length, /*multiLine*/ multiLine, - /*trailingComma*/ properties.hasTrailingComma && languageVersion >= ScriptTarget.ES5); - if (!multiLine) { - write(" "); + }); + + // Finally, return the temp variable. + propertyPatches = createBinaryExpression(propertyPatches, SyntaxKind.CommaToken, tempVar); + + var result = createParenthesizedExpression(propertyPatches); + + // TODO(drosen): Preserve comments + // var leadingComments = getLeadingCommentRanges(currentSourceFile.text, originalObjectLiteral.pos); + // var trailingComments = getTrailingCommentRanges(currentSourceFile.text, originalObjectLiteral.end); + //addCommentsToSynthesizedNode(result, leadingComments, trailingComments); + + return result; + } + + function addCommentsToSynthesizedNode(node: SynthesizedNode, leadingCommentRanges: CommentRange[], trailingCommentRanges: CommentRange[]): void { + node.leadingCommentRanges = leadingCommentRanges; + node.trailingCommentRanges = trailingCommentRanges; + } + + // Returns 'undefined' if a property has already been accounted for + // (e.g. a 'get' accessor which has already been emitted along with its 'set' accessor). + function tryCreatePatchingPropertyAssignment(objectLiteral: ObjectLiteralExpression, tempVar: Identifier, property: ObjectLiteralElement): Expression { + var leftHandSide = createMemberAccessForPropertyName(tempVar, property.name); + var maybeRightHandSide = tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property); + + return maybeRightHandSide && createBinaryExpression(leftHandSide, SyntaxKind.EqualsToken, maybeRightHandSide); + } + + function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral: ObjectLiteralExpression, property: ObjectLiteralElement) { + switch (property.kind) { + case SyntaxKind.PropertyAssignment: + return (property).initializer; + + case SyntaxKind.ShorthandPropertyAssignment: + // TODO: (andersh) Technically it isn't correct to make an identifier here since getExpressionNamePrefix returns + // a string containing a dotted name. In general I'm not a fan of mini tree rewriters as this one, elsewhere we + // manage by just emitting strings (which is a lot more performant). + //var prefix = createIdentifier(resolver.getExpressionNamePrefix((property).name)); + //return createPropertyAccessExpression(prefix, (property).name); + return createIdentifier(resolver.getExpressionNameSubstitution((property).name)); + + case SyntaxKind.MethodDeclaration: + return createFunctionExpression((property).parameters, (property).body); + + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + var { firstAccessor, getAccessor, setAccessor } = getAllAccessorDeclarations(objectLiteral.properties, property); + + // Only emit the first accessor. + if (firstAccessor !== property) { + return undefined; + } + + var propertyDescriptor = createSynthesizedNode(SyntaxKind.ObjectLiteralExpression); + + var descriptorProperties = >[]; + if (getAccessor) { + var getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); + descriptorProperties.push(getProperty); + } + if (setAccessor) { + var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpression(setAccessor.parameters, setAccessor.body)); + descriptorProperties.push(setProperty); + } + + var trueExpr = createSynthesizedNode(SyntaxKind.TrueKeyword); + + var enumerableTrue = createPropertyAssignment(createIdentifier("enumerable"), trueExpr); + descriptorProperties.push(enumerableTrue); + + var configurableTrue = createPropertyAssignment(createIdentifier("configurable"), trueExpr); + descriptorProperties.push(configurableTrue); + + propertyDescriptor.properties = descriptorProperties; + + var objectDotDefineProperty = createPropertyAccessExpression(createIdentifier("Object"), createIdentifier("defineProperty")); + return createCallExpression(objectDotDefineProperty, createNodeArray(propertyDescriptor)); + + default: + Debug.fail(`ObjectLiteralElement kind ${property.kind} not accounted for.`); + } + } + + function createParenthesizedExpression(expression: Expression) { + var result = createSynthesizedNode(SyntaxKind.ParenthesizedExpression); + result.expression = expression; + + return result; + } + + function createNodeArray(...elements: T[]): NodeArray { + var result = >elements; + result.pos = -1; + result.end = -1; + + return result; + } + + function createBinaryExpression(left: Expression, operator: SyntaxKind, right: Expression): BinaryExpression { + var result = createSynthesizedNode(SyntaxKind.BinaryExpression); + result.operatorToken = createSynthesizedNode(operator); + result.left = left; + result.right = right; + + return result; + } + + function createMemberAccessForPropertyName(expression: LeftHandSideExpression, memberName: DeclarationName): PropertyAccessExpression | ElementAccessExpression { + if (memberName.kind === SyntaxKind.Identifier) { + return createPropertyAccessExpression(expression, memberName); + } + else if (memberName.kind === SyntaxKind.StringLiteral || memberName.kind === SyntaxKind.NumericLiteral) { + return createElementAccessExpression(expression, memberName); + } + else if (memberName.kind === SyntaxKind.ComputedPropertyName) { + return createElementAccessExpression(expression, (memberName).expression); + } + else { + Debug.fail(`Kind '${memberName.kind}' not accounted for.`); + } + } + + function createPropertyAssignment(name: LiteralExpression | Identifier, initializer: Expression) { + var result = createSynthesizedNode(SyntaxKind.PropertyAssignment); + result.name = name; + result.initializer = initializer; + + return result; + } + + function createFunctionExpression(parameters: NodeArray, body: Block): FunctionExpression { + var result = createSynthesizedNode(SyntaxKind.FunctionExpression); + result.parameters = parameters; + result.body = body; + + return result; + } + + function createPropertyAccessExpression(expression: LeftHandSideExpression, name: Identifier): PropertyAccessExpression { + var result = createSynthesizedNode(SyntaxKind.PropertyAccessExpression); + result.expression = expression; + result.name = name; + + return result; + } + + function createElementAccessExpression(expression: LeftHandSideExpression, argumentExpression: Expression): ElementAccessExpression { + var result = createSynthesizedNode(SyntaxKind.ElementAccessExpression); + result.expression = expression; + result.argumentExpression = argumentExpression; + + return result; + } + + function createIdentifier(name: string) { + var result = createSynthesizedNode(SyntaxKind.Identifier); + result.text = name; + + return result; + } + + function createCallExpression(invokedExpression: MemberExpression, arguments: NodeArray) { + var result = createSynthesizedNode(SyntaxKind.CallExpression); + result.expression = invokedExpression; + result.arguments = arguments; + + return result; + } + + function emitObjectLiteral(node: ObjectLiteralExpression): void { + var properties = node.properties; + + if (languageVersion < ScriptTarget.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 === SyntaxKind.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. + write("{"); + + var properties = node.properties; + if (properties.length) { + emitLinePreservingList(node, properties, /*allowTrailingComma:*/ languageVersion >= ScriptTarget.ES5, /*spacesBetweenBraces:*/ true) + } + write("}"); } @@ -2594,8 +2891,8 @@ module ts { emit(node); return node; } - var temp = createTempVariable(node); - recordTempDeclaration(temp); + var temp = createAndRecordTempVariable(node); + write("("); emit(temp); write(" = "); @@ -2698,7 +2995,7 @@ module ts { var operand = (node.expression).expression; // Make sure we consider all nested cast expressions, e.g.: - // (-A).x; + // (-A).x; while (operand.kind == SyntaxKind.TypeAssertionExpression) { operand = (operand).expression; } @@ -2706,7 +3003,7 @@ module ts { // 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.: + // 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() @@ -2778,19 +3075,84 @@ module ts { } function emitBinaryExpression(node: BinaryExpression) { - if (languageVersion < ScriptTarget.ES6 && node.operator === SyntaxKind.EqualsToken && + if (languageVersion < ScriptTarget.ES6 && node.operatorToken.kind === SyntaxKind.EqualsToken && (node.left.kind === SyntaxKind.ObjectLiteralExpression || node.left.kind === SyntaxKind.ArrayLiteralExpression)) { emitDestructuring(node); } else { emit(node.left); - if (node.operator !== SyntaxKind.CommaToken) write(" "); - write(tokenToString(node.operator)); - write(" "); + + if (node.operatorToken.kind !== SyntaxKind.CommaToken) { + write(" "); + } + + write(tokenToString(node.operatorToken.kind)); + + // We'd like to preserve newlines found in the original binary expression. i.e. if a user has: + // + // Foo() || + // Bar(); + // + // Then we'd like to emit it as such. It seems like we'd only need to check for a newline and + // then just indent and emit. However, that will lead to a problem with deeply nested code. + // i.e. if you have: + // + // Foo() || + // Bar() || + // Baz(); + // + // Then we don't want to emit it as: + // + // Foo() || + // Bar() || + // Baz(); + // + // So we only indent if the right side of the binary expression starts further in on the line + // versus the left. + var operatorEnd = getLineAndCharacterOfPosition(currentSourceFile, node.operatorToken.end); + var rightStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.right.pos)); + + // Check if the right expression is on a different line versus the operator itself. If so, + // we'll emit newline. + var onDifferentLine = operatorEnd.line !== rightStart.line; + if (onDifferentLine) { + // Also, if the right expression starts further in on the line than the left, then we'll indent. + var exprStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); + var firstCharOfExpr = getFirstNonWhitespaceCharacterIndexOnLine(exprStart.line); + var shouldIndent = rightStart.character > firstCharOfExpr; + + if (shouldIndent) { + increaseIndent(); + } + + writeLine(); + } + else { + write(" "); + } + emit(node.right); + + if (shouldIndent) { + decreaseIndent(); + } } } + function getFirstNonWhitespaceCharacterIndexOnLine(line: number): number { + var lineStart = getLineStarts(currentSourceFile)[line]; + var text = currentSourceFile.text; + + for (var i = lineStart; i < text.length; i++) { + var ch = text.charCodeAt(i); + if (!isWhiteSpace(text.charCodeAt(i)) || isLineBreak(ch)) { + break; + } + } + + return i - lineStart; + } + function emitConditionalExpression(node: ConditionalExpression) { emit(node.condition); write(" ? "); @@ -2799,7 +3161,7 @@ module ts { emit(node.whenFalse); } - function isSingleLineBlock(node: Node) { + function isSingleLineEmptyBlock(node: Node) { if (node && node.kind === SyntaxKind.Block) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); @@ -2807,7 +3169,7 @@ module ts { } function emitBlock(node: Block) { - if (isSingleLineBlock(node)) { + if (isSingleLineEmptyBlock(node)) { emitToken(SyntaxKind.OpenBraceToken, node.pos); write(" "); emitToken(SyntaxKind.CloseBraceToken, node.statements.end); @@ -2920,7 +3282,7 @@ module ts { emitEmbeddedStatement(node.statement); } - function emitForInStatement(node: ForInStatement) { + function emitForInOrForOfStatement(node: ForInStatement | ForOfStatement) { var endPos = emitToken(SyntaxKind.ForKeyword, node.pos); write(" "); endPos = emitToken(SyntaxKind.OpenParenToken, endPos); @@ -2941,7 +3303,13 @@ module ts { else { emit(node.initializer); } - write(" in "); + + if (node.kind === SyntaxKind.ForInStatement) { + write(" in "); + } + else { + write(" of "); + } emit(node.expression); emitToken(SyntaxKind.CloseParenToken, node.expression.end); emitEmbeddedStatement(node.statement); @@ -2981,11 +3349,16 @@ module ts { emitToken(SyntaxKind.CloseBraceToken, node.clauses.end); } - function isOnSameLine(node1: Node, node2: Node) { + function nodeStartPositionsAreOnSameLine(node1: Node, node2: Node) { return getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node1.pos)) === getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); } + function nodeEndPositionsAreOnSameLine(node1: Node, node2: Node) { + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, node2.end); + } + function nodeEndIsOnSameLineAsNodeStart(node1: Node, node2: Node) { return getLineOfLocalPosition(currentSourceFile, node1.end) === getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); @@ -3000,7 +3373,7 @@ module ts { else { write("default:"); } - if (node.statements.length === 1 && isOnSameLine(node, node.statements[0])) { + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { write(" "); emit(node.statements[0]); } @@ -3141,7 +3514,7 @@ module ts { // Return the expression 'value === void 0 ? defaultValue : value' var equals = createNode(SyntaxKind.BinaryExpression); equals.left = value; - equals.operator = SyntaxKind.EqualsEqualsEqualsToken; + equals.operatorToken = createNode(SyntaxKind.EqualsEqualsEqualsToken); equals.right = createVoidZero(); var cond = createNode(SyntaxKind.ConditionalExpression); cond.condition = equals; @@ -3224,8 +3597,8 @@ module ts { } function emitDestructuringAssignment(target: Expression, value: Expression) { - if (target.kind === SyntaxKind.BinaryExpression && (target).operator === SyntaxKind.EqualsToken) { - value = createDefaultValueCheck(value, (target).right); + if (target.kind === SyntaxKind.BinaryExpression && (target).operatorToken.kind === SyntaxKind.EqualsToken) { + value = createDefaultValueCheck(value,(target).right); target = (target).left; } if (target.kind === SyntaxKind.ObjectLiteralExpression) { @@ -3526,77 +3899,14 @@ module ts { emitSignatureParameters(node); } - if (isSingleLineBlock(node.body)) { + if (isSingleLineEmptyBlock(node.body) || !node.body) { write(" { }"); } + else if (node.body.kind === SyntaxKind.Block) { + emitBlockFunctionBody(node, node.body); + } else { - write(" {"); - scopeEmitStart(node); - - if (!node.body) { - writeLine(); - write("}"); - } - else { - increaseIndent(); - - emitDetachedComments(node.body.kind === SyntaxKind.Block ? (node.body).statements : node.body); - - var startIndex = 0; - if (node.body.kind === SyntaxKind.Block) { - startIndex = emitDirectivePrologues((node.body).statements, /*startWithNewLine*/ true); - } - var outPos = writer.getTextPos(); - - emitCaptureThisForNodeIfNecessary(node); - emitDefaultValueAssignments(node); - emitRestParameter(node); - if (node.body.kind !== SyntaxKind.Block && outPos === writer.getTextPos()) { - decreaseIndent(); - write(" "); - emitStart(node.body); - write("return "); - - // Don't emit comments on this body. We'll have already taken care of it above - // when we called emitDetachedComments. - emitNode(node.body, /*disableComments:*/ true); - emitEnd(node.body); - write(";"); - emitTempDeclarations(/*newLine*/ false); - write(" "); - emitStart(node.body); - write("}"); - emitEnd(node.body); - } - else { - if (node.body.kind === SyntaxKind.Block) { - emitLinesStartingAt((node.body).statements, startIndex); - } - else { - writeLine(); - emitLeadingComments(node.body); - write("return "); - emit(node.body, /*disableComments:*/ true); - write(";"); - emitTrailingComments(node.body); - } - emitTempDeclarations(/*newLine*/ true); - writeLine(); - if (node.body.kind === SyntaxKind.Block) { - emitLeadingCommentsOfPosition((node.body).statements.end); - decreaseIndent(); - emitToken(SyntaxKind.CloseBraceToken, (node.body).statements.end); - } - else { - decreaseIndent(); - emitStart(node.body); - write("}"); - emitEnd(node.body); - } - } - } - - scopeEmitEnd(); + emitExpressionFunctionBody(node, node.body); } if (node.flags & NodeFlags.Export) { @@ -3608,11 +3918,101 @@ module ts { emitEnd(node); write(";"); } + tempCount = saveTempCount; tempVariables = saveTempVariables; tempParameters = saveTempParameters; } + // Returns true if any preamble code was emitted. + function emitFunctionBodyPreamble(node: FunctionLikeDeclaration): void { + emitCaptureThisForNodeIfNecessary(node); + emitDefaultValueAssignments(node); + emitRestParameter(node); + } + + function emitExpressionFunctionBody(node: FunctionLikeDeclaration, body: Expression) { + 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 "); + + // Don't emit comments on this body. We'll have already taken care of it above + // when we called emitDetachedComments. + emitNode(body, /*disableComments:*/ true); + emitEnd(body); + write(";"); + emitTempDeclarations(/*newLine*/ false); + write(" "); + } + else { + increaseIndent(); + writeLine(); + emitLeadingComments(node.body); + write("return "); + emit(node.body, /*disableComments:*/ true); + write(";"); + emitTrailingComments(node.body); + + emitTempDeclarations(/*newLine*/ true); + decreaseIndent(); + writeLine(); + } + + emitStart(node.body); + write("}"); + emitEnd(node.body); + + scopeEmitEnd(); + } + + function emitBlockFunctionBody(node: FunctionLikeDeclaration, body: Block) { + write(" {"); + scopeEmitStart(node); + + var outPos = writer.getTextPos(); + increaseIndent(); + emitDetachedComments(body.statements); + var startIndex = emitDirectivePrologues(body.statements, /*startWithNewLine*/ true); + emitFunctionBodyPreamble(node); + decreaseIndent(); + var preambleEmitted = writer.getTextPos() !== outPos; + + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var i = 0, n = body.statements.length; i < n; i++) { + write(" "); + emit(body.statements[i]); + } + emitTempDeclarations(/*newLine*/ false); + write(" "); + emitLeadingCommentsOfPosition(body.statements.end); + } + else { + increaseIndent(); + emitLinesStartingAt(body.statements, startIndex); + emitTempDeclarations(/*newLine*/ true); + + writeLine(); + emitLeadingCommentsOfPosition(body.statements.end); + decreaseIndent(); + } + + emitToken(SyntaxKind.CloseBraceToken, body.statements.end); + scopeEmitEnd(); + } + function findInitialSuperCall(ctor: ConstructorDeclaration): ExpressionStatement { if (ctor.body) { var statement = (ctor.body).statements[0]; @@ -3646,6 +4046,7 @@ module ts { } function emitMemberAccessForPropertyName(memberName: DeclarationName) { + // TODO: (jfreeman,drosen): comment on why this is emitNode instead of emit here. if (memberName.kind === SyntaxKind.StringLiteral || memberName.kind === SyntaxKind.NumericLiteral) { write("["); emitNode(memberName); @@ -3695,13 +4096,14 @@ module ts { emitLeadingComments(member); emitStart(member); emitStart((member).name); - emitNode(node.name); + emitNode(node.name); // TODO (shkamat,drosen): comment for why emitNode instead of emit. if (!(member.flags & NodeFlags.Static)) { write(".prototype"); } emitMemberAccessForPropertyName((member).name); emitEnd((member).name); write(" = "); + // TODO (drosen): Should we performing emitStart twice on emitStart(member)? emitStart(member); emitFunctionDeclaration(member); emitEnd(member); @@ -3710,7 +4112,7 @@ module ts { emitTrailingComments(member); } else if (member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) { - var accessors = getAllAccessorDeclarations(node, member); + var accessors = getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); emitStart(member); @@ -3721,6 +4123,7 @@ module ts { write(".prototype"); } write(", "); + // TODO: Shouldn't emitStart on name occur *here*? emitExpressionForPropertyName((member).name); emitEnd((member).name); write(", {"); @@ -4243,10 +4646,24 @@ module ts { } }); } + + function sortAMDModules(amdModules: {name: string; path: string}[]) { + // AMD modules with declared variable names go first + return amdModules.sort((moduleA, moduleB) => { + if (moduleA.name === moduleB.name) { + return 0; + } else if (!moduleA.name) { + return 1; + } else { + return -1; + } + }); + } function emitAMDModule(node: SourceFile, startIndex: number) { writeLine(); write("define("); + sortAMDModules(node.amdDependencies); if (node.amdModuleName) { write("\"" + node.amdModuleName + "\", "); } @@ -4262,7 +4679,7 @@ module ts { } }); forEach(node.amdDependencies, amdDependency => { - var text = "\"" + amdDependency + "\""; + var text = "\"" + amdDependency.path + "\""; write(", "); write(text); }); @@ -4276,6 +4693,12 @@ module ts { write(resolver.getGeneratedNameForNode(info.rootNode)); } }); + forEach(node.amdDependencies, amdDependency => { + if (amdDependency.name) { + write(", "); + write(amdDependency.name); + } + }); write(") {"); increaseIndent(); emitCaptureThisForNodeIfNecessary(node); @@ -4411,12 +4834,12 @@ module ts { return false; case SyntaxKind.ModuleDeclaration: - // Only emit the leading/trailing comments for a module if we're actually + // Only emit the leading/trailing comments for a module if we're actually // emitting the module as well. return shouldEmitModuleDeclaration(node); case SyntaxKind.EnumDeclaration: - // Only emit the leading/trailing comments for an enum if we're actually + // Only emit the leading/trailing comments for an enum if we're actually // emitting the module as well. return shouldEmitEnumDeclaration(node); } @@ -4531,8 +4954,9 @@ module ts { return emitWhileStatement(node); case SyntaxKind.ForStatement: return emitForStatement(node); + case SyntaxKind.ForOfStatement: case SyntaxKind.ForInStatement: - return emitForInStatement(node); + return emitForInOrForOfStatement(node); case SyntaxKind.ContinueStatement: case SyntaxKind.BreakStatement: return emitBreakOrContinueStatement(node); @@ -4643,7 +5067,7 @@ module ts { } emitNewLineBeforeLeadingComments(currentSourceFile, 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(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); } function emitDetachedCommentsAtPosition(node: TextRange) { @@ -4659,7 +5083,7 @@ module ts { 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 + // comment is not part of the copyright comments. Return what we have so // far. return detachedComments; } @@ -4674,8 +5098,8 @@ module ts { // 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, detachedComments[detachedComments.length - 1].end); - var astLine = getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); - if (astLine >= lastCommentLine + 2) { + var nodeLine = getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { // Valid detachedComments emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); emitComments(currentSourceFile, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); @@ -4698,7 +5122,7 @@ module ts { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.exclamation; } - // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text + // 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 else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.slash && comment.pos + 2 < comment.end && @@ -4716,7 +5140,7 @@ module ts { function writeDeclarationFile(jsFilePath: string, sourceFile: SourceFile) { var emitDeclarationResult = emitDeclarations(host, resolver, diagnostics, jsFilePath, sourceFile); - // TODO(shkamat): Should we not write any declaration file if any of them can produce error, + // TODO(shkamat): Should we not write any declaration file if any of them can produce error, // or should we just not write this file like we are doing now if (!emitDeclarationResult.reportedDeclarationError) { var declarationOutput = emitDeclarationResult.referencePathsOutput; @@ -4733,7 +5157,7 @@ module ts { writeFile(host, diagnostics, removeFileExtension(jsFilePath) + ".d.ts", declarationOutput, compilerOptions.emitBOM); } } - + function emitFile(jsFilePath: string, sourceFile?: SourceFile) { emitJavaScript(jsFilePath, sourceFile); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index a9e2a98bab8..33ab1dd1f13 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -152,6 +152,7 @@ module ts { return visitNode(cbNode, (node).operand); case SyntaxKind.BinaryExpression: return visitNode(cbNode, (node).left) || + visitNode(cbNode, (node).operatorToken) || visitNode(cbNode, (node).right); case SyntaxKind.ConditionalExpression: return visitNode(cbNode, (node).condition) || @@ -191,6 +192,10 @@ module ts { return visitNode(cbNode, (node).initializer) || visitNode(cbNode, (node).expression) || visitNode(cbNode, (node).statement); + case SyntaxKind.ForOfStatement: + return visitNode(cbNode, (node).initializer) || + visitNode(cbNode, (node).expression) || + visitNode(cbNode, (node).statement); case SyntaxKind.ContinueStatement: case SyntaxKind.BreakStatement: return visitNode(cbNode, (node).label); @@ -1329,6 +1334,12 @@ module ts { return undefined; } + function parseTokenNode(): T { + var node = createNode(token); + nextToken(); + return finishNode(node); + } + function canParseSemicolon() { // If there's a real semicolon, then we can always parse it out. if (token === SyntaxKind.SemicolonToken) { @@ -1625,8 +1636,8 @@ module ts { } // in the case where we're parsing the variable declarator of a 'for-in' statement, we - // are done if we see an 'in' keyword in front of us. - if (token === SyntaxKind.InKeyword) { + // are done if we see an 'in' keyword in front of us. Same with for-of + if (isInOrOfKeyword(token)) { return true; } @@ -1904,6 +1915,7 @@ module ts { case SyntaxKind.BreakStatement: case SyntaxKind.ContinueStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.ForStatement: case SyntaxKind.WhileStatement: case SyntaxKind.WithStatement: @@ -2106,14 +2118,6 @@ module ts { return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } - - - function parseTokenNode(): T { - var node = createNode(token); - nextToken(); - return finishNode(node); - } - function parseTemplateExpression(): TemplateExpression { var template = createNode(SyntaxKind.TemplateExpression); @@ -2620,6 +2624,7 @@ module ts { case SyntaxKind.StringKeyword: case SyntaxKind.NumberKeyword: case SyntaxKind.BooleanKeyword: + case SyntaxKind.SymbolKeyword: // If these are followed by a dot, then parse these out as a dotted type reference instead. var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); @@ -2644,6 +2649,7 @@ module ts { case SyntaxKind.StringKeyword: case SyntaxKind.NumberKeyword: case SyntaxKind.BooleanKeyword: + case SyntaxKind.SymbolKeyword: case SyntaxKind.VoidKeyword: case SyntaxKind.TypeOfKeyword: case SyntaxKind.OpenBraceToken: @@ -2821,8 +2827,9 @@ module ts { // Expression[in] , AssignmentExpression[in] var expr = parseAssignmentExpressionOrHigher(); - while (parseOptional(SyntaxKind.CommaToken)) { - expr = makeBinaryExpression(expr, SyntaxKind.CommaToken, parseAssignmentExpressionOrHigher()); + var operatorToken: Node; + while ((operatorToken = parseOptionalToken(SyntaxKind.CommaToken))) { + expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher()); } return expr; } @@ -2901,9 +2908,7 @@ module ts { // Note: we call reScanGreaterToken so that we get an appropriately merged token // for cases like > > = becoming >>= if (isLeftHandSideExpression(expr) && isAssignmentOperator(reScanGreaterToken())) { - var operator = token; - nextToken(); - return makeBinaryExpression(expr, operator, parseAssignmentExpressionOrHigher()); + return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher()); } // It wasn't an assignment or a lambda. This is a conditional expression: @@ -3186,6 +3191,10 @@ module ts { return parseBinaryExpressionRest(precedence, leftOperand); } + function isInOrOfKeyword(t: SyntaxKind) { + return t === SyntaxKind.InKeyword || t === SyntaxKind.OfKeyword; + } + function parseBinaryExpressionRest(precedence: number, leftOperand: Expression): Expression { while (true) { // We either have a binary operator here, or we're finished. We call @@ -3203,9 +3212,7 @@ module ts { break; } - var operator = token; - nextToken(); - leftOperand = makeBinaryExpression(leftOperand, operator, parseBinaryExpressionOrHigher(newPrecedence)); + leftOperand = makeBinaryExpression(leftOperand, parseTokenNode(), parseBinaryExpressionOrHigher(newPrecedence)); } return leftOperand; @@ -3261,10 +3268,10 @@ module ts { return -1; } - function makeBinaryExpression(left: Expression, operator: SyntaxKind, right: Expression): BinaryExpression { + function makeBinaryExpression(left: Expression, operatorToken: Node, right: Expression): BinaryExpression { var node = createNode(SyntaxKind.BinaryExpression, left.pos); node.left = left; - node.operator = operator; + node.operatorToken = operatorToken; node.right = right; return finishNode(node); } @@ -3815,7 +3822,7 @@ module ts { return finishNode(node); } - function parseForOrForInStatement(): Statement { + function parseForOrForInOrForOfStatement(): Statement { var pos = getNodePos(); parseExpected(SyntaxKind.ForKeyword); parseExpected(SyntaxKind.OpenParenToken); @@ -3823,21 +3830,27 @@ module ts { var initializer: VariableDeclarationList | Expression = undefined; if (token !== SyntaxKind.SemicolonToken) { if (token === SyntaxKind.VarKeyword || token === SyntaxKind.LetKeyword || token === SyntaxKind.ConstKeyword) { - initializer = parseVariableDeclarationList(/*disallowIn:*/ true); + initializer = parseVariableDeclarationList(/*inForStatementInitializer:*/ true); } else { initializer = disallowInAnd(parseExpression); } } - var forOrForInStatement: IterationStatement; + var forOrForInOrForOfStatement: IterationStatement; if (parseOptional(SyntaxKind.InKeyword)) { var forInStatement = createNode(SyntaxKind.ForInStatement, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(SyntaxKind.CloseParenToken); - forOrForInStatement = forInStatement; + forOrForInOrForOfStatement = forInStatement; } - else { + else if (parseOptional(SyntaxKind.OfKeyword)) { + var forOfStatement = createNode(SyntaxKind.ForOfStatement, pos); + forOfStatement.initializer = initializer; + forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); + parseExpected(SyntaxKind.CloseParenToken); + forOrForInOrForOfStatement = forOfStatement; + } else { var forStatement = createNode(SyntaxKind.ForStatement, pos); forStatement.initializer = initializer; parseExpected(SyntaxKind.SemicolonToken); @@ -3849,12 +3862,12 @@ module ts { forStatement.iterator = allowInAnd(parseExpression); } parseExpected(SyntaxKind.CloseParenToken); - forOrForInStatement = forStatement; + forOrForInOrForOfStatement = forStatement; } - forOrForInStatement.statement = parseStatement(); + forOrForInOrForOfStatement.statement = parseStatement(); - return finishNode(forOrForInStatement); + return finishNode(forOrForInOrForOfStatement); } function parseBreakOrContinueStatement(kind: SyntaxKind): BreakOrContinueStatement { @@ -4100,7 +4113,7 @@ module ts { case SyntaxKind.WhileKeyword: return parseWhileStatement(); case SyntaxKind.ForKeyword: - return parseForOrForInStatement(); + return parseForOrForInOrForOfStatement(); case SyntaxKind.ContinueKeyword: return parseBreakOrContinueStatement(SyntaxKind.ContinueStatement); case SyntaxKind.BreakKeyword: @@ -4242,11 +4255,13 @@ module ts { var node = createNode(SyntaxKind.VariableDeclaration); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); - node.initializer = parseInitializer(/*inParameter*/ false); + if (!isInOrOfKeyword(token)) { + node.initializer = parseInitializer(/*inParameter*/ false); + } return finishNode(node); } - function parseVariableDeclarationList(disallowIn: boolean): VariableDeclarationList { + function parseVariableDeclarationList(inForStatementInitializer: boolean): VariableDeclarationList { var node = createNode(SyntaxKind.VariableDeclarationList); switch (token) { @@ -4263,20 +4278,39 @@ module ts { } nextToken(); - var savedDisallowIn = inDisallowInContext(); - setDisallowInContext(disallowIn); - node.declarations = parseDelimitedList(ParsingContext.VariableDeclarations, parseVariableDeclaration); + // The user may have written the following: + // + // for (var of X) { } + // + // In this case, we want to parse an empty declaration list, and then parse 'of' + // as a keyword. The reason this is not automatic is that 'of' is a valid identifier. + // 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 === SyntaxKind.OfKeyword && lookAhead(canFollowContextualOfKeyword)) { + node.declarations = createMissingList(); + } + else { + var savedDisallowIn = inDisallowInContext(); + setDisallowInContext(inForStatementInitializer); - setDisallowInContext(savedDisallowIn); + node.declarations = parseDelimitedList(ParsingContext.VariableDeclarations, parseVariableDeclaration); + + setDisallowInContext(savedDisallowIn); + } return finishNode(node); } + + function canFollowContextualOfKeyword(): boolean { + return nextTokenIsIdentifier() && nextToken() === SyntaxKind.CloseParenToken; + } function parseVariableStatement(fullStart: number, modifiers: ModifiersArray): VariableStatement { var node = createNode(SyntaxKind.VariableStatement, fullStart); setModifiers(node, modifiers); - node.declarationList = parseVariableDeclarationList(/*disallowIn:*/ false); + node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer:*/ false); parseSemicolon(); return finishNode(node); } @@ -4935,7 +4969,7 @@ module ts { function processReferenceComments(sourceFile: SourceFile): void { var triviaScanner = createScanner(sourceFile.languageVersion, /*skipTrivia*/false, sourceText); var referencedFiles: FileReference[] = []; - var amdDependencies: string[] = []; + var amdDependencies: {path: string; name: string}[] = []; var amdModuleName: string; // Keep scanning all the leading trivia in the file until we get to something that @@ -4975,10 +5009,17 @@ module ts { amdModuleName = amdModuleNameMatchResult[2]; } - var amdDependencyRegEx = /^\/\/\/\s*= ScriptTarget.ES5 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); @@ -280,13 +282,13 @@ module ts { return result; } - export function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number { - return computePositionFromLineAndCharacter(getLineStarts(sourceFile), line, character); + export function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number { + return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character); } - export function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number { - Debug.assert(line > 0 && line <= lineStarts.length); - return lineStarts[line - 1] + character - 1; + export function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number { + Debug.assert(line >= 0 && line < lineStarts.length); + return lineStarts[line] + character; } export function getLineStarts(sourceFile: SourceFile): number[] { @@ -300,11 +302,11 @@ module ts { // the binary search returns the negative value of the next line start // e.g. if the line starts at [5, 10, 23, 80] and the position requested was 20 // then the search will return -2 - lineNumber = (~lineNumber) - 1; + lineNumber = ~lineNumber - 1; } return { - line: lineNumber + 1, - character: position - lineStarts[lineNumber] + 1 + line: lineNumber, + character: position - lineStarts[lineNumber] }; } diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 4bcd0856ca8..a3755650aed 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -72,7 +72,7 @@ module ts { function countLines(program: Program): number { var count = 0; forEach(program.getSourceFiles(), file => { - count += getLineAndCharacterOfPosition(file, file.end).line; + count += getLineStarts(file).length; }); return count; } @@ -88,11 +88,11 @@ module ts { if (diagnostic.file) { var loc = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start); - output += diagnostic.file.fileName + "(" + loc.line + "," + loc.character + "): "; + output += `${ diagnostic.file.fileName }(${ loc.line + 1 },${ loc.character + 1 }): `; } var category = DiagnosticCategory[diagnostic.category].toLowerCase(); - output += category + " TS" + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) + sys.newLine; + output += `${ category } TS${ diagnostic.code }: ${ flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) }${ sys.newLine }`; sys.write(output); } @@ -332,7 +332,7 @@ module ts { var program = createProgram(fileNames, compilerOptions, compilerHost); var exitStatus = compileProgram(); - var end = start - new Date().getTime(); + var end = new Date().getTime() - start; if (compilerOptions.listFiles) { forEach(program.getSourceFiles(), file => { @@ -357,7 +357,7 @@ module ts { reportTimeStatistic("Bind time", ts.bindTime); reportTimeStatistic("Check time", ts.checkTime); reportTimeStatistic("Emit time", ts.emitTime); - reportTimeStatistic("Total time", start - end); + reportTimeStatistic("Total time", end); } return { program, exitStatus }; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 810bca9fd56..5e5993fe4a2 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -142,8 +142,9 @@ module ts { NumberKeyword, SetKeyword, StringKeyword, + SymbolKeyword, TypeKeyword, - + OfKeyword, // LastKeyword and LastToken // Parse tree nodes // Names @@ -212,6 +213,7 @@ module ts { WhileStatement, ForStatement, ForInStatement, + ForOfStatement, ContinueStatement, BreakStatement, ReturnStatement, @@ -269,7 +271,7 @@ module ts { FirstReservedWord = BreakKeyword, LastReservedWord = WithKeyword, FirstKeyword = BreakKeyword, - LastKeyword = TypeKeyword, + LastKeyword = OfKeyword, FirstFutureReservedWord = ImplementsKeyword, LastFutureReservedWord = YieldKeyword, FirstTypeNode = TypeReference, @@ -277,7 +279,7 @@ module ts { FirstPunctuation = OpenBraceToken, LastPunctuation = CaretEqualsToken, FirstToken = Unknown, - LastToken = TypeKeyword, + LastToken = OfKeyword, FirstTriviaToken = SingleLineCommentTrivia, LastTriviaToken = ConflictMarkerTrivia, FirstLiteralToken = NumericLiteral, @@ -631,7 +633,7 @@ module ts { export interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } @@ -762,6 +764,11 @@ module ts { expression: Expression; } + export interface ForOfStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } + export interface BreakOrContinueStatement extends Statement { label?: Identifier; } @@ -945,7 +952,7 @@ module ts { fileName: string; text: string; - amdDependencies: string[]; + amdDependencies: {path: string; name: string}[]; amdModuleName: string; referencedFiles: FileReference[]; @@ -1359,9 +1366,10 @@ module ts { ObjectLiteral = 0x00020000, // Originates in an object literal ContainsUndefinedOrNull = 0x00040000, // Type is or contains Undefined or Null type ContainsObjectLiteral = 0x00080000, // Type is or contains object literal type + ESSymbol = 0x00100000, // Type of symbol primitive introduced in ES6 - Intrinsic = Any | String | Number | Boolean | Void | Undefined | Null, - Primitive = String | Number | Boolean | Void | Undefined | Null | StringLiteral | Enum, + Intrinsic = Any | String | Number | Boolean | ESSymbol | Void | Undefined | Null, + Primitive = String | Number | Boolean | ESSymbol | Void | Undefined | Null | StringLiteral | Enum, StringLike = String | StringLiteral, NumberLike = Number | Enum, ObjectType = Class | Interface | Reference | Tuple | Anonymous, @@ -1699,6 +1707,7 @@ module ts { equals = 0x3D, // = exclamation = 0x21, // ! greaterThan = 0x3E, // > + hash = 0x23, // # lessThan = 0x3C, // < minus = 0x2D, // - openBrace = 0x7B, // { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 7c6b4d0be96..c5bb46aa962 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -105,11 +105,16 @@ module ts { return node; } + export function getStartPositionOfLine(line: number, sourceFile: SourceFile): number { + Debug.assert(line >= 0); + return getLineStarts(sourceFile)[line]; + } + // This is a useful function for debugging purposes. export function nodePosToString(node: Node): string { var file = getSourceFileOfNode(node); var loc = getLineAndCharacterOfPosition(file, node.pos); - return file.fileName + "(" + loc.line + "," + loc.character + ")"; + return `${ file.fileName }(${ loc.line + 1 },${ loc.character + 1 })`; } export function getStartPosOfNode(node: Node): number { @@ -349,6 +354,7 @@ module ts { case SyntaxKind.WhileStatement: case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.WithStatement: case SyntaxKind.SwitchStatement: case SyntaxKind.CaseClause: @@ -566,7 +572,8 @@ module ts { forStatement.condition === node || forStatement.iterator === node; case SyntaxKind.ForInStatement: - var forInStatement = parent; + case SyntaxKind.ForOfStatement: + var forInStatement = parent; return (forInStatement.initializer === node && forInStatement.initializer.kind !== SyntaxKind.VariableDeclarationList) || forInStatement.expression === node; case SyntaxKind.TypeAssertionExpression: @@ -713,6 +720,7 @@ module ts { case SyntaxKind.ExpressionStatement: case SyntaxKind.EmptyStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.ForStatement: case SyntaxKind.IfStatement: case SyntaxKind.LabeledStatement: @@ -836,6 +844,54 @@ module ts { return SyntaxKind.FirstTriviaToken <= token && token <= SyntaxKind.LastTriviaToken; } + /** + * A declaration has a dynamic name if both of the following are true: + * 1. The declaration has a computed property name + * 2. The computed name is *not* expressed as Symbol., where name + * is a property of the Symbol constructor that denotes a built in + * Symbol. + */ + export function hasDynamicName(declaration: Declaration): boolean { + return declaration.name && + declaration.name.kind === SyntaxKind.ComputedPropertyName && + !isWellKnownSymbolSyntactically((declaration.name).expression); + } + + /** + * Checks if the expression is of the form: + * Symbol.name + * where Symbol is literally the word "Symbol", and name is any identifierName + */ + export function isWellKnownSymbolSyntactically(node: Expression): boolean { + return node.kind === SyntaxKind.PropertyAccessExpression && isESSymbolIdentifier((node).expression); + } + + export function getPropertyNameForPropertyNameNode(name: DeclarationName): string { + if (name.kind === SyntaxKind.Identifier || name.kind === SyntaxKind.StringLiteral || name.kind === SyntaxKind.NumericLiteral) { + return (name).text; + } + if (name.kind === SyntaxKind.ComputedPropertyName) { + var nameExpression = (name).expression; + if (isWellKnownSymbolSyntactically(nameExpression)) { + var rightHandSideName = (nameExpression).name.text; + return getPropertyNameForKnownSymbolName(rightHandSideName); + } + } + + return undefined; + } + + export function getPropertyNameForKnownSymbolName(symbolName: string): string { + return "__@" + symbolName; + } + + /** + * Includes the word "Symbol" with unicode escapes + */ + export function isESSymbolIdentifier(node: Node): boolean { + return node.kind === SyntaxKind.Identifier && (node).text === "Symbol"; + } + export function isModifier(token: SyntaxKind): boolean { switch (token) { case SyntaxKind.PublicKeyword: diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 603a78b5f75..59fc2c23f5c 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -282,6 +282,8 @@ module FourSlash { return new Harness.LanguageService.NativeLanugageServiceAdapter(cancellationToken, compilationOptions); case FourSlashTestType.Shims: return new Harness.LanguageService.ShimLanugageServiceAdapter(cancellationToken, compilationOptions); + case FourSlashTestType.Server: + return new Harness.LanguageService.ServerLanugageServiceAdapter(cancellationToken, compilationOptions); default: throw new Error("Unknown FourSlash test type: "); } @@ -396,7 +398,7 @@ module FourSlash { var lineStarts = ts.computeLineStarts(this.getFileContent(this.activeFile.fileName)); var lineCharPos = ts.computeLineAndCharacterOfPosition(lineStarts, pos); - this.scenarioActions.push(''); + this.scenarioActions.push(``); } public moveCaretRight(count = 1) { @@ -418,6 +420,9 @@ module FourSlash { this.activeFile = fileToOpen; var fileName = fileToOpen.fileName.replace(Harness.IO.directoryName(fileToOpen.fileName), '').substr(1); this.scenarioActions.push(''); + + // Let the host know that this file is now open + this.languageServiceAdapterHost.openFile(fileToOpen.fileName); } public verifyErrorExistsBetweenMarkers(startMarkerName: string, endMarkerName: string, negative: boolean) { @@ -1927,7 +1932,7 @@ module FourSlash { } var missingItem = { name: name, kind: kind }; - this.raiseError('verifyGetScriptLexicalStructureListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(items) + ')'); + this.raiseError('verifyGetScriptLexicalStructureListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(items, null, " ") + ')'); } private navigationBarItemsContains(items: ts.NavigationBarItem[], name: string, kind: string) { @@ -2010,39 +2015,31 @@ module FourSlash { // Get the text of the entire line the caret is currently at private getCurrentLineContent() { - // The current caret position (in line/col terms) - var line = this.getCurrentCaretFilePosition().line; - // The line/col of the start of this line - var pos = this.languageServiceAdapterHost.lineColToPosition(this.activeFile.fileName, line, 1); - // The index of the current file + var text = this.getFileContent(this.activeFile.fileName) - // The text from the start of the line to the end of the file - var text = this.getFileContent(this.activeFile.fileName).substring(pos); + var pos = this.currentCaretPosition; + var startPos = pos, endPos = pos; - // Truncate to the first newline - var newlinePos = text.indexOf('\n'); - if (newlinePos === -1) { - return text; - } - else { - if (text.charAt(newlinePos - 1) === '\r') { - newlinePos--; + while (startPos > 0) { + var ch = text.charCodeAt(startPos - 1); + if (ch === ts.CharacterCodes.carriageReturn || ch === ts.CharacterCodes.lineFeed) { + break; } - return text.substr(0, newlinePos); - } - } - private getCurrentCaretFilePosition() { - var result = this.languageServiceAdapterHost.positionToZeroBasedLineCol(this.activeFile.fileName, this.currentCaretPosition); - if (result.line >= 0) { - result.line++; + startPos--; } - if (result.character >= 0) { - result.character++; + while (endPos < text.length) { + var ch = text.charCodeAt(endPos); + + if (ch === ts.CharacterCodes.carriageReturn || ch === ts.CharacterCodes.lineFeed) { + break; + } + + endPos++; } - return result; + return text.substring(startPos, endPos); } private assertItemInCompletionList(items: ts.CompletionEntry[], name: string, text?: string, documentation?: string, kind?: string) { @@ -2120,7 +2117,7 @@ module FourSlash { } private getLineColStringAtPosition(position: number) { - var pos = this.languageServiceAdapterHost.positionToZeroBasedLineCol(this.activeFile.fileName, position); + var pos = this.languageServiceAdapterHost.positionToLineAndCharacter(this.activeFile.fileName, position); return 'line ' + (pos.line + 1) + ', col ' + pos.character; } diff --git a/src/harness/fourslashRunner.ts b/src/harness/fourslashRunner.ts index fe3b6c7a91f..1ab6e31cdbb 100644 --- a/src/harness/fourslashRunner.ts +++ b/src/harness/fourslashRunner.ts @@ -4,7 +4,8 @@ const enum FourSlashTestType { Native, - Shims + Shims, + Server } class FourSlashRunner extends RunnerBase { @@ -22,6 +23,10 @@ class FourSlashRunner extends RunnerBase { this.basePath = 'tests/cases/fourslash/shims'; this.testSuiteName = 'fourslash-shims'; break; + case FourSlashTestType.Server: + this.basePath = 'tests/cases/fourslash/server'; + this.testSuiteName = 'fourslash-server'; + break; } } diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 534bf85d119..26c06c7950c 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -16,14 +16,15 @@ /// /// +/// +/// +/// /// /// /// /// -declare var require: any; -declare var process: any; -var Buffer = require('buffer').Buffer; +var Buffer: BufferConstructor = require('buffer').Buffer; // this will work in the browser via browserify var _chai: typeof chai = require('chai'); @@ -795,9 +796,12 @@ module Harness { } } - export function createSourceFileAndAssertInvariants(fileName: string, sourceText: string, languageVersion: ts.ScriptTarget) { - var result = ts.createSourceFile(fileName, sourceText, languageVersion, /*setParentNodes:*/ true); - Utils.assertInvariants(result, /*parent:*/ undefined); + export function createSourceFileAndAssertInvariants(fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, assertInvariants = true) { + // Only set the parent nodes if we're asserting invariants. We don't need them otherwise. + var result = ts.createSourceFile(fileName, sourceText, languageVersion, /*setParentNodes:*/ assertInvariants); + if (assertInvariants) { + Utils.assertInvariants(result, /*parent:*/ undefined); + } return result; } @@ -805,7 +809,6 @@ module Harness { export var defaultLibSourceFile = createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + 'lib.core.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest); export var defaultES6LibSourceFile = createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + 'lib.core.es6.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest); - // Cache these between executions so we don't have to re-parse them for every test export var fourslashFileName = 'fourslash.ts'; export var fourslashSourceFile: ts.SourceFile; @@ -926,7 +929,8 @@ module Harness { settingsCallback?: (settings: ts.CompilerOptions) => void, options?: ts.CompilerOptions, // Current directory is needed for rwcRunner to be able to use currentDirectory defined in json file - currentDirectory?: string) { + currentDirectory?: string, + assertInvariants = true) { options = options || { noResolve: false }; options.target = options.target || ts.ScriptTarget.ES3; @@ -1074,7 +1078,7 @@ module Harness { var register = (file: { unitName: string; content: string; }) => { if (file.content !== undefined) { var fileName = ts.normalizeSlashes(file.unitName); - filemap[getCanonicalFileName(fileName)] = createSourceFileAndAssertInvariants(fileName, file.content, options.target); + filemap[getCanonicalFileName(fileName)] = createSourceFileAndAssertInvariants(fileName, file.content, options.target, assertInvariants); } }; inputFiles.forEach(register); @@ -1181,13 +1185,13 @@ module Harness { } export function getMinimalDiagnostic(err: ts.Diagnostic): HarnessDiagnostic { - var errorLineInfo = err.file ? err.file.getLineAndCharacterFromPosition(err.start) : { line: 0, character: 0 }; + var errorLineInfo = err.file ? err.file.getLineAndCharacterOfPosition(err.start) : { line: -1, character: -1 }; return { fileName: err.file && err.file.fileName, start: err.start, end: err.start + err.length, - line: errorLineInfo.line, - character: errorLineInfo.character, + line: errorLineInfo.line + 1, + character: errorLineInfo.character + 1, message: ts.flattenDiagnosticMessageText(err.messageText, ts.sys.newLine), category: ts.DiagnosticCategory[err.category].toLowerCase(), code: err.code diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 2f95f5072d0..a9c28fb70bd 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -1,5 +1,6 @@ /// /// +/// /// module Harness.LanguageService { @@ -23,18 +24,18 @@ module Harness.LanguageService { this.version++; } - public editContent(minChar: number, limChar: number, newText: string): void { + public editContent(start: number, end: number, newText: string): void { // Apply edits - var prefix = this.content.substring(0, minChar); + var prefix = this.content.substring(0, start); var middle = newText; - var suffix = this.content.substring(limChar); + var suffix = this.content.substring(end); this.setContent(prefix + middle + suffix); // Store edit range + new length of script this.editRanges.push({ length: this.content.length, textChangeRange: ts.createTextChangeRange( - ts.createTextSpanFromBounds(minChar, limChar), newText.length) + ts.createTextSpanFromBounds(start, end), newText.length) }); // Update version # @@ -145,52 +146,28 @@ module Harness.LanguageService { this.fileNameToScript[fileName] = new ScriptInfo(fileName, content); } - public updateScript(fileName: string, content: string) { + public editScript(fileName: string, start: number, end: number, newText: string) { var script = this.getScriptInfo(fileName); if (script !== null) { - script.updateContent(content); - return; - } - - this.addScript(fileName, content); - } - - public editScript(fileName: string, minChar: number, limChar: number, newText: string) { - var script = this.getScriptInfo(fileName); - if (script !== null) { - script.editContent(minChar, limChar, newText); + script.editContent(start, end, newText); return; } throw new Error("No script with name '" + fileName + "'"); } - /** - * @param line 1 based index - * @param col 1 based index - */ - public lineColToPosition(fileName: string, line: number, col: number): number { - var script: ScriptInfo = this.fileNameToScript[fileName]; - assert.isNotNull(script); - assert.isTrue(line >= 1); - assert.isTrue(col >= 1); - - return ts.computePositionFromLineAndCharacter(script.lineMap, line, col); + public openFile(fileName: string): void { } /** * @param line 0 based index * @param col 0 based index */ - public positionToZeroBasedLineCol(fileName: string, position: number): ts.LineAndCharacter { + public positionToLineAndCharacter(fileName: string, position: number): ts.LineAndCharacter { var script: ScriptInfo = this.fileNameToScript[fileName]; assert.isNotNull(script); - var result = ts.computeLineAndCharacterOfPosition(script.lineMap, position); - - assert.isTrue(result.line >= 1); - assert.isTrue(result.character >= 1); - return { line: result.line - 1, character: result.character - 1 }; + return ts.computeLineAndCharacterOfPosition(script.lineMap, position); } } @@ -236,10 +213,8 @@ module Harness.LanguageService { getFilenames(): string[] { return this.nativeHost.getFilenames(); } getScriptInfo(fileName: string): ScriptInfo { return this.nativeHost.getScriptInfo(fileName); } addScript(fileName: string, content: string): void { this.nativeHost.addScript(fileName, content); } - updateScript(fileName: string, content: string): void { return this.nativeHost.updateScript(fileName, content); } - editScript(fileName: string, minChar: number, limChar: number, newText: string): void { this.nativeHost.editScript(fileName, minChar, limChar, newText); } - lineColToPosition(fileName: string, line: number, col: number): number { return this.nativeHost.lineColToPosition(fileName, line, col); } - positionToZeroBasedLineCol(fileName: string, position: number): ts.LineAndCharacter { return this.nativeHost.positionToZeroBasedLineCol(fileName, position); } + editScript(fileName: string, start: number, end: number, newText: string): void { this.nativeHost.editScript(fileName, start, end, newText); } + positionToLineAndCharacter(fileName: string, position: number): ts.LineAndCharacter { return this.nativeHost.positionToLineAndCharacter(fileName, position); } getCompilationSettings(): string { return JSON.stringify(this.nativeHost.getCompilationSettings()); } getCancellationToken(): ts.CancellationToken { return this.nativeHost.getCancellationToken(); } @@ -442,5 +417,156 @@ module Harness.LanguageService { return convertResult; } } + + // Server adapter + class SessionClientHost extends NativeLanguageServiceHost implements ts.server.SessionClientHost { + private client: ts.server.SessionClient; + + constructor(cancellationToken: ts.CancellationToken, settings: ts.CompilerOptions) { + super(cancellationToken, settings); + } + + onMessage(message: string): void { + + } + + writeMessage(message: string): void { + + } + + setClient(client: ts.server.SessionClient) { + this.client = client; + } + + openFile(fileName: string): void { + super.openFile(fileName); + this.client.openFile(fileName); + } + + editScript(fileName: string, start: number, end: number, newText: string) { + super.editScript(fileName, start, end, newText); + this.client.changeFile(fileName, start, end, newText); + } + } + + class SessionServerHost implements ts.server.ServerHost, ts.server.Logger { + args: string[] = []; + newLine: string; + useCaseSensitiveFileNames: boolean = false; + + constructor(private host: NativeLanguageServiceHost) { + this.newLine = this.host.getNewLine(); + } + + onMessage(message: string): void { + + } + + writeMessage(message: string): void { + } + + write(message: string): void { + this.writeMessage(message); + } + + readFile(fileName: string): string { + if (fileName.indexOf(Harness.Compiler.defaultLibFileName) >= 0) { + fileName = Harness.Compiler.defaultLibFileName; + } + + var snapshot = this.host.getScriptSnapshot(fileName); + return snapshot && snapshot.getText(0, snapshot.getLength()); + } + + writeFile(name: string, text: string, writeByteOrderMark: boolean): void { + } + + resolvePath(path: string): string { + return path; + } + + fileExists(path: string): boolean { + return !!this.host.getScriptSnapshot(path); + } + + directoryExists(path: string): boolean { + return false; + } + + getExecutingFilePath(): string { + return ""; + } + + exit(exitCode: number): void { + } + + createDirectory(directoryName: string): void { + throw new Error("Not Implemented Yet."); + } + + getCurrentDirectory(): string { + return this.host.getCurrentDirectory(); + } + + readDirectory(path: string, extension?: string): string[] { + throw new Error("Not implemented Yet."); + } + + watchFile(fileName: string, callback: (fileName: string) => void): ts.FileWatcher { + return { close() { } }; + } + + close(): void { + } + + info(message: string): void { + return this.host.log(message); + } + + msg(message: string) { + return this.host.log(message); + } + + endGroup(): void { + } + + perftrc(message: string): void { + return this.host.log(message); + } + + startGroup(): void { + } + } + + export class ServerLanugageServiceAdapter implements LanguageServiceAdapter { + private host: SessionClientHost; + private client: ts.server.SessionClient; + constructor(cancellationToken?: ts.CancellationToken, options?: ts.CompilerOptions) { + // This is the main host that tests use to direct tests + var clientHost = new SessionClientHost(cancellationToken, options); + var client = new ts.server.SessionClient(clientHost); + + // This host is just a proxy for the clientHost, it uses the client + // host to answer server queries about files on disk + var serverHost = new SessionServerHost(clientHost); + var server = new ts.server.Session(serverHost, serverHost); + + // Fake the connection between the client and the server + serverHost.writeMessage = client.onMessage.bind(client); + clientHost.writeMessage = server.onMessage.bind(server); + + // Wire the client to the host to get notifications when a file is open + // or edited. + clientHost.setClient(client); + + // Set the properties + this.client = client; + this.host = clientHost; + } + getHost() { return this.host; } + getLanguageService(): ts.LanguageService { return this.client; } + getClassifier(): ts.Classifier { throw new Error("getClassifier is not available using the server interface."); } + getPreProcessedFileInfo(fileName: string, fileContents: string): ts.PreProcessedFileInfo { throw new Error("getPreProcessedFileInfo is not available using the server interface."); } + } } \ No newline at end of file diff --git a/src/harness/runner.ts b/src/harness/runner.ts index 942ae56bf6f..e1e5429b007 100644 --- a/src/harness/runner.ts +++ b/src/harness/runner.ts @@ -66,6 +66,9 @@ if (testConfigFile !== '') { case 'fourslash-shims': runners.push(new FourSlashRunner(FourSlashTestType.Shims)); break; + case 'fourslash-server': + runners.push(new FourSlashRunner(FourSlashTestType.Server)); + break; case 'fourslash-generated': runners.push(new GeneratedFourslashRunner(FourSlashTestType.Native)); break; @@ -95,6 +98,7 @@ if (runners.length === 0) { // language services runners.push(new FourSlashRunner(FourSlashTestType.Native)); runners.push(new FourSlashRunner(FourSlashTestType.Shims)); + runners.push(new FourSlashRunner(FourSlashTestType.Server)); //runners.push(new GeneratedFourslashRunner()); } diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index b66322f8390..c1c3251cf02 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -90,7 +90,8 @@ module RWC { /*settingsCallback*/ undefined, opts.options, // Since all Rwc json file specified current directory in its json file, we need to pass this information to compilerHost // so that when the host is asked for current directory, it should give the value from json rather than from process - currentDirectory); + currentDirectory, + /*assertInvariants:*/ false); }); function getHarnessCompilerInputUnit(fileName: string) { diff --git a/src/harness/typeWriter.ts b/src/harness/typeWriter.ts index 1d8b3efef68..54cdc27e3b3 100644 --- a/src/harness/typeWriter.ts +++ b/src/harness/typeWriter.ts @@ -85,15 +85,17 @@ class TypeWriterWalker { private log(node: ts.Node, type: ts.Type): void { var actualPos = ts.skipTrivia(this.currentSourceFile.text, node.pos); - var lineAndCharacter = this.currentSourceFile.getLineAndCharacterFromPosition(actualPos); + var lineAndCharacter = this.currentSourceFile.getLineAndCharacterOfPosition(actualPos); var sourceText = ts.getTextOfNodeFromSourceText(this.currentSourceFile.text, node); // If we got an unknown type, we temporarily want to fall back to just pretending the name // (source text) of the node is the type. This is to align with the old typeWriter to make // baseline comparisons easier. In the long term, we will want to just call typeToString this.results.push({ - line: lineAndCharacter.line - 1, - column: lineAndCharacter.character, + line: lineAndCharacter.line, + // todo(cyrusn): Not sure why column is one-based for type-writer. But I'm preserving + // that behavior to prevent having a lot of baselines to fix up. + column: lineAndCharacter.character + 1, syntaxKind: node.kind, sourceText: sourceText, type: this.checker.typeToString(type, node.parent, ts.TypeFormatFlags.NoTruncation | ts.TypeFormatFlags.WriteOwnNameForAnyLike) diff --git a/src/lib/es6.d.ts b/src/lib/es6.d.ts index b666b11b969..50238e94bb4 100644 --- a/src/lib/es6.d.ts +++ b/src/lib/es6.d.ts @@ -1,4 +1,4 @@ -declare type PropertyKey = string | number | Symbol; +declare type PropertyKey = string | number | symbol; interface Symbol { /** Returns a string representation of an object. */ @@ -7,7 +7,7 @@ interface Symbol { /** Returns the primitive value of the specified object. */ valueOf(): Object; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface SymbolConstructor { @@ -20,21 +20,21 @@ interface SymbolConstructor { * Returns a new unique Symbol value. * @param description Description of the new Symbol object. */ - (description?: string|number): Symbol; + (description?: string|number): symbol; /** * Returns a Symbol object from the global symbol registry matching the given key if found. * Otherwise, returns a new symbol with this key. * @param key key to search for. */ - for(key: string): Symbol; + for(key: string): symbol; /** * Returns a key from the global symbol registry matching the given Symbol if found. * Otherwise, returns a undefined. * @param sym Symbol to find the key for. */ - keyFor(sym: Symbol): string; + keyFor(sym: symbol): string; // Well-known Symbols @@ -42,42 +42,42 @@ interface SymbolConstructor { * A method that determines if a constructor object recognizes an object as one of the * constructor’s instances. Called by the semantics of the instanceof operator. */ - hasInstance: Symbol; + hasInstance: symbol; /** * A Boolean value that if true indicates that an object should flatten to its array elements * by Array.prototype.concat. */ - isConcatSpreadable: Symbol; + isConcatSpreadable: symbol; /** * A Boolean value that if true indicates that an object may be used as a regular expression. */ - isRegExp: Symbol; + isRegExp: symbol; /** * A method that returns the default iterator for an object.Called by the semantics of the * for-of statement. */ - iterator: Symbol; + iterator: symbol; /** * A method that converts an object to a corresponding primitive value.Called by the ToPrimitive * abstract operation. */ - toPrimitive: Symbol; + toPrimitive: symbol; /** * A String value that is used in the creation of the default string description of an object. * Called by the built- in method Object.prototype.toString. */ - toStringTag: Symbol; + toStringTag: symbol; /** * An Object whose own property names are property names that are excluded from the with * environment bindings of the associated objects. */ - unscopables: Symbol; + unscopables: symbol; } declare var Symbol: SymbolConstructor; @@ -108,7 +108,7 @@ interface ObjectConstructor { * Returns an array of all symbol properties found directly on object o. * @param o Object to retrieve the symbols from. */ - getOwnPropertySymbols(o: any): Symbol[]; + getOwnPropertySymbols(o: any): symbol[]; /** * Returns true if the values are the same value, false otherwise. @@ -230,7 +230,7 @@ interface ArrayLike { interface Array { /** Iterator */ - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; /** * Returns an array of key, value pairs for every entry in the array @@ -329,7 +329,7 @@ interface ArrayConstructor { interface String { /** Iterator */ - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; /** * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point @@ -447,12 +447,12 @@ interface IteratorResult { } interface Iterator { - //[Symbol.iterator](): Iterator; + [Symbol.iterator](): Iterator; next(): IteratorResult; } interface Iterable { - //[Symbol.iterator](): Iterator; + [Symbol.iterator](): Iterator; } interface GeneratorFunction extends Function { @@ -474,7 +474,7 @@ interface Generator extends Iterator { next(value?: any): IteratorResult; throw (exception: any): IteratorResult; return (value: T): IteratorResult; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface Math { @@ -588,11 +588,11 @@ interface Math { */ cbrt(x: number): number; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface RegExp { - // [Symbol.isRegExp]: boolean; + [Symbol.isRegExp]: boolean; /** * Matches a string with a regular expression, and returns an array containing the results of @@ -649,8 +649,8 @@ interface Map { set(key: K, value?: V): Map; size: number; values(): Iterator; - // [Symbol.iterator]():Iterator<[K,V]>; - // [Symbol.toStringTag]: string; + [Symbol.iterator]():Iterator<[K,V]>; + [Symbol.toStringTag]: string; } interface MapConstructor { @@ -666,7 +666,7 @@ interface WeakMap { get(key: K): V; has(key: K): boolean; set(key: K, value?: V): WeakMap; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface WeakMapConstructor { @@ -686,8 +686,8 @@ interface Set { keys(): Iterator; size: number; values(): Iterator; - // [Symbol.iterator]():Iterator; - // [Symbol.toStringTag]: string; + [Symbol.iterator]():Iterator; + [Symbol.toStringTag]: string; } interface SetConstructor { @@ -702,7 +702,7 @@ interface WeakSet { clear(): void; delete(value: T): boolean; has(value: T): boolean; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface WeakSetConstructor { @@ -713,7 +713,7 @@ interface WeakSetConstructor { declare var WeakSet: WeakSetConstructor; interface JSON { - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } /** @@ -733,7 +733,7 @@ interface ArrayBuffer { */ slice(begin: number, end?: number): ArrayBuffer; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface ArrayBufferConstructor { @@ -870,7 +870,7 @@ interface DataView { */ setUint32(byteOffset: number, value: number, littleEndian: boolean): void; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface DataViewConstructor { @@ -1137,7 +1137,7 @@ interface Int8Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int8ArrayConstructor { @@ -1427,7 +1427,7 @@ interface Uint8Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint8ArrayConstructor { @@ -1717,7 +1717,7 @@ interface Uint8ClampedArray { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint8ClampedArrayConstructor { @@ -2007,7 +2007,7 @@ interface Int16Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int16ArrayConstructor { @@ -2297,7 +2297,7 @@ interface Uint16Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint16ArrayConstructor { @@ -2587,7 +2587,7 @@ interface Int32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int32ArrayConstructor { @@ -2877,7 +2877,7 @@ interface Uint32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint32ArrayConstructor { @@ -3167,7 +3167,7 @@ interface Float32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Float32ArrayConstructor { @@ -3457,7 +3457,7 @@ interface Float64Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Float64ArrayConstructor { @@ -3521,7 +3521,7 @@ declare var Reflect: { getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; getPrototypeOf(target: any): any; has(target: any, propertyKey: string): boolean; - has(target: any, propertyKey: Symbol): boolean; + has(target: any, propertyKey: symbol): boolean; isExtensible(target: any): boolean; ownKeys(target: any): Array; preventExtensions(target: any): boolean; diff --git a/src/server/client.ts b/src/server/client.ts new file mode 100644 index 00000000000..60486e80371 --- /dev/null +++ b/src/server/client.ts @@ -0,0 +1,494 @@ +/// + +module ts.server { + + export interface SessionClientHost extends LanguageServiceHost { + writeMessage(message: string): void; + } + + interface CompletionEntry extends CompletionInfo { + fileName: string; + position: number; + } + + interface RenameEntry extends RenameInfo { + fileName: string; + position: number; + locations: RenameLocation[]; + findInStrings: boolean; + findInComments: boolean; + } + + export class SessionClient implements LanguageService { + private sequence: number = 0; + private fileMapping: ts.Map = {}; + private lineMaps: ts.Map = {}; + private messages: string[] = []; + private lastRenameEntry: RenameEntry; + + constructor(private host: SessionClientHost) { + } + + public onMessage(message: string): void { + this.messages.push(message); + } + + private writeMessage(message: string): void { + this.host.writeMessage(message); + } + + private getLineMap(fileName: string): number[] { + var lineMap = ts.lookUp(this.lineMaps, fileName); + if (!lineMap) { + var scriptSnapshot = this.host.getScriptSnapshot(fileName); + lineMap = this.lineMaps[fileName] = ts.computeLineStarts(scriptSnapshot.getText(0, scriptSnapshot.getLength())); + } + return lineMap; + } + + private lineColToPosition(fileName: string, lineCol: protocol.Location): number { + return ts.computePositionOfLineAndCharacter(this.getLineMap(fileName), lineCol.line - 1, lineCol.col - 1); + } + + private positionToOneBasedLineCol(fileName: string, position: number): protocol.Location { + var lineCol = ts.computeLineAndCharacterOfPosition(this.getLineMap(fileName), position); + return { + line: lineCol.line + 1, + col: lineCol.character + 1 + }; + } + + private convertCodeEditsToTextChange(fileName: string, codeEdit: protocol.CodeEdit): ts.TextChange { + var start = this.lineColToPosition(fileName, codeEdit.start); + var end = this.lineColToPosition(fileName, codeEdit.end); + + return { + span: ts.createTextSpanFromBounds(start, end), + newText: codeEdit.newText + }; + } + + private processRequest(command: string, arguments?: any): T { + var request: protocol.Request = { + seq: this.sequence++, + type: "request", + command: command, + arguments: arguments + }; + + this.writeMessage(JSON.stringify(request)); + + return request; + } + + private processResponse(request: protocol.Request): T { + var lastMessage = this.messages.shift(); + Debug.assert(!!lastMessage, "Did not recieve any responses."); + + // Read the content length + var contentLengthPrefix = "Content-Length: "; + var lines = lastMessage.split("\r\n"); + Debug.assert(lines.length >= 2, "Malformed response: Expected 3 lines in the response."); + + var contentLengthText = lines[0]; + Debug.assert(contentLengthText.indexOf(contentLengthPrefix) === 0, "Malformed response: Response text did not contain content-length header."); + var contentLength = parseInt(contentLengthText.substring(contentLengthPrefix.length)); + + // Read the body + var responseBody = lines[2]; + + // Verify content length + Debug.assert(responseBody.length + 1 === contentLength, "Malformed response: Content length did not match the response's body length."); + + try { + var response: T = JSON.parse(responseBody); + } + catch (e) { + throw new Error("Malformed response: Failed to parse server response: " + lastMessage + ". \r\n Error detailes: " + e.message); + } + + // verify the sequence numbers + Debug.assert(response.request_seq === request.seq, "Malformed response: response sequance number did not match request sequence number."); + + // unmarshal errors + if (!response.success) { + throw new Error("Error " + response.message); + } + + Debug.assert(!!response.body, "Malformed response: Unexpected empty response body."); + + return response; + } + + openFile(fileName: string): void { + var args: protocol.FileRequestArgs = { file: fileName }; + this.processRequest(CommandNames.Open, args); + } + + closeFile(fileName: string): void { + var args: protocol.FileRequestArgs = { file: fileName }; + this.processRequest(CommandNames.Close, args); + } + + changeFile(fileName: string, start: number, end: number, newText: string): void { + // clear the line map after an edit + this.lineMaps[fileName] = undefined; + + var lineCol = this.positionToOneBasedLineCol(fileName, start); + var endLineCol = this.positionToOneBasedLineCol(fileName, end); + + var args: protocol.ChangeRequestArgs = { + file: fileName, + line: lineCol.line, + col: lineCol.col, + endLine: endLineCol.line, + endCol: endLineCol.col, + insertString: newText + }; + + this.processRequest(CommandNames.Change, args); + } + + getQuickInfoAtPosition(fileName: string, position: number): QuickInfo { + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var args: protocol.FileLocationRequestArgs = { + file: fileName, + line: lineCol.line, + col: lineCol.col + }; + + var request = this.processRequest(CommandNames.Quickinfo, args); + var response = this.processResponse(request); + + var start = this.lineColToPosition(fileName, response.body.start); + var end = this.lineColToPosition(fileName, response.body.end); + + return { + kind: response.body.kind, + kindModifiers: response.body.kindModifiers, + textSpan: ts.createTextSpanFromBounds(start, end), + displayParts: [{ kind: "text", text: response.body.displayString }], + documentation: [{ kind: "text", text: response.body.documentation }] + }; + } + + getCompletionsAtPosition(fileName: string, position: number): CompletionInfo { + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var args: protocol.CompletionsRequestArgs = { + file: fileName, + line: lineCol.line, + col: lineCol.col, + prefix: undefined + }; + + var request = this.processRequest(CommandNames.Completions, args); + var response = this.processResponse(request); + + return { + isMemberCompletion: false, + isNewIdentifierLocation: false, + entries: response.body, + fileName: fileName, + position: position + }; + } + + getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails { + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var args: protocol.CompletionDetailsRequestArgs = { + file: fileName, + line: lineCol.line, + col: lineCol.col, + entryNames: [entryName] + }; + + var request = this.processRequest(CommandNames.CompletionDetails, args); + var response = this.processResponse(request); + Debug.assert(response.body.length == 1, "Unexpected length of completion details response body."); + return response.body[0]; + } + + getNavigateToItems(searchTerm: string): NavigateToItem[] { + var args: protocol.NavtoRequestArgs = { + searchTerm, + file: this.host.getScriptFileNames()[0] + }; + + var request = this.processRequest(CommandNames.Navto, args); + var response = this.processResponse(request); + + return response.body.map(entry => { + var fileName = entry.file; + var start = this.lineColToPosition(fileName, entry.start); + var end = this.lineColToPosition(fileName, entry.end); + + return { + name: entry.name, + containerName: entry.containerName || "", + containerKind: entry.containerKind || "", + kind: entry.kind, + kindModifiers: entry.kindModifiers, + matchKind: entry.matchKind, + fileName: fileName, + textSpan: ts.createTextSpanFromBounds(start, end) + }; + }); + } + + getFormattingEditsForRange(fileName: string, start: number, end: number, options: ts.FormatCodeOptions): ts.TextChange[] { + var startLineCol = this.positionToOneBasedLineCol(fileName, start); + var endLineCol = this.positionToOneBasedLineCol(fileName, end); + var args: protocol.FormatRequestArgs = { + file: fileName, + line: startLineCol.line, + col: startLineCol.col, + endLine: endLineCol.line, + endCol: endLineCol.col, + }; + + // TODO: handle FormatCodeOptions + var request = this.processRequest(CommandNames.Format, args); + var response = this.processResponse(request); + + return response.body.map(entry=> this.convertCodeEditsToTextChange(fileName, entry)); + } + + getFormattingEditsForDocument(fileName: string, options: ts.FormatCodeOptions): ts.TextChange[] { + return this.getFormattingEditsForRange(fileName, 0, this.host.getScriptSnapshot(fileName).getLength(), options); + } + + getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): ts.TextChange[] { + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var args: protocol.FormatOnKeyRequestArgs = { + file: fileName, + line: lineCol.line, + col: lineCol.col, + key: key + }; + + // TODO: handle FormatCodeOptions + var request = this.processRequest(CommandNames.Formatonkey, args); + var response = this.processResponse(request); + + return response.body.map(entry=> this.convertCodeEditsToTextChange(fileName, entry)); + } + + getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] { + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var args: protocol.FileLocationRequestArgs = { + file: fileName, + line: lineCol.line, + col: lineCol.col, + }; + + var request = this.processRequest(CommandNames.Definition, args); + var response = this.processResponse(request); + + return response.body.map(entry => { + var fileName = entry.file; + var start = this.lineColToPosition(fileName, entry.start); + var end = this.lineColToPosition(fileName, entry.end); + return { + containerKind: "", + containerName: "", + fileName: fileName, + textSpan: ts.createTextSpanFromBounds(start, end), + kind: "", + name: "" + }; + }); + } + + getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[] { + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var args: protocol.FileLocationRequestArgs = { + file: fileName, + line: lineCol.line, + col: lineCol.col, + }; + + var request = this.processRequest(CommandNames.References, args); + var response = this.processResponse(request); + + return response.body.refs.map(entry => { + var fileName = entry.file; + var start = this.lineColToPosition(fileName, entry.start); + var end = this.lineColToPosition(fileName, entry.end); + return { + fileName: fileName, + textSpan: ts.createTextSpanFromBounds(start, end), + isWriteAccess: entry.isWriteAccess, + }; + }); + } + + getEmitOutput(fileName: string): EmitOutput { + throw new Error("Not Implemented Yet."); + } + + getSyntacticDiagnostics(fileName: string): Diagnostic[] { + throw new Error("Not Implemented Yet."); + } + + getSemanticDiagnostics(fileName: string): Diagnostic[] { + throw new Error("Not Implemented Yet."); + } + + getCompilerOptionsDiagnostics(): Diagnostic[] { + throw new Error("Not Implemented Yet."); + } + + getRenameInfo(fileName: string, position: number, findInStrings?: boolean, findInComments?: boolean): RenameInfo { + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var args: protocol.RenameRequestArgs = { + file: fileName, + line: lineCol.line, + col: lineCol.col, + findInStrings, + findInComments + }; + + var request = this.processRequest(CommandNames.Rename, args); + var response = this.processResponse(request); + var locations: RenameLocation[] = []; + response.body.locs.map((entry: protocol.SpanGroup) => { + var fileName = entry.file; + entry.locs.map((loc: protocol.TextSpan) => { + var start = this.lineColToPosition(fileName, loc.start); + var end = this.lineColToPosition(fileName, loc.end); + locations.push({ + textSpan: ts.createTextSpanFromBounds(start, end), + fileName: fileName + }); + }); + }); + return this.lastRenameEntry = { + canRename: response.body.info.canRename, + displayName: response.body.info.displayName, + fullDisplayName: response.body.info.fullDisplayName, + kind: response.body.info.kind, + kindModifiers: response.body.info.kindModifiers, + localizedErrorMessage: response.body.info.localizedErrorMessage, + triggerSpan: ts.createTextSpanFromBounds(position, position), + fileName: fileName, + position: position, + findInStrings: findInStrings, + findInComments: findInComments, + locations: locations + }; + } + + findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[] { + if (!this.lastRenameEntry || + this.lastRenameEntry.fileName !== fileName || + this.lastRenameEntry.position !== position || + this.lastRenameEntry.findInStrings != findInStrings || + this.lastRenameEntry.findInComments != findInComments) { + this.getRenameInfo(fileName, position, findInStrings, findInComments); + } + + return this.lastRenameEntry.locations; + } + + decodeNavigationBarItems(items: protocol.NavigationBarItem[], fileName: string): NavigationBarItem[] { + if (!items) { + return []; + } + + return items.map(item => ({ + text: item.text, + kind: item.kind, + kindModifiers: item.kindModifiers || "", + spans: item.spans.map(span=> createTextSpanFromBounds(this.lineColToPosition(fileName, span.start), this.lineColToPosition(fileName, span.end))), + childItems: this.decodeNavigationBarItems(item.childItems, fileName), + indent: 0, + bolded: false, + grayed: false + })); + } + + getNavigationBarItems(fileName: string): NavigationBarItem[] { + var args: protocol.FileRequestArgs = { + file: fileName + }; + + var request = this.processRequest(CommandNames.NavBar, args); + var response = this.processResponse(request); + + return this.decodeNavigationBarItems(response.body, fileName); + } + + getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan { + throw new Error("Not Implemented Yet."); + } + + getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan { + throw new Error("Not Implemented Yet."); + } + + getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems { + throw new Error("Not Implemented Yet."); + } + + getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[] { + throw new Error("Not Implemented Yet."); + } + + getOutliningSpans(fileName: string): OutliningSpan[] { + throw new Error("Not Implemented Yet."); + } + + getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[] { + throw new Error("Not Implemented Yet."); + } + + getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[] { + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var args: protocol.FileLocationRequestArgs = { + file: fileName, + line: lineCol.line, + col: lineCol.col, + }; + + var request = this.processRequest(CommandNames.Brace, args); + var response = this.processResponse(request); + + return response.body.map(entry => { + var start = this.lineColToPosition(fileName, entry.start); + var end = this.lineColToPosition(fileName, entry.end); + return { + start: start, + length: end - start, + }; + }); + } + + getIndentationAtPosition(fileName: string, position: number, options: EditorOptions): number { + throw new Error("Not Implemented Yet."); + } + + getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] { + throw new Error("Not Implemented Yet."); + } + + getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] { + throw new Error("Not Implemented Yet."); + } + + getProgram(): Program { + throw new Error("SourceFile objects are not serializable through the server protocol."); + } + + getSourceFile(fileName: string): SourceFile { + throw new Error("SourceFile objects are not serializable through the server protocol."); + } + + cleanupSemanticCache(): void { + throw new Error("cleanupSemanticCache is not available through the server layer."); + } + + dispose(): void { + throw new Error("dispose is not available through the server layer."); + } + } +} diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts new file mode 100644 index 00000000000..5b5ee27d707 --- /dev/null +++ b/src/server/editorServices.ts @@ -0,0 +1,1646 @@ +/// +/// +/// + +module ts.server { + export interface Logger { + close(): void; + perftrc(s: string): void; + info(s: string): void; + startGroup(): void; + endGroup(): void; + msg(s: string, type?: string): void; + } + + var lineCollectionCapacity = 4; + + class ScriptInfo { + svc: ScriptVersionCache; + children: ScriptInfo[] = []; // files referenced by this file + + defaultProject: Project; // project to use by default for file + + fileWatcher: FileWatcher; + + constructor(private host: ServerHost, public fileName: string, public content: string, public isOpen = false) { + this.svc = ScriptVersionCache.fromString(content); + } + + close() { + this.isOpen = false; + } + + addChild(childInfo: ScriptInfo) { + this.children.push(childInfo); + } + + snap() { + return this.svc.getSnapshot(); + } + + getText() { + var snap = this.snap(); + return snap.getText(0, snap.getLength()); + } + + getLineInfo(line: number) { + var snap = this.snap(); + return snap.index.lineNumberToInfo(line); + } + + editContent(start: number, end: number, newText: string): void { + this.svc.edit(start, end - start, newText); + } + + getTextChangeRangeBetweenVersions(startVersion: number, endVersion: number): ts.TextChangeRange { + return this.svc.getTextChangesBetweenVersions(startVersion, endVersion); + } + + getChangeRange(oldSnapshot: ts.IScriptSnapshot): ts.TextChangeRange { + return this.snap().getChangeRange(oldSnapshot); + } + } + + class LSHost implements ts.LanguageServiceHost { + ls: ts.LanguageService = null; + compilationSettings: ts.CompilerOptions; + filenameToScript: ts.Map = {}; + + constructor(public host: ServerHost, public project: Project) { + } + + getDefaultLibFileName() { + var nodeModuleBinDir = ts.getDirectoryPath(ts.normalizePath(this.host.getExecutingFilePath())); + return ts.combinePaths(nodeModuleBinDir, ts.getDefaultLibFileName(this.compilationSettings)); + } + + getScriptSnapshot(filename: string): ts.IScriptSnapshot { + var scriptInfo = this.getScriptInfo(filename); + if (scriptInfo) { + return scriptInfo.snap(); + } + } + + setCompilationSettings(opt: ts.CompilerOptions) { + this.compilationSettings = opt; + } + + lineAffectsRefs(filename: string, line: number) { + var info = this.getScriptInfo(filename); + var lineInfo = info.getLineInfo(line); + if (lineInfo && lineInfo.text) { + var regex = /reference|import|\/\*|\*\//; + return regex.test(lineInfo.text); + } + } + + getCompilationSettings() { + // change this to return active project settings for file + return this.compilationSettings; + } + + getScriptFileNames() { + var filenames: string[] = []; + for (var filename in this.filenameToScript) { + if (this.filenameToScript[filename] && this.filenameToScript[filename].isOpen) { + filenames.push(filename); + } + } + return filenames; + } + + getScriptVersion(filename: string) { + return this.getScriptInfo(filename).svc.latestVersion().toString(); + } + + getCurrentDirectory(): string { + return ""; + } + + getScriptIsOpen(filename: string) { + return this.getScriptInfo(filename).isOpen; + } + + removeReferencedFile(info: ScriptInfo) { + if (!info.isOpen) { + this.filenameToScript[info.fileName] = undefined; + } + } + + getScriptInfo(filename: string): ScriptInfo { + var scriptInfo = ts.lookUp(this.filenameToScript, filename); + if (!scriptInfo) { + scriptInfo = this.project.openReferencedFile(filename); + if (scriptInfo) { + this.filenameToScript[scriptInfo.fileName] = scriptInfo; + } + } + else { + } + return scriptInfo; + } + + addRoot(info: ScriptInfo) { + var scriptInfo = ts.lookUp(this.filenameToScript, info.fileName); + if (!scriptInfo) { + this.filenameToScript[info.fileName] = info; + return info; + } + } + + saveTo(filename: string, tmpfilename: string) { + var script = this.getScriptInfo(filename); + if (script) { + var snap = script.snap(); + this.host.writeFile(tmpfilename, snap.getText(0, snap.getLength())); + } + } + + reloadScript(filename: string, tmpfilename: string, cb: () => any) { + var script = this.getScriptInfo(filename); + if (script) { + script.svc.reloadFromFile(tmpfilename, cb); + } + } + + editScript(filename: string, start: number, end: number, newText: string) { + var script = this.getScriptInfo(filename); + if (script) { + script.editContent(start, end, newText); + return; + } + + throw new Error("No script with name '" + filename + "'"); + } + + resolvePath(path: string): string { + var start = new Date().getTime(); + var result = this.host.resolvePath(path); + return result; + } + + fileExists(path: string): boolean { + var start = new Date().getTime(); + var result = this.host.fileExists(path); + return result; + } + + directoryExists(path: string): boolean { + return this.host.directoryExists(path); + } + + /** + * @param line 1 based index + */ + lineToTextSpan(filename: string, line: number): ts.TextSpan { + var script: ScriptInfo = this.filenameToScript[filename]; + var index = script.snap().index; + + var lineInfo = index.lineNumberToInfo(line + 1); + var len: number; + if (lineInfo.leaf) { + len = lineInfo.leaf.text.length; + } + else { + var nextLineInfo = index.lineNumberToInfo(line + 2); + len = nextLineInfo.col - lineInfo.col; + } + return ts.createTextSpan(lineInfo.col, len); + } + + /** + * @param line 1 based index + * @param col 1 based index + */ + lineColToPosition(filename: string, line: number, col: number): number { + var script: ScriptInfo = this.filenameToScript[filename]; + var index = script.snap().index; + + var lineInfo = index.lineNumberToInfo(line); + // TODO: assert this column is actually on the line + return (lineInfo.col + col - 1); + } + + /** + * @param line 1-based index + * @param col 1-based index + */ + positionToLineCol(filename: string, position: number): ILineInfo { + var script: ScriptInfo = this.filenameToScript[filename]; + var index = script.snap().index; + var lineCol = index.charOffsetToLineNumberAndPos(position); + return { line: lineCol.line, col: lineCol.col + 1 }; + } + } + + // assumes normalized paths + function getAbsolutePath(filename: string, directory: string) { + var rootLength = ts.getRootLength(filename); + if (rootLength > 0) { + return filename; + } + else { + var splitFilename = filename.split('/'); + var splitDir = directory.split('/'); + var i = 0; + var dirTail = 0; + var sflen = splitFilename.length; + while ((i < sflen) && (splitFilename[i].charAt(0) == '.')) { + var dots = splitFilename[i]; + if (dots == '..') { + dirTail++; + } + else if (dots != '.') { + return undefined; + } + i++; + } + return splitDir.slice(0, splitDir.length - dirTail).concat(splitFilename.slice(i)).join('/'); + } + } + + interface ProjectOptions { + // these fields can be present in the project file + files?: string[]; + formatCodeOptions?: ts.FormatCodeOptions; + compilerOptions?: ts.CompilerOptions; + } + + export class Project { + compilerService: CompilerService; + projectOptions: ProjectOptions; + projectFilename: string; + program: ts.Program; + filenameToSourceFile: ts.Map = {}; + updateGraphSeq = 0; + + constructor(public projectService: ProjectService) { + this.compilerService = new CompilerService(this); + } + + openReferencedFile(filename: string) { + return this.projectService.openFile(filename, false); + } + + getSourceFile(info: ScriptInfo) { + return this.filenameToSourceFile[info.fileName]; + } + + getSourceFileFromName(filename: string) { + var info = this.projectService.getScriptInfo(filename); + if (info) { + return this.getSourceFile(info); + } + } + + removeReferencedFile(info: ScriptInfo) { + this.compilerService.host.removeReferencedFile(info); + this.updateGraph(); + } + + updateFileMap() { + this.filenameToSourceFile = {}; + var sourceFiles = this.program.getSourceFiles(); + for (var i = 0, len = sourceFiles.length; i < len; i++) { + var normFilename = ts.normalizePath(sourceFiles[i].fileName); + this.filenameToSourceFile[normFilename] = sourceFiles[i]; + } + } + + finishGraph() { + this.updateGraph(); + this.compilerService.languageService.getNavigateToItems(".*"); + } + + updateGraph() { + this.program = this.compilerService.languageService.getProgram(); + this.updateFileMap(); + } + + isConfiguredProject() { + return this.projectFilename; + } + + // add a root file to project + addRoot(info: ScriptInfo) { + info.defaultProject = this; + return this.compilerService.host.addRoot(info); + } + + filesToString() { + var strBuilder = ""; + ts.forEachValue(this.filenameToSourceFile, + sourceFile => { strBuilder += sourceFile.fileName + "\n"; }); + return strBuilder; + } + + setProjectOptions(projectOptions: ProjectOptions) { + this.projectOptions = projectOptions; + if (projectOptions.compilerOptions) { + this.compilerService.setCompilerOptions(projectOptions.compilerOptions); + } + // TODO: format code options + } + } + + interface ProjectOpenResult { + success?: boolean; + errorMsg?: string; + project?: Project; + } + + function copyListRemovingItem(item: T, list: T[]) { + var copiedList: T[] = []; + for (var i = 0, len = list.length; i < len; i++) { + if (list[i] != item) { + copiedList.push(list[i]); + } + } + return copiedList; + } + + interface ProjectServiceEventHandler { + (eventName: string, project: Project): void; + } + + export class ProjectService { + filenameToScriptInfo: ts.Map = {}; + // open, non-configured files in two lists + openFileRoots: ScriptInfo[] = []; + openFilesReferenced: ScriptInfo[] = []; + // projects covering open files + inferredProjects: Project[] = []; + + constructor(public host: ServerHost, public psLogger: Logger, public eventHandler?: ProjectServiceEventHandler) { + // ts.disableIncrementalParsing = true; + } + + watchedFileChanged(fileName: string) { + var info = this.filenameToScriptInfo[fileName]; + if (!info) { + this.psLogger.info("Error: got watch notification for unknown file: " + fileName); + } + + if (!this.host.fileExists(fileName)) { + // File was deleted + this.fileDeletedInFilesystem(info); + } + else { + if (info && (!info.isOpen)) { + info.svc.reloadFromFile(info.fileName); + } + } + } + + + log(msg: string, type = "Err") { + this.psLogger.msg(msg, type); + } + + closeLog() { + this.psLogger.close(); + } + + createInferredProject(root: ScriptInfo) { + var iproj = new Project(this); + iproj.addRoot(root); + iproj.finishGraph(); + this.inferredProjects.push(iproj); + return iproj; + } + + fileDeletedInFilesystem(info: ScriptInfo) { + this.psLogger.info(info.fileName + " deleted"); + + if (info.fileWatcher) { + info.fileWatcher.close(); + info.fileWatcher = undefined; + } + + if (!info.isOpen) { + this.filenameToScriptInfo[info.fileName] = undefined; + var referencingProjects = this.findReferencingProjects(info); + for (var i = 0, len = referencingProjects.length; i < len; i++) { + referencingProjects[i].removeReferencedFile(info); + } + } + this.printProjects(); + } + + addOpenFile(info: ScriptInfo) { + this.findReferencingProjects(info); + if (info.defaultProject) { + this.openFilesReferenced.push(info); + } + else { + // create new inferred project p with the newly opened file as root + info.defaultProject = this.createInferredProject(info); + var openFileRoots: ScriptInfo[] = []; + // for each inferred project root r + for (var i = 0, len = this.openFileRoots.length; i < len; i++) { + var r = this.openFileRoots[i]; + // if r referenced by the new project + if (info.defaultProject.getSourceFile(r)) { + // remove project rooted at r + this.inferredProjects = + copyListRemovingItem(r.defaultProject, this.inferredProjects); + // put r in referenced open file list + this.openFilesReferenced.push(r); + // set default project of r to the new project + r.defaultProject = info.defaultProject; + } + else { + // otherwise, keep r as root of inferred project + openFileRoots.push(r); + } + } + this.openFileRoots = openFileRoots; + this.openFileRoots.push(info); + } + } + + closeOpenFile(info: ScriptInfo) { + var openFileRoots: ScriptInfo[] = []; + var removedProject: Project; + for (var i = 0, len = this.openFileRoots.length; i < len; i++) { + // if closed file is root of project + if (info == this.openFileRoots[i]) { + // remove that project and remember it + removedProject = info.defaultProject; + } + else { + openFileRoots.push(this.openFileRoots[i]); + } + } + this.openFileRoots = openFileRoots; + if (removedProject) { + // remove project from inferred projects list + this.inferredProjects = copyListRemovingItem(removedProject, this.inferredProjects); + var openFilesReferenced: ScriptInfo[] = []; + var orphanFiles: ScriptInfo[] = []; + // for all open, referenced files f + for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) { + var f = this.openFilesReferenced[i]; + // if f was referenced by the removed project, remember it + if (f.defaultProject == removedProject) { + f.defaultProject = undefined; + orphanFiles.push(f); + } + else { + // otherwise add it back to the list of referenced files + openFilesReferenced.push(f); + } + } + this.openFilesReferenced = openFilesReferenced; + // treat orphaned files as newly opened + for (var i = 0, len = orphanFiles.length; i < len; i++) { + this.addOpenFile(orphanFiles[i]); + } + } + else { + this.openFilesReferenced = copyListRemovingItem(info, this.openFilesReferenced); + } + info.close(); + } + + findReferencingProjects(info: ScriptInfo) { + var referencingProjects: Project[] = []; + info.defaultProject = undefined; + for (var i = 0, len = this.inferredProjects.length; i < len; i++) { + this.inferredProjects[i].updateGraph(); + if (this.inferredProjects[i].getSourceFile(info)) { + info.defaultProject = this.inferredProjects[i]; + referencingProjects.push(this.inferredProjects[i]); + } + } + return referencingProjects; + } + + getScriptInfo(filename: string) { + filename = ts.normalizePath(filename); + return ts.lookUp(this.filenameToScriptInfo, filename); + } + + /** + * @param filename is absolute pathname + */ + openFile(fileName: string, openedByClient = false) { + fileName = ts.normalizePath(fileName); + var info = ts.lookUp(this.filenameToScriptInfo, fileName); + if (!info) { + var content: string; + if (this.host.fileExists(fileName)) { + content = this.host.readFile(fileName); + } + if (!content) { + if (openedByClient) { + content = ""; + } + } + if (content !== undefined) { + info = new ScriptInfo(this.host, fileName, content, openedByClient); + this.filenameToScriptInfo[fileName] = info; + if (!info.isOpen) { + info.fileWatcher = this.host.watchFile(fileName, _ => { this.watchedFileChanged(fileName); }); + } + } + } + if (info) { + if (openedByClient) { + info.isOpen = true; + } + } + return info; + } + + /** + * Open file whose contents is managed by the client + * @param filename is absolute pathname + */ + + openClientFile(filename: string) { + // TODO: tsconfig check + var info = this.openFile(filename, true); + this.addOpenFile(info); + this.printProjects(); + return info; + } + + /** + * Close file whose contents is managed by the client + * @param filename is absolute pathname + */ + + closeClientFile(filename: string) { + // TODO: tsconfig check + var info = ts.lookUp(this.filenameToScriptInfo, filename); + if (info) { + this.closeOpenFile(info); + info.isOpen = false; + } + this.printProjects(); + } + + getProjectsReferencingFile(filename: string) { + var scriptInfo = ts.lookUp(this.filenameToScriptInfo, filename); + if (scriptInfo) { + var projects: Project[] = []; + for (var i = 0, len = this.inferredProjects.length; i < len; i++) { + if (this.inferredProjects[i].getSourceFile(scriptInfo)) { + projects.push(this.inferredProjects[i]); + } + } + return projects; + } + } + + getProjectForFile(filename: string) { + var scriptInfo = ts.lookUp(this.filenameToScriptInfo, filename); + if (scriptInfo) { + return scriptInfo.defaultProject; + } + } + + printProjectsForFile(filename: string) { + var scriptInfo = ts.lookUp(this.filenameToScriptInfo, filename); + if (scriptInfo) { + this.psLogger.startGroup(); + this.psLogger.info("Projects for " + filename) + var projects = this.getProjectsReferencingFile(filename); + for (var i = 0, len = projects.length; i < len; i++) { + this.psLogger.info("Inferred Project " + i.toString()); + } + this.psLogger.endGroup(); + } + else { + this.psLogger.info(filename + " not in any project"); + } + } + + printProjects() { + this.psLogger.startGroup(); + for (var i = 0, len = this.inferredProjects.length; i < len; i++) { + var project = this.inferredProjects[i]; + this.psLogger.info("Project " + i.toString()); + this.psLogger.info(project.filesToString()); + this.psLogger.info("-----------------------------------------------"); + } + this.psLogger.info("Open file roots: ") + for (var i = 0, len = this.openFileRoots.length; i < len; i++) { + this.psLogger.info(this.openFileRoots[i].fileName); + } + this.psLogger.info("Open files referenced: ") + for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) { + this.psLogger.info(this.openFilesReferenced[i].fileName); + } + this.psLogger.endGroup(); + } + + openConfigFile(configFilename: string): ProjectOpenResult { + configFilename = ts.normalizePath(configFilename); + // file references will be relative to dirPath (or absolute) + var dirPath = ts.getDirectoryPath(configFilename); + var rawConfig = ts.readConfigFile(configFilename); + if (!rawConfig) { + return { errorMsg: "tsconfig syntax error" }; + } + else { + // REVIEW: specify no base path so can get absolute path below + var parsedCommandLine = ts.parseConfigFile(rawConfig); + + if (parsedCommandLine.errors) { + // TODO: gather diagnostics and transmit + return { errorMsg: "tsconfig option errors" }; + } + else if (parsedCommandLine.fileNames) { + var proj = this.createProject(configFilename); + for (var i = 0, len = parsedCommandLine.fileNames.length; i < len; i++) { + var rootFilename = parsedCommandLine.fileNames[i]; + var normRootFilename = ts.normalizePath(rootFilename); + normRootFilename = getAbsolutePath(normRootFilename, dirPath); + if (this.host.fileExists(normRootFilename)) { + var info = this.openFile(normRootFilename); + proj.addRoot(info); + } + else { + return { errorMsg: "specified file " + rootFilename + " not found" }; + } + } + var projectOptions: ProjectOptions = { + files: parsedCommandLine.fileNames, + compilerOptions: parsedCommandLine.options + }; + if (rawConfig.formatCodeOptions) { + projectOptions.formatCodeOptions = rawConfig.formatCodeOptions; + } + proj.setProjectOptions(projectOptions); + return { success: true, project: proj }; + } + else { + return { errorMsg: "no files found" }; + } + } + } + + createProject(projectFilename: string) { + var eproj = new Project(this); + eproj.projectFilename = projectFilename; + return eproj; + } + + } + + class CompilerService { + host: LSHost; + languageService: ts.LanguageService; + classifier: ts.Classifier; + settings = ts.getDefaultCompilerOptions(); + documentRegistry = ts.createDocumentRegistry(); + formatCodeOptions: ts.FormatCodeOptions = CompilerService.defaultFormatCodeOptions; + + constructor(public project: Project) { + this.host = new LSHost(project.projectService.host, project); + // override default ES6 (remove when compiler default back at ES5) + this.settings.target = ts.ScriptTarget.ES5; + this.host.setCompilationSettings(this.settings); + this.languageService = ts.createLanguageService(this.host, this.documentRegistry); + this.classifier = ts.createClassifier(); + } + + setCompilerOptions(opt: ts.CompilerOptions) { + this.settings = opt; + this.host.setCompilationSettings(opt); + } + + isExternalModule(filename: string): boolean { + var sourceFile = this.languageService.getSourceFile(filename); + return ts.isExternalModule(sourceFile); + } + + static defaultFormatCodeOptions: ts.FormatCodeOptions = { + IndentSize: 4, + TabSize: 4, + NewLineCharacter: ts.sys.newLine, + ConvertTabsToSpaces: true, + InsertSpaceAfterCommaDelimiter: true, + InsertSpaceAfterSemicolonInForStatements: true, + InsertSpaceBeforeAndAfterBinaryOperators: true, + InsertSpaceAfterKeywordsInControlFlowStatements: true, + InsertSpaceAfterFunctionKeywordForAnonymousFunctions: false, + InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, + PlaceOpenBraceOnNewLineForFunctions: false, + PlaceOpenBraceOnNewLineForControlBlocks: false, + } + + } + + interface LineCollection { + charCount(): number; + lineCount(): number; + isLeaf(): boolean; + walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker): void; + } + + export interface ILineInfo { + line: number; + col: number; + text?: string; + leaf?: LineLeaf; + } + + enum CharRangeSection { + PreStart, + Start, + Entire, + Mid, + End, + PostEnd + } + + interface ILineIndexWalker { + goSubtree: boolean; + done: boolean; + leaf(relativeStart: number, relativeLength: number, lineCollection: LineLeaf): void; + pre? (relativeStart: number, relativeLength: number, lineCollection: LineCollection, + parent: LineNode, nodeType: CharRangeSection): LineCollection; + post? (relativeStart: number, relativeLength: number, lineCollection: LineCollection, + parent: LineNode, nodeType: CharRangeSection): LineCollection; + } + + class BaseLineIndexWalker implements ILineIndexWalker { + goSubtree = true; + done = false; + leaf(rangeStart: number, rangeLength: number, ll: LineLeaf) { + } + } + + class EditWalker extends BaseLineIndexWalker { + lineIndex = new LineIndex(); + // path to start of range + startPath: LineCollection[]; + endBranch: LineCollection[] = []; + branchNode: LineNode; + // path to current node + stack: LineNode[]; + state = CharRangeSection.Entire; + lineCollectionAtBranch: LineCollection; + initialText = ""; + trailingText = ""; + suppressTrailingText = false; + + constructor() { + super(); + this.lineIndex.root = new LineNode(); + this.startPath = [this.lineIndex.root]; + this.stack = [this.lineIndex.root]; + } + + insertLines(insertedText: string) { + if (this.suppressTrailingText) { + this.trailingText = ""; + } + if (insertedText) { + insertedText = this.initialText + insertedText + this.trailingText; + } + else { + insertedText = this.initialText + this.trailingText; + } + var lm = LineIndex.linesFromText(insertedText); + var lines = lm.lines; + if (lines.length > 1) { + if (lines[lines.length - 1] == "") { + lines.length--; + } + } + var branchParent: LineNode; + var lastZeroCount: LineCollection; + + for (var k = this.endBranch.length - 1; k >= 0; k--) { + (this.endBranch[k]).updateCounts(); + if (this.endBranch[k].charCount() == 0) { + lastZeroCount = this.endBranch[k]; + if (k > 0) { + branchParent = this.endBranch[k - 1]; + } + else { + branchParent = this.branchNode; + } + } + } + if (lastZeroCount) { + branchParent.remove(lastZeroCount); + } + + // path at least length two (root and leaf) + var insertionNode = this.startPath[this.startPath.length - 2]; + var leafNode = this.startPath[this.startPath.length - 1]; + var len = lines.length; + + if (len > 0) { + leafNode.text = lines[0]; + + if (len > 1) { + var insertedNodes = new Array(len - 1); + var startNode = leafNode; + for (var i = 1, len = lines.length; i < len; i++) { + insertedNodes[i - 1] = new LineLeaf(lines[i]); + } + var pathIndex = this.startPath.length - 2; + while (pathIndex >= 0) { + insertionNode = this.startPath[pathIndex]; + insertedNodes = insertionNode.insertAt(startNode, insertedNodes); + pathIndex--; + startNode = insertionNode; + } + var insertedNodesLen = insertedNodes.length; + while (insertedNodesLen > 0) { + var newRoot = new LineNode(); + newRoot.add(this.lineIndex.root); + insertedNodes = newRoot.insertAt(this.lineIndex.root, insertedNodes); + insertedNodesLen = insertedNodes.length; + this.lineIndex.root = newRoot; + } + this.lineIndex.root.updateCounts(); + } + else { + for (var j = this.startPath.length - 2; j >= 0; j--) { + (this.startPath[j]).updateCounts(); + } + } + } + else { + // no content for leaf node, so delete it + insertionNode.remove(leafNode); + for (var j = this.startPath.length - 2; j >= 0; j--) { + (this.startPath[j]).updateCounts(); + } + } + + return this.lineIndex; + } + + post(relativeStart: number, relativeLength: number, lineCollection: LineCollection, parent: LineCollection, nodeType: CharRangeSection): LineCollection { + // have visited the path for start of range, now looking for end + // if range is on single line, we will never make this state transition + if (lineCollection == this.lineCollectionAtBranch) { + this.state = CharRangeSection.End; + } + // always pop stack because post only called when child has been visited + this.stack.length--; + return undefined; + } + + pre(relativeStart: number, relativeLength: number, lineCollection: LineCollection, parent: LineCollection, nodeType: CharRangeSection) { + // currentNode corresponds to parent, but in the new tree + var currentNode = this.stack[this.stack.length - 1]; + + if ((this.state == CharRangeSection.Entire) && (nodeType == CharRangeSection.Start)) { + // if range is on single line, we will never make this state transition + this.state = CharRangeSection.Start; + this.branchNode = currentNode; + this.lineCollectionAtBranch = lineCollection; + } + + var child: LineCollection; + function fresh(node: LineCollection): LineCollection { + if (node.isLeaf()) { + return new LineLeaf(""); + } + else return new LineNode(); + } + switch (nodeType) { + case CharRangeSection.PreStart: + this.goSubtree = false; + if (this.state != CharRangeSection.End) { + currentNode.add(lineCollection); + } + break; + case CharRangeSection.Start: + if (this.state == CharRangeSection.End) { + this.goSubtree = false; + } + else { + child = fresh(lineCollection); + currentNode.add(child); + this.startPath[this.startPath.length] = child; + } + break; + case CharRangeSection.Entire: + if (this.state != CharRangeSection.End) { + child = fresh(lineCollection); + currentNode.add(child); + this.startPath[this.startPath.length] = child; + } + else { + if (!lineCollection.isLeaf()) { + child = fresh(lineCollection); + currentNode.add(child); + this.endBranch[this.endBranch.length] = child; + } + } + break; + case CharRangeSection.Mid: + this.goSubtree = false; + break; + case CharRangeSection.End: + if (this.state != CharRangeSection.End) { + this.goSubtree = false; + } + else { + if (!lineCollection.isLeaf()) { + child = fresh(lineCollection); + currentNode.add(child); + this.endBranch[this.endBranch.length] = child; + } + } + break; + case CharRangeSection.PostEnd: + this.goSubtree = false; + if (this.state != CharRangeSection.Start) { + currentNode.add(lineCollection); + } + break; + } + if (this.goSubtree) { + this.stack[this.stack.length] = child; + } + return lineCollection; + } + // just gather text from the leaves + leaf(relativeStart: number, relativeLength: number, ll: LineLeaf) { + if (this.state == CharRangeSection.Start) { + this.initialText = ll.text.substring(0, relativeStart); + } + else if (this.state == CharRangeSection.Entire) { + this.initialText = ll.text.substring(0, relativeStart); + this.trailingText = ll.text.substring(relativeStart + relativeLength); + } + else { + // state is CharRangeSection.End + this.trailingText = ll.text.substring(relativeStart + relativeLength); + } + } + } + + // text change information + class TextChange { + constructor(public pos: number, public deleteLen: number, public insertedText?: string) { + } + + getTextChangeRange() { + return ts.createTextChangeRange(ts.createTextSpan(this.pos, this.deleteLen), + this.insertedText ? this.insertedText.length : 0); + } + } + + class ScriptVersionCache { + changes: TextChange[] = []; + versions: LineIndexSnapshot[] = []; + minVersion = 0; // no versions earlier than min version will maintain change history + private currentVersion = 0; + + static changeNumberThreshold = 8; + static changeLengthThreshold = 256; + + // REVIEW: can optimize by coalescing simple edits + edit(pos: number, deleteLen: number, insertedText?: string) { + this.changes[this.changes.length] = new TextChange(pos, deleteLen, insertedText); + if ((this.changes.length > ScriptVersionCache.changeNumberThreshold) || + (deleteLen > ScriptVersionCache.changeLengthThreshold) || + (insertedText && (insertedText.length > ScriptVersionCache.changeLengthThreshold))) { + this.getSnapshot(); + } + } + + latest() { + return this.versions[this.currentVersion]; + } + + latestVersion() { + if (this.changes.length > 0) { + this.getSnapshot(); + } + return this.currentVersion; + } + + reloadFromFile(filename: string, cb?: () => any) { + var content = ts.sys.readFile(filename); + this.reload(content); + if (cb) + cb(); + } + + // reload whole script, leaving no change history behind reload + reload(script: string) { + this.currentVersion++; + this.changes = []; // history wiped out by reload + var snap = new LineIndexSnapshot(this.currentVersion, this); + this.versions[this.currentVersion] = snap; + snap.index = new LineIndex(); + var lm = LineIndex.linesFromText(script); + snap.index.load(lm.lines); + // REVIEW: could use linked list + for (var i = this.minVersion; i < this.currentVersion; i++) { + this.versions[i] = undefined; + } + this.minVersion = this.currentVersion; + + } + + getSnapshot() { + var snap = this.versions[this.currentVersion]; + if (this.changes.length > 0) { + var snapIndex = this.latest().index; + for (var i = 0, len = this.changes.length; i < len; i++) { + var change = this.changes[i]; + snapIndex = snapIndex.edit(change.pos, change.deleteLen, change.insertedText); + } + snap = new LineIndexSnapshot(this.currentVersion + 1, this); + snap.index = snapIndex; + snap.changesSincePreviousVersion = this.changes; + this.currentVersion = snap.version; + this.versions[snap.version] = snap; + this.changes = []; + } + return snap; + } + + getTextChangesBetweenVersions(oldVersion: number, newVersion: number) { + if (oldVersion < newVersion) { + if (oldVersion >= this.minVersion) { + var textChangeRanges: ts.TextChangeRange[] = []; + for (var i = oldVersion + 1; i <= newVersion; i++) { + var snap = this.versions[i]; + for (var j = 0, len = snap.changesSincePreviousVersion.length; j < len; j++) { + var textChange = snap.changesSincePreviousVersion[j]; + textChangeRanges[textChangeRanges.length] = textChange.getTextChangeRange(); + } + } + return ts.collapseTextChangeRangesAcrossMultipleVersions(textChangeRanges); + } + else { + return undefined; + } + } + else { + return ts.unchangedTextChangeRange; + } + } + + static fromString(script: string) { + var svc = new ScriptVersionCache(); + var snap = new LineIndexSnapshot(0, svc); + svc.versions[svc.currentVersion] = snap; + snap.index = new LineIndex(); + var lm = LineIndex.linesFromText(script); + snap.index.load(lm.lines); + return svc; + } + } + + class LineIndexSnapshot implements ts.IScriptSnapshot { + index: LineIndex; + changesSincePreviousVersion: TextChange[] = []; + + constructor(public version: number, public cache: ScriptVersionCache) { + } + + getText(rangeStart: number, rangeEnd: number) { + return this.index.getText(rangeStart, rangeEnd - rangeStart); + } + + getLength() { + return this.index.root.charCount(); + } + + // this requires linear space so don't hold on to these + getLineStartPositions(): number[] { + var starts: number[] = [-1]; + var count = 1; + var pos = 0; + this.index.every((ll, s, len) => { + starts[count++] = pos; + pos += ll.text.length; + return true; + }, 0); + return starts; + } + + getLineMapper() { + return ((line: number) => { + return this.index.lineNumberToInfo(line).col; + }); + } + + getTextChangeRangeSinceVersion(scriptVersion: number) { + if (this.version <= scriptVersion) { + return ts.unchangedTextChangeRange; + } + else { + return this.cache.getTextChangesBetweenVersions(scriptVersion, this.version); + } + } + getChangeRange(oldSnapshot: ts.IScriptSnapshot): ts.TextChangeRange { + var oldSnap = oldSnapshot; + return this.getTextChangeRangeSinceVersion(oldSnap.version); + } + } + + class LineIndex { + root: LineNode; + // set this to true to check each edit for accuracy + checkEdits = false; + + charOffsetToLineNumberAndPos(charOffset: number) { + return this.root.charOffsetToLineNumberAndPos(1, charOffset); + } + + lineNumberToInfo(lineNumber: number): ILineInfo { + var lineCount = this.root.lineCount(); + if (lineNumber <= lineCount) { + var lineInfo = this.root.lineNumberToInfo(lineNumber, 0); + lineInfo.line = lineNumber; + return lineInfo; + } + else { + return { + line: lineNumber, + col: this.root.charCount() + } + } + } + + load(lines: string[]) { + if (lines.length > 0) { + var leaves: LineLeaf[] = []; + for (var i = 0, len = lines.length; i < len; i++) { + leaves[i] = new LineLeaf(lines[i]); + } + this.root = LineIndex.buildTreeFromBottom(leaves); + } + else { + this.root = new LineNode(); + } + } + + walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker) { + this.root.walk(rangeStart, rangeLength, walkFns); + } + + getText(rangeStart: number, rangeLength: number) { + var accum = ""; + if (rangeLength > 0) { + this.walk(rangeStart, rangeLength, { + goSubtree: true, + done: false, + leaf: (relativeStart: number, relativeLength: number, ll: LineLeaf) => { + accum = accum.concat(ll.text.substring(relativeStart, relativeStart + relativeLength)); + } + }); + } + return accum; + } + + every(f: (ll: LineLeaf, s: number, len: number) => boolean, rangeStart: number, rangeEnd?: number) { + if (!rangeEnd) { + rangeEnd = this.root.charCount(); + } + var walkFns = { + goSubtree: true, + done: false, + leaf: function (relativeStart: number, relativeLength: number, ll: LineLeaf) { + if (!f(ll, relativeStart, relativeLength)) { + this.done = true; + } + } + } + this.walk(rangeStart, rangeEnd - rangeStart, walkFns); + return !walkFns.done; + } + + edit(pos: number, deleteLength: number, newText?: string) { + function editFlat(source: string, s: number, dl: number, nt = "") { + return source.substring(0, s) + nt + source.substring(s + dl, source.length); + } + if (this.root.charCount() == 0) { + // TODO: assert deleteLength == 0 + if (newText) { + this.load(LineIndex.linesFromText(newText).lines); + return this; + } + } + else { + if (this.checkEdits) { + var checkText = editFlat(this.getText(0, this.root.charCount()), pos, deleteLength, newText); + } + var walker = new EditWalker(); + if (deleteLength > 0) { + // check whether last characters deleted are line break + var e = pos + deleteLength; + var lineInfo = this.charOffsetToLineNumberAndPos(e); + if ((lineInfo && (lineInfo.col == 0))) { + // move range end just past line that will merge with previous line + deleteLength += lineInfo.text.length; + // store text by appending to end of insertedText + if (newText) { + newText = newText + lineInfo.text; + } + else { + newText = lineInfo.text; + } + } + } + else if (pos >= this.root.charCount()) { + // insert at end + var endString = this.getText(pos - 1, 1); + if (newText) { + newText = endString + newText; + } + else { + newText = endString; + } + pos = pos - 1; + deleteLength = 0; + walker.suppressTrailingText = true; + } + this.root.walk(pos, deleteLength, walker); + walker.insertLines(newText); + if (this.checkEdits) { + var updatedText = this.getText(0, this.root.charCount()); + Debug.assert(checkText == updatedText, "buffer edit mismatch"); + } + return walker.lineIndex; + } + } + + static buildTreeFromBottom(nodes: LineCollection[]): LineNode { + var nodeCount = Math.ceil(nodes.length / lineCollectionCapacity); + var interiorNodes: LineNode[] = []; + var nodeIndex = 0; + for (var i = 0; i < nodeCount; i++) { + interiorNodes[i] = new LineNode(); + var charCount = 0; + var lineCount = 0; + for (var j = 0; j < lineCollectionCapacity; j++) { + if (nodeIndex < nodes.length) { + interiorNodes[i].add(nodes[nodeIndex]); + charCount += nodes[nodeIndex].charCount(); + lineCount += nodes[nodeIndex].lineCount(); + } + else { + break; + } + nodeIndex++; + } + interiorNodes[i].totalChars = charCount; + interiorNodes[i].totalLines = lineCount; + } + if (interiorNodes.length == 1) { + return interiorNodes[0]; + } + else { + return this.buildTreeFromBottom(interiorNodes); + } + } + + static linesFromText(text: string) { + var lineStarts = ts.computeLineStarts(text); + + if (lineStarts.length == 0) { + return { lines: [], lineMap: lineStarts }; + } + var lines = new Array(lineStarts.length); + var lc = lineStarts.length - 1; + for (var lmi = 0; lmi < lc; lmi++) { + lines[lmi] = text.substring(lineStarts[lmi], lineStarts[lmi + 1]); + } + + var endText = text.substring(lineStarts[lc]); + if (endText.length > 0) { + lines[lc] = endText; + } + else { + lines.length--; + } + return { lines: lines, lineMap: lineStarts }; + } + } + + class LineNode implements LineCollection { + totalChars = 0; + totalLines = 0; + children: LineCollection[] = []; + + isLeaf() { + return false; + } + + updateCounts() { + this.totalChars = 0; + this.totalLines = 0; + for (var i = 0, len = this.children.length; i < len; i++) { + var child = this.children[i]; + this.totalChars += child.charCount(); + this.totalLines += child.lineCount(); + } + } + + execWalk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker, childIndex: number, nodeType: CharRangeSection) { + if (walkFns.pre) { + walkFns.pre(rangeStart, rangeLength, this.children[childIndex], this, nodeType); + } + if (walkFns.goSubtree) { + this.children[childIndex].walk(rangeStart, rangeLength, walkFns); + if (walkFns.post) { + walkFns.post(rangeStart, rangeLength, this.children[childIndex], this, nodeType); + } + } + else { + walkFns.goSubtree = true; + } + return walkFns.done; + } + + skipChild(relativeStart: number, relativeLength: number, childIndex: number, walkFns: ILineIndexWalker, nodeType: CharRangeSection) { + if (walkFns.pre && (!walkFns.done)) { + walkFns.pre(relativeStart, relativeLength, this.children[childIndex], this, nodeType); + walkFns.goSubtree = true; + } + } + + walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker) { + // assume (rangeStart < this.totalChars) && (rangeLength <= this.totalChars) + var childIndex = 0; + var child = this.children[0]; + var childCharCount = child.charCount(); + // find sub-tree containing start + var adjustedStart = rangeStart; + while (adjustedStart >= childCharCount) { + this.skipChild(adjustedStart, rangeLength, childIndex, walkFns, CharRangeSection.PreStart); + adjustedStart -= childCharCount; + child = this.children[++childIndex]; + childCharCount = child.charCount(); + } + // Case I: both start and end of range in same subtree + if ((adjustedStart + rangeLength) <= childCharCount) { + if (this.execWalk(adjustedStart, rangeLength, walkFns, childIndex, CharRangeSection.Entire)) { + return; + } + } + else { + // Case II: start and end of range in different subtrees (possibly with subtrees in the middle) + if (this.execWalk(adjustedStart, childCharCount - adjustedStart, walkFns, childIndex, CharRangeSection.Start)) { + return; + } + var adjustedLength = rangeLength - (childCharCount - adjustedStart); + child = this.children[++childIndex]; + childCharCount = child.charCount(); + while (adjustedLength > childCharCount) { + if (this.execWalk(0, childCharCount, walkFns, childIndex, CharRangeSection.Mid)) { + return; + } + adjustedLength -= childCharCount; + child = this.children[++childIndex]; + childCharCount = child.charCount(); + } + if (adjustedLength > 0) { + if (this.execWalk(0, adjustedLength, walkFns, childIndex, CharRangeSection.End)) { + return; + } + } + } + // Process any subtrees after the one containing range end + if (walkFns.pre) { + var clen = this.children.length; + if (childIndex < (clen - 1)) { + for (var ej = childIndex + 1; ej < clen; ej++) { + this.skipChild(0, 0, ej, walkFns, CharRangeSection.PostEnd); + } + } + } + } + + charOffsetToLineNumberAndPos(lineNumber: number, charOffset: number): ILineInfo { + var childInfo = this.childFromCharOffset(lineNumber, charOffset); + if (!childInfo.child) { + return { + line: lineNumber, + col: charOffset, + } + } + else if (childInfo.childIndex < this.children.length) { + if (childInfo.child.isLeaf()) { + return { + line: childInfo.lineNumber, + col: childInfo.charOffset, + text: ((childInfo.child)).text, + leaf: ((childInfo.child)) + }; + } + else { + var lineNode = (childInfo.child); + return lineNode.charOffsetToLineNumberAndPos(childInfo.lineNumber, childInfo.charOffset); + } + } + else { + var lineInfo = this.lineNumberToInfo(this.lineCount(), 0); + return { line: this.lineCount(), col: lineInfo.leaf.charCount() }; + } + } + + lineNumberToInfo(lineNumber: number, charOffset: number): ILineInfo { + var childInfo = this.childFromLineNumber(lineNumber, charOffset); + if (!childInfo.child) { + return { + line: lineNumber, + col: charOffset + } + } + else if (childInfo.child.isLeaf()) { + return { + line: lineNumber, + col: childInfo.charOffset, + text: ((childInfo.child)).text, + leaf: ((childInfo.child)) + } + } + else { + var lineNode = (childInfo.child); + return lineNode.lineNumberToInfo(childInfo.relativeLineNumber, childInfo.charOffset); + } + } + + childFromLineNumber(lineNumber: number, charOffset: number) { + var child: LineCollection; + var relativeLineNumber = lineNumber; + for (var i = 0, len = this.children.length; i < len; i++) { + child = this.children[i]; + var childLineCount = child.lineCount(); + if (childLineCount >= relativeLineNumber) { + break; + } + else { + relativeLineNumber -= childLineCount; + charOffset += child.charCount(); + } + } + return { + child: child, + childIndex: i, + relativeLineNumber: relativeLineNumber, + charOffset: charOffset + }; + } + + childFromCharOffset(lineNumber: number, charOffset: number) { + var child: LineCollection; + for (var i = 0, len = this.children.length; i < len; i++) { + child = this.children[i]; + if (child.charCount() > charOffset) { + break; + } + else { + charOffset -= child.charCount(); + lineNumber += child.lineCount(); + } + } + return { + child: child, + childIndex: i, + charOffset: charOffset, + lineNumber: lineNumber + } + } + + splitAfter(childIndex: number) { + var splitNode: LineNode; + var clen = this.children.length; + childIndex++; + var endLength = childIndex; + if (childIndex < clen) { + splitNode = new LineNode(); + while (childIndex < clen) { + splitNode.add(this.children[childIndex++]); + } + splitNode.updateCounts(); + } + this.children.length = endLength; + return splitNode; + } + + remove(child: LineCollection) { + var childIndex = this.findChildIndex(child); + var clen = this.children.length; + if (childIndex < (clen - 1)) { + for (var i = childIndex; i < (clen - 1); i++) { + this.children[i] = this.children[i + 1]; + } + } + this.children.length--; + } + + findChildIndex(child: LineCollection) { + var childIndex = 0; + var clen = this.children.length; + while ((this.children[childIndex] != child) && (childIndex < clen)) childIndex++; + return childIndex; + } + + insertAt(child: LineCollection, nodes: LineCollection[]) { + var childIndex = this.findChildIndex(child); + var clen = this.children.length; + var nodeCount = nodes.length; + // if child is last and there is more room and only one node to place, place it + if ((clen < lineCollectionCapacity) && (childIndex == (clen - 1)) && (nodeCount == 1)) { + this.add(nodes[0]); + this.updateCounts(); + return []; + } + else { + var shiftNode = this.splitAfter(childIndex); + var nodeIndex = 0; + childIndex++; + while ((childIndex < lineCollectionCapacity) && (nodeIndex < nodeCount)) { + this.children[childIndex++] = nodes[nodeIndex++]; + } + var splitNodes: LineNode[] = []; + var splitNodeCount = 0; + if (nodeIndex < nodeCount) { + splitNodeCount = Math.ceil((nodeCount - nodeIndex) / lineCollectionCapacity); + splitNodes = new Array(splitNodeCount); + var splitNodeIndex = 0; + for (var i = 0; i < splitNodeCount; i++) { + splitNodes[i] = new LineNode(); + } + var splitNode = splitNodes[0]; + while (nodeIndex < nodeCount) { + splitNode.add(nodes[nodeIndex++]); + if (splitNode.children.length == lineCollectionCapacity) { + splitNodeIndex++; + splitNode = splitNodes[splitNodeIndex]; + } + } + for (i = splitNodes.length - 1; i >= 0; i--) { + if (splitNodes[i].children.length == 0) { + splitNodes.length--; + } + } + } + if (shiftNode) { + splitNodes[splitNodes.length] = shiftNode; + } + this.updateCounts(); + for (i = 0; i < splitNodeCount; i++) { + (splitNodes[i]).updateCounts(); + } + return splitNodes; + } + } + + // assume there is room for the item; return true if more room + add(collection: LineCollection) { + this.children[this.children.length] = collection; + return (this.children.length < lineCollectionCapacity); + } + + charCount() { + return this.totalChars; + } + + lineCount() { + return this.totalLines; + } + } + + class LineLeaf implements LineCollection { + udata: any; + + constructor(public text: string) { + + } + + setUdata(data: any) { + this.udata = data; + } + + getUdata() { + return this.udata; + } + + isLeaf() { + return true; + } + + walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker) { + walkFns.leaf(rangeStart, rangeLength, this); + } + + charCount() { + return this.text.length; + } + + lineCount() { + return 1; + } + } +} \ No newline at end of file diff --git a/src/server/node.d.ts b/src/server/node.d.ts new file mode 100644 index 00000000000..2002f973a37 --- /dev/null +++ b/src/server/node.d.ts @@ -0,0 +1,677 @@ +// Type definitions for Node.js v0.10.1 +// Project: http://nodejs.org/ +// Definitions by: Microsoft TypeScript , DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/************************************************ +* * +* Node.js v0.10.1 API * +* * +************************************************/ + +/************************************************ +* * +* GLOBAL * +* * +************************************************/ +declare var process: NodeJS.Process; +declare var global: any; + +declare var __filename: string; +declare var __dirname: string; + +declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer; +declare function clearTimeout(timeoutId: NodeJS.Timer): void; +declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer; +declare function clearInterval(intervalId: NodeJS.Timer): void; +declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): any; +declare function clearImmediate(immediateId: any): void; + +declare var require: { + (id: string): any; + resolve(id: string): string; + cache: any; + extensions: any; + main: any; +}; + +declare var module: { + exports: any; + require(id: string): any; + id: string; + filename: string; + loaded: boolean; + parent: any; + children: any[]; +}; + +// Same as module.exports +declare var exports: any; +declare var SlowBuffer: { + new (str: string, encoding?: string): Buffer; + new (size: number): Buffer; + new (size: Uint8Array): Buffer; + new (array: any[]): Buffer; + prototype: Buffer; + isBuffer(obj: any): boolean; + byteLength(string: string, encoding?: string): number; + concat(list: Buffer[], totalLength?: number): Buffer; +}; + + +// Buffer class +interface Buffer extends NodeBuffer { } +interface BufferConstructor { + new (str: string, encoding ?: string): Buffer; + new (size: number): Buffer; + new (size: Uint8Array): Buffer; + new (array: any[]): Buffer; + prototype: Buffer; + isBuffer(obj: any): boolean; + byteLength(string: string, encoding ?: string): number; + concat(list: Buffer[], totalLength ?: number): Buffer; +} +declare var Buffer: BufferConstructor; + +/************************************************ +* * +* GLOBAL INTERFACES * +* * +************************************************/ +declare module NodeJS { + export interface ErrnoException extends Error { + errno?: any; + code?: string; + path?: string; + syscall?: string; + } + + export interface EventEmitter { + addListener(event: string, listener: Function): EventEmitter; + on(event: string, listener: Function): EventEmitter; + once(event: string, listener: Function): EventEmitter; + removeListener(event: string, listener: Function): EventEmitter; + removeAllListeners(event?: string): EventEmitter; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + } + + export interface ReadableStream extends EventEmitter { + readable: boolean; + read(size?: number): any; + setEncoding(encoding: string): void; + pause(): void; + resume(): void; + pipe(destination: T, options?: { end?: boolean; }): T; + unpipe(destination?: T): void; + unshift(chunk: string): void; + unshift(chunk: Buffer): void; + wrap(oldStream: ReadableStream): ReadableStream; + } + + export interface WritableStream extends EventEmitter { + writable: boolean; + write(buffer: Buffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + end(): void; + end(buffer: Buffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + } + + export interface ReadWriteStream extends ReadableStream, WritableStream { } + + export interface Process extends EventEmitter { + stdout: WritableStream; + stderr: WritableStream; + stdin: ReadableStream; + argv: string[]; + execPath: string; + abort(): void; + chdir(directory: string): void; + cwd(): string; + env: any; + exit(code?: number): void; + getgid(): number; + setgid(id: number): void; + setgid(id: string): void; + getuid(): number; + setuid(id: number): void; + setuid(id: string): void; + version: string; + versions: { + http_parser: string; + node: string; + v8: string; + ares: string; + uv: string; + zlib: string; + openssl: string; + }; + config: { + target_defaults: { + cflags: any[]; + default_configuration: string; + defines: string[]; + include_dirs: string[]; + libraries: string[]; + }; + variables: { + clang: number; + host_arch: string; + node_install_npm: boolean; + node_install_waf: boolean; + node_prefix: string; + node_shared_openssl: boolean; + node_shared_v8: boolean; + node_shared_zlib: boolean; + node_use_dtrace: boolean; + node_use_etw: boolean; + node_use_openssl: boolean; + target_arch: string; + v8_no_strict_aliasing: number; + v8_use_snapshot: boolean; + visibility: string; + }; + }; + kill(pid: number, signal?: string): void; + pid: number; + title: string; + arch: string; + platform: string; + memoryUsage(): { rss: number; heapTotal: number; heapUsed: number; }; + nextTick(callback: Function): void; + umask(mask?: number): number; + uptime(): number; + hrtime(time?: number[]): number[]; + + // Worker + send? (message: any, sendHandle?: any): void; + } + + export interface Timer { + ref(): void; + unref(): void; + } +} + + +/** + * @deprecated + */ +interface NodeBuffer { + [index: number]: number; + write(string: string, offset?: number, length?: number, encoding?: string): number; + toString(encoding?: string, start?: number, end?: number): string; + toJSON(): any; + length: number; + copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; + slice(start?: number, end?: number): Buffer; + readUInt8(offset: number, noAsset?: boolean): number; + readUInt16LE(offset: number, noAssert?: boolean): number; + readUInt16BE(offset: number, noAssert?: boolean): number; + readUInt32LE(offset: number, noAssert?: boolean): number; + readUInt32BE(offset: number, noAssert?: boolean): number; + readInt8(offset: number, noAssert?: boolean): number; + readInt16LE(offset: number, noAssert?: boolean): number; + readInt16BE(offset: number, noAssert?: boolean): number; + readInt32LE(offset: number, noAssert?: boolean): number; + readInt32BE(offset: number, noAssert?: boolean): number; + readFloatLE(offset: number, noAssert?: boolean): number; + readFloatBE(offset: number, noAssert?: boolean): number; + readDoubleLE(offset: number, noAssert?: boolean): number; + readDoubleBE(offset: number, noAssert?: boolean): number; + writeUInt8(value: number, offset: number, noAssert?: boolean): void; + writeUInt16LE(value: number, offset: number, noAssert?: boolean): void; + writeUInt16BE(value: number, offset: number, noAssert?: boolean): void; + writeUInt32LE(value: number, offset: number, noAssert?: boolean): void; + writeUInt32BE(value: number, offset: number, noAssert?: boolean): void; + writeInt8(value: number, offset: number, noAssert?: boolean): void; + writeInt16LE(value: number, offset: number, noAssert?: boolean): void; + writeInt16BE(value: number, offset: number, noAssert?: boolean): void; + writeInt32LE(value: number, offset: number, noAssert?: boolean): void; + writeInt32BE(value: number, offset: number, noAssert?: boolean): void; + writeFloatLE(value: number, offset: number, noAssert?: boolean): void; + writeFloatBE(value: number, offset: number, noAssert?: boolean): void; + writeDoubleLE(value: number, offset: number, noAssert?: boolean): void; + writeDoubleBE(value: number, offset: number, noAssert?: boolean): void; + fill(value: any, offset?: number, end?: number): void; +} + +declare module NodeJS { + export interface Path { + normalize(p: string): string; + join(...paths: any[]): string; + resolve(...pathSegments: any[]): string; + relative(from: string, to: string): string; + dirname(p: string): string; + basename(p: string, ext?: string): string; + extname(p: string): string; + sep: string; + } +} + +declare module NodeJS { + export interface ReadLineInstance extends EventEmitter { + setPrompt(prompt: string, length: number): void; + prompt(preserveCursor?: boolean): void; + question(query: string, callback: Function): void; + pause(): void; + resume(): void; + close(): void; + write(data: any, key?: any): void; + } + export interface ReadLineOptions { + input: NodeJS.ReadableStream; + output: NodeJS.WritableStream; + completer?: Function; + terminal?: boolean; + } + + export interface ReadLine { + createInterface(options: ReadLineOptions): ReadLineInstance; + } +} + +declare module NodeJS { + module events { + export class EventEmitter implements NodeJS.EventEmitter { + static listenerCount(emitter: EventEmitter, event: string): number; + + addListener(event: string, listener: Function): EventEmitter; + on(event: string, listener: Function): EventEmitter; + once(event: string, listener: Function): EventEmitter; + removeListener(event: string, listener: Function): EventEmitter; + removeAllListeners(event?: string): EventEmitter; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + } + } +} + +declare module NodeJS { + module stream { + + export interface Stream extends events.EventEmitter { + pipe(destination: T, options?: { end?: boolean; }): T; + } + + export interface ReadableOptions { + highWaterMark?: number; + encoding?: string; + objectMode?: boolean; + } + + export class Readable extends events.EventEmitter implements NodeJS.ReadableStream { + readable: boolean; + constructor(opts?: ReadableOptions); + _read(size: number): void; + read(size?: number): any; + setEncoding(encoding: string): void; + pause(): void; + resume(): void; + pipe(destination: T, options?: { end?: boolean; }): T; + unpipe(destination?: T): void; + unshift(chunk: string): void; + unshift(chunk: Buffer): void; + wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream; + push(chunk: any, encoding?: string): boolean; + } + + export interface WritableOptions { + highWaterMark?: number; + decodeStrings?: boolean; + } + + export class Writable extends events.EventEmitter implements NodeJS.WritableStream { + writable: boolean; + constructor(opts?: WritableOptions); + _write(data: Buffer, encoding: string, callback: Function): void; + _write(data: string, encoding: string, callback: Function): void; + write(buffer: Buffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + end(): void; + end(buffer: Buffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + } + + export interface DuplexOptions extends ReadableOptions, WritableOptions { + allowHalfOpen?: boolean; + } + + // Note: Duplex extends both Readable and Writable. + export class Duplex extends Readable implements NodeJS.ReadWriteStream { + writable: boolean; + constructor(opts?: DuplexOptions); + _write(data: Buffer, encoding: string, callback: Function): void; + _write(data: string, encoding: string, callback: Function): void; + write(buffer: Buffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + end(): void; + end(buffer: Buffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + } + + export interface TransformOptions extends ReadableOptions, WritableOptions { } + + // Note: Transform lacks the _read and _write methods of Readable/Writable. + export class Transform extends events.EventEmitter implements NodeJS.ReadWriteStream { + readable: boolean; + writable: boolean; + constructor(opts?: TransformOptions); + _transform(chunk: Buffer, encoding: string, callback: Function): void; + _transform(chunk: string, encoding: string, callback: Function): void; + _flush(callback: Function): void; + read(size?: number): any; + setEncoding(encoding: string): void; + pause(): void; + resume(): void; + pipe(destination: T, options?: { end?: boolean; }): T; + unpipe(destination?: T): void; + unshift(chunk: string): void; + unshift(chunk: Buffer): void; + wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream; + push(chunk: any, encoding?: string): boolean; + write(buffer: Buffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + end(): void; + end(buffer: Buffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + } + + export class PassThrough extends Transform { } + } +} + +declare module NodeJS { + module fs { + interface Stats { + isFile(): boolean; + isDirectory(): boolean; + isBlockDevice(): boolean; + isCharacterDevice(): boolean; + isSymbolicLink(): boolean; + isFIFO(): boolean; + isSocket(): boolean; + dev: number; + ino: number; + mode: number; + nlink: number; + uid: number; + gid: number; + rdev: number; + size: number; + blksize: number; + blocks: number; + atime: Date; + mtime: Date; + ctime: Date; + } + interface FSWatcher extends events.EventEmitter { + close(): void; + } + + export interface ReadStream extends stream.Readable { } + export interface WriteStream extends stream.Writable { } + + export function rename(oldPath: string, newPath: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function renameSync(oldPath: string, newPath: string): void; + export function truncate(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function truncate(path: string, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function truncateSync(path: string, len?: number): void; + export function ftruncate(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function ftruncate(fd: number, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function ftruncateSync(fd: number, len?: number): void; + export function chown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function chownSync(path: string, uid: number, gid: number): void; + export function fchown(fd: number, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fchownSync(fd: number, uid: number, gid: number): void; + export function lchown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function lchownSync(path: string, uid: number, gid: number): void; + export function chmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function chmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function chmodSync(path: string, mode: number): void; + export function chmodSync(path: string, mode: string): void; + export function fchmod(fd: number, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fchmod(fd: number, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fchmodSync(fd: number, mode: number): void; + export function fchmodSync(fd: number, mode: string): void; + export function lchmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function lchmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function lchmodSync(path: string, mode: number): void; + export function lchmodSync(path: string, mode: string): void; + export function stat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; + export function lstat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; + export function fstat(fd: number, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; + export function statSync(path: string): Stats; + export function lstatSync(path: string): Stats; + export function fstatSync(fd: number): Stats; + export function link(srcpath: string, dstpath: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function linkSync(srcpath: string, dstpath: string): void; + export function symlink(srcpath: string, dstpath: string, type?: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function symlinkSync(srcpath: string, dstpath: string, type?: string): void; + export function readlink(path: string, callback?: (err: NodeJS.ErrnoException, linkString: string) => any): void; + export function readlinkSync(path: string): string; + export function realpath(path: string, callback?: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void; + export function realpath(path: string, cache: { [path: string]: string }, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void; + export function realpathSync(path: string, cache?: { [path: string]: string }): string; + export function unlink(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function unlinkSync(path: string): void; + export function rmdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function rmdirSync(path: string): void; + export function mkdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function mkdir(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function mkdir(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function mkdirSync(path: string, mode?: number): void; + export function mkdirSync(path: string, mode?: string): void; + export function readdir(path: string, callback?: (err: NodeJS.ErrnoException, files: string[]) => void): void; + export function readdirSync(path: string): string[]; + export function close(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function closeSync(fd: number): void; + export function open(path: string, flags: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; + export function open(path: string, flags: string, mode: number, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; + export function open(path: string, flags: string, mode: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; + export function openSync(path: string, flags: string, mode?: number): number; + export function openSync(path: string, flags: string, mode?: string): number; + export function utimes(path: string, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function utimes(path: string, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function utimesSync(path: string, atime: number, mtime: number): void; + export function utimesSync(path: string, atime: Date, mtime: Date): void; + export function futimes(fd: number, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function futimes(fd: number, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function futimesSync(fd: number, atime: number, mtime: number): void; + export function futimesSync(fd: number, atime: Date, mtime: Date): void; + export function fsync(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fsyncSync(fd: number): void; + export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; + export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number; + export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void; + export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number; + export function readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void; + export function readFile(filename: string, options: { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: string) => void): void; + export function readFile(filename: string, options: { flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; + export function readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; + export function readFileSync(filename: string, encoding: string): string; + export function readFileSync(filename: string, options: { encoding: string; flag?: string; }): string; + export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; + export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; + export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; + export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; + export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; + export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void; + export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: Stats, prev: Stats) => void): void; + export function unwatchFile(filename: string, listener?: (curr: Stats, prev: Stats) => void): void; + export function watch(filename: string, listener?: (event: string, filename: string) => any): FSWatcher; + export function watch(filename: string, options: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher; + export function exists(path: string, callback?: (exists: boolean) => void): void; + export function existsSync(path: string): boolean; + export function createReadStream(path: string, options?: { + flags?: string; + encoding?: string; + fd?: string; + mode?: number; + bufferSize?: number; + }): ReadStream; + export function createReadStream(path: string, options?: { + flags?: string; + encoding?: string; + fd?: string; + mode?: string; + bufferSize?: number; + }): ReadStream; + export function createWriteStream(path: string, options?: { + flags?: string; + encoding?: string; + string?: string; + }): WriteStream; + } +} + +declare module NodeJS { + module path { + export function normalize(p: string): string; + export function join(...paths: any[]): string; + export function resolve(...pathSegments: any[]): string; + export function relative(from: string, to: string): string; + export function dirname(p: string): string; + export function basename(p: string, ext?: string): string; + export function extname(p: string): string; + export var sep: string; + } +} + +declare module NodeJS { + module _debugger { + export interface Packet { + raw: string; + headers: string[]; + body: Message; + } + + export interface Message { + seq: number; + type: string; + } + + export interface RequestInfo { + command: string; + arguments: any; + } + + export interface Request extends Message, RequestInfo { + } + + export interface Event extends Message { + event: string; + body?: any; + } + + export interface Response extends Message { + request_seq: number; + success: boolean; + /** Contains error message if success == false. */ + message?: string; + /** Contains message body if success == true. */ + body?: any; + } + + export interface BreakpointMessageBody { + type: string; + target: number; + line: number; + } + + export class Protocol { + res: Packet; + state: string; + execute(data: string): void; + serialize(rq: Request): string; + onResponse: (pkt: Packet) => void; + } + + export var NO_FRAME: number; + export var port: number; + + export interface ScriptDesc { + name: string; + id: number; + isNative?: boolean; + handle?: number; + type: string; + lineOffset?: number; + columnOffset?: number; + lineCount?: number; + } + + export interface Breakpoint { + id: number; + scriptId: number; + script: ScriptDesc; + line: number; + condition?: string; + scriptReq?: string; + } + + export interface RequestHandler { + (err: boolean, body: Message, res: Packet): void; + request_seq?: number; + } + + export interface ResponseBodyHandler { + (err: boolean, body?: any): void; + request_seq?: number; + } + + export interface ExceptionInfo { + text: string; + } + + export interface BreakResponse { + script?: ScriptDesc; + exception?: ExceptionInfo; + sourceLine: number; + sourceLineText: string; + sourceColumn: number; + } + + export function SourceInfo(body: BreakResponse): string; + + export class Client extends events.EventEmitter { + protocol: Protocol; + scripts: ScriptDesc[]; + handles: ScriptDesc[]; + breakpoints: Breakpoint[]; + currentSourceLine: number; + currentSourceColumn: number; + currentSourceLineText: string; + currentFrame: number; + currentScript: string; + + connect(port: number, host: string): void; + req(req: any, cb: RequestHandler): void; + reqFrameEval(code: string, frame: number, cb: RequestHandler): void; + mirrorObject(obj: any, depth: number, cb: ResponseBodyHandler): void; + setBreakpoint(rq: BreakpointMessageBody, cb: RequestHandler): void; + clearBreakpoint(rq: Request, cb: RequestHandler): void; + listbreakpoints(cb: RequestHandler): void; + reqSource(from: number, to: number, cb: RequestHandler): void; + reqScripts(cb: any): void; + reqContinue(cb: RequestHandler): void; + } + } +} \ No newline at end of file diff --git a/src/server/protocol.d.ts b/src/server/protocol.d.ts new file mode 100644 index 00000000000..b07fb20d48d --- /dev/null +++ b/src/server/protocol.d.ts @@ -0,0 +1,823 @@ +/** + * Declaration module describing the TypeScript Server protocol + */ +declare module ts.server.protocol { + /** + * A TypeScript Server message + */ + export interface Message { + /** + * Sequence number of the message + */ + seq: number; + + /** + * One of "request", "response", or "event" + */ + type: string; + } + + /** + * Client-initiated request message + */ + export interface Request extends Message { + /** + * The command to execute + */ + command: string; + + /** + * Object containing arguments for the command + */ + arguments?: any; + } + + /** + * Server-initiated event message + */ + export interface Event extends Message { + /** + * Name of event + */ + event: string; + + /** + * Event-specific information + */ + body?: any; + } + + /** + * Response by server to client request message. + */ + export interface Response extends Message { + /** + * Sequence number of the request message. + */ + request_seq: number; + + /** + * Outcome of the request. + */ + success: boolean; + + /** + * The command requested. + */ + command: string; + + /** + * Contains error message if success == false. + */ + message?: string; + + /** + * Contains message body if success == true. + */ + body?: any; + } + + /** + * Arguments for FileRequest messages. + */ + export interface FileRequestArgs { + /** + * The file for the request (absolute pathname required). + */ + file: string; + } + + /** + * Request whose sole parameter is a file name. + */ + export interface FileRequest extends Request { + arguments: FileRequestArgs; + } + + /** + * Instances of this interface specify a location in a source file: + * (file, line, col), where line and column are 1-based. + */ + export interface FileLocationRequestArgs extends FileRequestArgs { + /** + * The line number for the request (1-based). + */ + line: number; + + /** + * The column for the request (1-based). + */ + col: number; + } + + /** + * A request whose arguments specify a file location (file, line, col). + */ + export interface FileLocationRequest extends FileRequest { + arguments: FileLocationRequestArgs; + } + + /** + * Go to definition request; value of command field is + * "definition". Return response giving the file locations that + * define the symbol found in file at location line, col. + */ + export interface DefinitionRequest extends FileLocationRequest { + } + + /** + * Location in source code expressed as (one-based) line and column. + */ + export interface Location { + line: number; + col: number; + } + + /** + * Object found in response messages defining a span of text in source code. + */ + export interface TextSpan { + /** + * First character of the definition. + */ + start: Location; + + /** + * One character past last character of the definition. + */ + end: Location; + } + + /** + * Object found in response messages defining a span of text in a specific source file. + */ + export interface FileSpan extends TextSpan { + /** + * File containing text span. + */ + file: string; + } + + /** + * Definition response message. Gives text range for definition. + */ + export interface DefinitionResponse extends Response { + body?: FileSpan[]; + } + + /** + * Find references request; value of command field is + * "references". Return response giving the file locations that + * reference the symbol found in file at location line, col. + */ + export interface ReferencesRequest extends FileLocationRequest { + } + + export interface ReferencesResponseItem extends FileSpan { + /** Text of line containing the reference. Including this + * with the response avoids latency of editor loading files + * to show text of reference line (the server already has + * loaded the referencing files). + */ + lineText: string; + + /** + * True if reference is a write location, false otherwise. + */ + isWriteAccess: boolean; + } + + /** + * The body of a "references" response message. + */ + export interface ReferencesResponseBody { + /** + * The file locations referencing the symbol. + */ + refs: ReferencesResponseItem[]; + + /** + * The name of the symbol. + */ + symbolName: string; + + /** + * The start column of the symbol (on the line provided by the references request). + */ + symbolStartCol: number; + + /** + * The full display name of the symbol. + */ + symbolDisplayString: string; + } + + /** + * Response to "references" request. + */ + export interface ReferencesResponse extends Response { + body?: ReferencesResponseBody; + } + + export interface RenameRequestArgs extends FileLocationRequestArgs { + findInComments?: boolean; + findInStrings?: boolean; + } + + + /** + * Rename request; value of command field is "rename". Return + * response giving the file locations that reference the symbol + * found in file at location line, col. Also return full display + * name of the symbol so that client can print it unambiguously. + */ + export interface RenameRequest extends FileLocationRequest { + arguments: RenameRequestArgs; + } + + /** + * Information about the item to be renamed. + */ + export interface RenameInfo { + /** + * True if item can be renamed. + */ + canRename: boolean; + + /** + * Error message if item can not be renamed. + */ + localizedErrorMessage?: string; + + /** + * Display name of the item to be renamed. + */ + displayName: string; + + /** + * Full display name of item to be renamed. + */ + fullDisplayName: string; + + /** + * The items's kind (such as 'className' or 'parameterName' or plain 'text'). + */ + kind: string; + + /** + * Optional modifiers for the kind (such as 'public'). + */ + kindModifiers: string; + } + + /** + * A group of text spans, all in 'file'. + */ + export interface SpanGroup { + /** The file to which the spans apply */ + file: string; + /** The text spans in this group */ + locs: TextSpan[]; + } + + export interface RenameResponseBody { + /** + * Information about the item to be renamed. + */ + info: RenameInfo; + + /** + * An array of span groups (one per file) that refer to the item to be renamed. + */ + locs: SpanGroup[]; + } + + /** + * Rename response message. + */ + export interface RenameResponse extends Response { + body?: RenameResponseBody; + } + + /** + * Open request; value of command field is "open". Notify the + * server that the client has file open. The server will not + * monitor the filesystem for changes in this file and will assume + * that the client is updating the server (using the change and/or + * reload messages) when the file changes. Server does not currently + * send a response to an open request. + */ + export interface OpenRequest extends FileRequest { + } + + /** + * Close request; value of command field is "close". Notify the + * server that the client has closed a previously open file. If + * file is still referenced by open files, the server will resume + * monitoring the filesystem for changes to file. Server does not + * currently send a response to a close request. + */ + export interface CloseRequest extends FileRequest { + } + + /** + * Quickinfo request; value of command field is + * "quickinfo". Return response giving a quick type and + * documentation string for the symbol found in file at location + * line, col. + */ + export interface QuickInfoRequest extends FileLocationRequest { + } + + /** + * Body of QuickInfoResponse. + */ + export interface QuickInfoResponseBody { + /** + * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). + */ + kind: string; + + /** + * Optional modifiers for the kind (such as 'public'). + */ + kindModifiers: string; + + /** + * Starting file location of symbol. + */ + start: Location; + + /** + * One past last character of symbol. + */ + end: Location; + + /** + * Type and kind of symbol. + */ + displayString: string; + + /** + * Documentation associated with symbol. + */ + documentation: string; + } + + /** + * Quickinfo response message. + */ + export interface QuickInfoResponse extends Response { + body?: QuickInfoResponseBody; + } + + /** + * Arguments for format messages. + */ + export interface FormatRequestArgs extends FileLocationRequestArgs { + /** + * Last line of range for which to format text in file. + */ + endLine: number; + + /** + * Last column of range for which to format text in file. + */ + endCol: number; + } + + /** + * Format request; value of command field is "format". Return + * response giving zero or more edit instructions. The edit + * instructions will be sorted in file order. Applying the edit + * instructions in reverse to file will result in correctly + * reformatted text. + */ + export interface FormatRequest extends FileLocationRequest { + arguments: FormatRequestArgs; + } + + /** + * Object found in response messages defining an editing + * instruction for a span of text in source code. The effect of + * this instruction is to replace the text starting at start and + * ending one character before end with newText. For an insertion, + * the text span is empty. For a deletion, newText is empty. + */ + export interface CodeEdit { + /** + * First character of the text span to edit. + */ + start: Location; + + /** + * One character past last character of the text span to edit. + */ + end: Location; + + /** + * Replace the span defined above with this string (may be + * the empty string). + */ + newText: string; + } + + /** + * Format and format on key response message. + */ + export interface FormatResponse extends Response { + body?: CodeEdit[]; + } + + /** + * Arguments for format on key messages. + */ + export interface FormatOnKeyRequestArgs extends FileLocationRequestArgs { + /** + * Key pressed (';', '\n', or '}'). + */ + key: string; + } + + /** + * Format on key request; value of command field is + * "formatonkey". Given file location and key typed (as string), + * return response giving zero or more edit instructions. The + * edit instructions will be sorted in file order. Applying the + * edit instructions in reverse to file will result in correctly + * reformatted text. + */ + export interface FormatOnKeyRequest extends FileLocationRequest { + arguments: FormatOnKeyRequestArgs; + } + + /** + * Arguments for completions messages. + */ + export interface CompletionsRequestArgs extends FileLocationRequestArgs { + /** + * Optional prefix to apply to possible completions. + */ + prefix?: string; + } + + /** + * Completions request; value of command field is "completions". + * Given a file location (file, line, col) and a prefix (which may + * be the empty string), return the possible completions that + * begin with prefix. + */ + export interface CompletionsRequest extends FileLocationRequest { + arguments: CompletionsRequestArgs; + } + + /** + * Arguments for completion details request. + */ + export interface CompletionDetailsRequestArgs extends FileLocationRequestArgs { + /** + * Names of one or more entries for which to obtain details. + */ + entryNames: string[]; + } + + /** + * Completion entry details request; value of command field is + * "completionEntryDetails". Given a file location (file, line, + * col) and an array of completion entry names return more + * detailed information for each completion entry. + */ + export interface CompletionDetailsRequest extends FileLocationRequest { + arguments: CompletionDetailsRequestArgs; + } + + /** + * Part of a symbol description. + */ + export interface SymbolDisplayPart { + /** + * Text of an item describing the symbol. + */ + text: string; + + /** + * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). + */ + kind: string; + } + + /** + * An item found in a completion response. + */ + export interface CompletionEntry { + /** + * The symbol's name. + */ + name: string; + /** + * The symbol's kind (such as 'className' or 'parameterName'). + */ + kind: string; + /** + * Optional modifiers for the kind (such as 'public'). + */ + kindModifiers: string; + } + + /** + * Additional completion entry details, available on demand + */ + export interface CompletionEntryDetails extends CompletionEntry { + /** + * Display parts of the symbol (similar to quick info). + */ + displayParts: SymbolDisplayPart[]; + + /** + * Documentation strings for the symbol. + */ + documentation: SymbolDisplayPart[]; + } + + export interface CompletionsResponse extends Response { + body?: CompletionEntry[]; + } + + export interface CompletionDetailsResponse extends Response { + body?: CompletionEntryDetails[]; + } + + /** + * Arguments for geterr messages. + */ + export interface GeterrRequestArgs { + /** + * List of file names for which to compute compiler errors. + * The files will be checked in list order. + */ + files: string[]; + + /** + * Delay in milliseconds to wait before starting to compute + * errors for the files in the file list + */ + delay: number; + } + + /** + * Geterr request; value of command field is "geterr". Wait for + * delay milliseconds and then, if during the wait no change or + * reload messages have arrived for the first file in the files + * list, get the syntactic errors for the file, field requests, + * and then get the semantic errors for the file. Repeat with a + * smaller delay for each subsequent file on the files list. Best + * practice for an editor is to send a file list containing each + * file that is currently visible, in most-recently-used order. + */ + export interface GeterrRequest extends Request { + arguments: GeterrRequestArgs; + } + + /** + * Item of diagnostic information found in a DiagnosticEvent message. + */ + export interface Diagnostic { + /** + * Starting file location at which text appies. + */ + start: Location; + + /** + * The last file location at which the text applies. + */ + end: Location; + + /** + * Text of diagnostic message. + */ + text: string; + } + + export interface DiagnosticEventBody { + /** + * The file for which diagnostic information is reported. + */ + file: string; + + /** + * An array of diagnostic information items. + */ + diagnostics: Diagnostic[]; + } + + /** + * Event message for "syntaxDiag" and "semanticDiag" event types. + * These events provide syntactic and semantic errors for a file. + */ + export interface DiagnosticEvent extends Event { + body?: DiagnosticEventBody; + } + + /** + * Arguments for reload request. + */ + export interface ReloadRequestArgs extends FileRequestArgs { + /** + * Name of temporary file from which to reload file + * contents. May be same as file. + */ + tmpfile: string; + } + + /** + * Reload request message; value of command field is "reload". + * Reload contents of file with name given by the 'file' argument + * from temporary file with name given by the 'tmpfile' argument. + * The two names can be identical. + */ + export interface ReloadRequest extends FileRequest { + arguments: ReloadRequestArgs; + } + + /** + * Response to "reload" request. This is just an acknowledgement, so + * no body field is required. + */ + export interface ReloadResponse extends Response { + } + + /** + * Arguments for saveto request. + */ + export interface SavetoRequestArgs extends FileRequestArgs { + /** + * Name of temporary file into which to save server's view of + * file contents. + */ + tmpfile: string; + } + + /** + * Saveto request message; value of command field is "saveto". + * For debugging purposes, save to a temporaryfile (named by + * argument 'tmpfile') the contents of file named by argument + * 'file'. The server does not currently send a response to a + * "saveto" request. + */ + export interface SavetoRequest extends FileRequest { + arguments: SavetoRequestArgs; + } + + /** + * Arguments for navto request message. + */ + export interface NavtoRequestArgs extends FileRequestArgs { + /** + * Search term to navigate to from current location; term can + * be '.*' or an identifier prefix. + */ + searchTerm: string; + } + + /** + * Navto request message; value of command field is "navto". + * Return list of objects giving file locations and symbols that + * match the search term given in argument 'searchTerm'. The + * context for the search is given by the named file. + */ + export interface NavtoRequest extends FileRequest { + arguments: NavtoRequestArgs; + } + + /** + * An item found in a navto response. + */ + export interface NavtoItem { + /** + * The symbol's name. + */ + name: string; + + /** + * The symbol's kind (such as 'className' or 'parameterName'). + */ + kind: string; + + /** + * exact, substring, or prefix. + */ + matchKind?: string; + + /** + * Optional modifiers for the kind (such as 'public'). + */ + kindModifiers?: string; + + /** + * The file in which the symbol is found. + */ + file: string; + + /** + * The location within file at which the symbol is found. + */ + start: Location; + + /** + * One past the last character of the symbol. + */ + end: Location; + + /** + * Name of symbol's container symbol (if any); for example, + * the class name if symbol is a class member. + */ + containerName?: string; + + /** + * Kind of symbol's container symbol (if any). + */ + containerKind?: string; + } + + /** + * Navto response message. Body is an array of navto items. Each + * item gives a symbol that matched the search term. + */ + export interface NavtoResponse extends Response { + body?: NavtoItem[]; + } + + /** + * Arguments for change request message. + */ + export interface ChangeRequestArgs extends FormatRequestArgs { + /** + * Optional string to insert at location (file, line, col). + */ + insertString?: string; + } + + /** + * Change request message; value of command field is "change". + * Update the server's view of the file named by argument 'file'. + * Server does not currently send a response to a change request. + */ + export interface ChangeRequest extends FileLocationRequest { + arguments: ChangeRequestArgs; + } + + /** + * Response to "brace" request. + */ + export interface BraceResponse extends Response { + body?: TextSpan[]; + } + + /** + * Brace matching request; value of command field is "brace". + * Return response giving the file locations of matching braces + * found in file at location line, col. + */ + export interface BraceRequest extends FileLocationRequest { + } + + /** + * NavBar itesm request; value of command field is "navbar". + * Return response giving the list of navigation bar entries + * extracted from the requested file. + */ + export interface NavBarRequest extends FileRequest { + } + + export interface NavigationBarItem { + /** + * The item's display text. + */ + text: string; + + /** + * The symbol's kind (such as 'className' or 'parameterName'). + */ + kind: string; + + /** + * Optional modifiers for the kind (such as 'public'). + */ + kindModifiers?: string; + + /** + * The definition locations of the item. + */ + spans: TextSpan[]; + + /** + * Optional children. + */ + childItems?: NavigationBarItem[]; + } + + export interface NavBarResponse extends Response { + body?: NavigationBarItem[]; + } +} diff --git a/src/server/server.ts b/src/server/server.ts new file mode 100644 index 00000000000..8921a4b4768 --- /dev/null +++ b/src/server/server.ts @@ -0,0 +1,219 @@ +/// +/// + +module ts.server { + var nodeproto: typeof NodeJS._debugger = require('_debugger'); + var readline: NodeJS.ReadLine = require('readline'); + var path: NodeJS.Path = require('path'); + var fs: typeof NodeJS.fs = require('fs'); + + var rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, + terminal: false, + }); + + class Logger implements ts.server.Logger { + fd = -1; + seq = 0; + inGroup = false; + firstInGroup = true; + + constructor(public logFilename: string) { + } + + static padStringRight(str: string, padding: string) { + return (str + padding).slice(0, padding.length); + } + + close() { + if (this.fd >= 0) { + fs.close(this.fd); + } + } + + perftrc(s: string) { + this.msg(s, "Perf"); + } + + info(s: string) { + this.msg(s, "Info"); + } + + startGroup() { + this.inGroup = true; + this.firstInGroup = true; + } + + endGroup() { + this.inGroup = false; + this.seq++; + this.firstInGroup = true; + } + + msg(s: string, type = "Err") { + if (this.fd < 0) { + this.fd = fs.openSync(this.logFilename, "w"); + } + if (this.fd >= 0) { + s = s + "\n"; + var prefix = Logger.padStringRight(type + " " + this.seq.toString(), " "); + if (this.firstInGroup) { + s = prefix + s; + this.firstInGroup = false; + } + if (!this.inGroup) { + this.seq++; + this.firstInGroup = true; + } + var buf = new Buffer(s); + fs.writeSync(this.fd, buf, 0, buf.length, null); + } + } + } + + interface WatchedFile { + fileName: string; + callback: (fileName: string) => void; + mtime: Date; + } + + class WatchedFileSet { + private watchedFiles: WatchedFile[] = []; + private nextFileToCheck = 0; + private watchTimer: NodeJS.Timer; + private static fileDeleted = 34; + + // average async stat takes about 30 microseconds + // set chunk size to do 30 files in < 1 millisecond + constructor(public interval = 2500, public chunkSize = 30) { + } + + private static copyListRemovingItem(item: T, list: T[]) { + var copiedList: T[] = []; + for (var i = 0, len = list.length; i < len; i++) { + if (list[i] != item) { + copiedList.push(list[i]); + } + } + return copiedList; + } + + private static getModifiedTime(fileName: string): Date { + return fs.statSync(fileName).mtime; + } + + private poll(checkedIndex: number) { + var watchedFile = this.watchedFiles[checkedIndex]; + if (!watchedFile) { + return; + } + + fs.stat(watchedFile.fileName,(err, stats) => { + if (err) { + var msg = err.message; + if (err.errno) { + msg += " errno: " + err.errno.toString(); + } + if (err.errno == WatchedFileSet.fileDeleted) { + watchedFile.callback(watchedFile.fileName); + } + } + else if (watchedFile.mtime.getTime() != stats.mtime.getTime()) { + watchedFile.mtime = WatchedFileSet.getModifiedTime(watchedFile.fileName); + watchedFile.callback(watchedFile.fileName); + } + }); + } + + // this implementation uses polling and + // stat due to inconsistencies of fs.watch + // and efficiency of stat on modern filesystems + private startWatchTimer() { + this.watchTimer = setInterval(() => { + var count = 0; + var nextToCheck = this.nextFileToCheck; + var firstCheck = -1; + while ((count < this.chunkSize) && (nextToCheck != firstCheck)) { + this.poll(nextToCheck); + if (firstCheck < 0) { + firstCheck = nextToCheck; + } + nextToCheck++; + if (nextToCheck === this.watchedFiles.length) { + nextToCheck = 0; + } + count++; + } + this.nextFileToCheck = nextToCheck; + }, this.interval); + } + + addFile(fileName: string, callback: (fileName: string) => void ): WatchedFile { + var file: WatchedFile = { + fileName, + callback, + mtime: WatchedFileSet.getModifiedTime(fileName) + }; + + this.watchedFiles.push(file); + if (this.watchedFiles.length === 1) { + this.startWatchTimer(); + } + return file; + } + + removeFile(file: WatchedFile) { + this.watchedFiles = WatchedFileSet.copyListRemovingItem(file, this.watchedFiles); + } + } + + class IOSession extends Session { + constructor(host: ServerHost, logger: ts.server.Logger) { + super(host, logger); + } + + listen() { + rl.on('line',(input: string) => { + var message = input.trim(); + this.onMessage(message); + }); + + rl.on('close',() => { + this.projectService.closeLog(); + this.projectService.log("Exiting..."); + process.exit(0); + }); + } + } + + // This places log file in the directory containing editorServices.js + // TODO: check that this location is writable + var logger = new Logger(__dirname + "/.log" + process.pid.toString()); + + + // REVIEW: for now this implementation uses polling. + // The advantage of polling is that it works reliably + // on all os and with network mounted files. + // For 90 referenced files, the average time to detect + // changes is 2*msInterval (by default 5 seconds). + // The overhead of this is .04 percent (1/2500) with + // average pause of < 1 millisecond (and max + // pause less than 1.5 milliseconds); question is + // do we anticipate reference sets in the 100s and + // do we care about waiting 10-20 seconds to detect + // changes for large reference sets? If so, do we want + // to increase the chunk size or decrease the interval + // time dynamically to match the large reference set? + var watchedFileSet = new WatchedFileSet(); + ts.sys.watchFile = function (fileName, callback) { + var watchedFile = watchedFileSet.addFile(fileName, callback); + return { + close: () => watchedFileSet.removeFile(watchedFile) + } + + }; + + // Start listening + new IOSession(ts.sys, logger).listen(); +} \ No newline at end of file diff --git a/src/server/session.ts b/src/server/session.ts new file mode 100644 index 00000000000..19f6cd3645e --- /dev/null +++ b/src/server/session.ts @@ -0,0 +1,801 @@ +/// +/// +/// +/// +/// + +module ts.server { + var spaceCache = [" ", " ", " ", " "]; + + interface StackTraceError extends Error { + stack?: string; + } + + function generateSpaces(n: number): string { + if (!spaceCache[n]) { + var strBuilder = ""; + for (var i = 0; i < n; i++) { + strBuilder += " "; + } + spaceCache[n] = strBuilder; + } + return spaceCache[n]; + } + + interface FileStart { + file: string; + start: ILineInfo; + } + + function compareNumber(a: number, b: number) { + if (a < b) { + return -1; + } + else if (a == b) { + return 0; + } + else return 1; + } + + function compareFileStart(a: FileStart, b: FileStart) { + if (a.file < b.file) { + return -1; + } + else if (a.file == b.file) { + var n = compareNumber(a.start.line, b.start.line); + if (n == 0) { + return compareNumber(a.start.col, b.start.col); + } + else return n; + } + else { + return 1; + } + } + + function sortNavItems(items: ts.NavigateToItem[]) { + return items.sort((a, b) => { + if (a.matchKind < b.matchKind) { + return -1; + } + else if (a.matchKind == b.matchKind) { + var lowa = a.name.toLowerCase(); + var lowb = b.name.toLowerCase(); + if (lowa < lowb) { + return -1; + } + else if (lowa == lowb) { + return 0; + } + else { + return 1; + } + } + else { + return 1; + } + }) + } + + function formatDiag(fileName: string, project: Project, diag: ts.Diagnostic) { + return { + start: project.compilerService.host.positionToLineCol(fileName, diag.start), + end: project.compilerService.host.positionToLineCol(fileName, diag.start + diag.length), + text: ts.flattenDiagnosticMessageText(diag.messageText, "\n") + }; + } + + interface PendingErrorCheck { + fileName: string; + project: Project; + } + + function allEditsBeforePos(edits: ts.TextChange[], pos: number) { + for (var i = 0, len = edits.length; i < len; i++) { + if (ts.textSpanEnd(edits[i].span) >= pos) { + return false; + } + } + return true; + } + + export module CommandNames { + export var Change = "change"; + export var Close = "close"; + export var Completions = "completions"; + export var CompletionDetails = "completionEntryDetails"; + export var Definition = "definition"; + export var Format = "format"; + export var Formatonkey = "formatonkey"; + export var Geterr = "geterr"; + export var NavBar = "navbar"; + export var Navto = "navto"; + export var Open = "open"; + export var Quickinfo = "quickinfo"; + export var References = "references"; + export var Reload = "reload"; + export var Rename = "rename"; + export var Saveto = "saveto"; + export var Brace = "brace"; + export var Unknown = "unknown"; + } + + module Errors { + export var NoProject = new Error("No Project."); + export var NoContent = new Error("No Content."); + } + + export interface ServerHost extends ts.System { + } + + export class Session { + projectService: ProjectService; + pendingOperation = false; + fileHash: ts.Map = {}; + nextFileId = 1; + errorTimer: NodeJS.Timer; + immediateId: any; + changeSeq = 0; + + constructor(private host: ServerHost, private logger: Logger) { + this.projectService = new ProjectService(host, logger); + } + + logError(err: Error, cmd: string) { + var typedErr = err; + var msg = "Exception on executing command " + cmd; + if (typedErr.message) { + msg += ":\n" + typedErr.message; + if (typedErr.stack) { + msg += "\n" + typedErr.stack; + } + } + this.projectService.log(msg); + } + + sendLineToClient(line: string) { + this.host.write(line + this.host.newLine); + } + + send(msg: NodeJS._debugger.Message) { + var json = JSON.stringify(msg); + this.sendLineToClient('Content-Length: ' + (1 + Buffer.byteLength(json, 'utf8')) + + '\r\n\r\n' + json); + } + + event(info: any, eventName: string) { + var ev: NodeJS._debugger.Event = { + seq: 0, + type: "event", + event: eventName, + body: info, + }; + this.send(ev); + } + + response(info: any, cmdName: string, reqSeq = 0, errorMsg?: string) { + var res: protocol.Response = { + seq: 0, + type: "response", + command: cmdName, + request_seq: reqSeq, + success: !errorMsg, + } + if (!errorMsg) { + res.body = info; + } + else { + res.message = errorMsg; + } + this.send(res); + } + + output(body: any, commandName: string, requestSequence = 0, errorMessage?: string) { + this.response(body, commandName, requestSequence, errorMessage); + } + + semanticCheck(file: string, project: Project) { + var diags = project.compilerService.languageService.getSemanticDiagnostics(file); + if (diags) { + var bakedDiags = diags.map((diag) => formatDiag(file, project, diag)); + this.event({ file: file, diagnostics: bakedDiags }, "semanticDiag"); + } + } + + syntacticCheck(file: string, project: Project) { + var diags = project.compilerService.languageService.getSyntacticDiagnostics(file); + if (diags) { + var bakedDiags = diags.map((diag) => formatDiag(file, project, diag)); + this.event({ file: file, diagnostics: bakedDiags }, "syntaxDiag"); + } + } + + errorCheck(file: string, project: Project) { + this.syntacticCheck(file, project); + this.semanticCheck(file, project); + } + + updateErrorCheck(checkList: PendingErrorCheck[], seq: number, + matchSeq: (seq: number) => boolean, ms = 1500, followMs = 200) { + if (followMs > ms) { + followMs = ms; + } + if (this.errorTimer) { + clearTimeout(this.errorTimer); + } + if (this.immediateId) { + clearImmediate(this.immediateId); + this.immediateId = undefined; + } + var index = 0; + var checkOne = () => { + if (matchSeq(seq)) { + var checkSpec = checkList[index++]; + if (checkSpec.project.getSourceFileFromName(checkSpec.fileName)) { + this.syntacticCheck(checkSpec.fileName, checkSpec.project); + this.immediateId = setImmediate(() => { + this.semanticCheck(checkSpec.fileName, checkSpec.project); + this.immediateId = undefined; + if (checkList.length > index) { + this.errorTimer = setTimeout(checkOne, followMs); + } + else { + this.errorTimer = undefined; + } + }); + } + } + } + if ((checkList.length > index) && (matchSeq(seq))) { + this.errorTimer = setTimeout(checkOne, ms); + } + } + + getDefinition(line: number, col: number, fileName: string): protocol.FileSpan[] { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + + var definitions = compilerService.languageService.getDefinitionAtPosition(file, position); + if (!definitions) { + throw Errors.NoContent; + } + + return definitions.map(def => ({ + file: def.fileName, + start: compilerService.host.positionToLineCol(def.fileName, def.textSpan.start), + end: compilerService.host.positionToLineCol(def.fileName, ts.textSpanEnd(def.textSpan)) + })); + } + + getRenameLocations(line: number, col: number, fileName: string,findInComments: boolean, findInStrings: boolean): protocol.RenameResponseBody { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + var renameInfo = compilerService.languageService.getRenameInfo(file, position); + if (!renameInfo) { + throw Errors.NoContent; + } + + if (!renameInfo.canRename) { + return { + info: renameInfo, + locs: [] + }; + } + + var renameLocations = compilerService.languageService.findRenameLocations(file, position, findInStrings, findInComments); + if (!renameLocations) { + throw Errors.NoContent; + } + + var bakedRenameLocs = renameLocations.map(location => ({ + file: location.fileName, + start: compilerService.host.positionToLineCol(location.fileName, location.textSpan.start), + end: compilerService.host.positionToLineCol(location.fileName, ts.textSpanEnd(location.textSpan)), + })).sort((a, b) => { + if (a.file < b.file) { + return -1; + } + else if (a.file > b.file) { + return 1; + } + else { + // reverse sort assuming no overlap + if (a.start.line < b.start.line) { + return 1; + } + else if (a.start.line > b.start.line) { + return -1; + } + else { + return b.start.col - a.start.col; + } + } + }).reduce((accum: protocol.SpanGroup[], cur: protocol.FileSpan) => { + var curFileAccum: protocol.SpanGroup; + if (accum.length > 0) { + curFileAccum = accum[accum.length - 1]; + if (curFileAccum.file != cur.file) { + curFileAccum = undefined; + } + } + if (!curFileAccum) { + curFileAccum = { file: cur.file, locs: [] }; + accum.push(curFileAccum); + } + curFileAccum.locs.push({ start: cur.start, end: cur.end }); + return accum; + }, []); + + return { info: renameInfo, locs: bakedRenameLocs }; + } + + getReferences(line: number, col: number, fileName: string): protocol.ReferencesResponseBody { + // TODO: get all projects for this file; report refs for all projects deleting duplicates + // can avoid duplicates by eliminating same ref file from subsequent projects + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + + var references = compilerService.languageService.getReferencesAtPosition(file, position); + if (!references) { + throw Errors.NoContent; + } + + var nameInfo = compilerService.languageService.getQuickInfoAtPosition(file, position); + if (!nameInfo) { + throw Errors.NoContent; + } + + var displayString = ts.displayPartsToString(nameInfo.displayParts); + var nameSpan = nameInfo.textSpan; + var nameColStart = compilerService.host.positionToLineCol(file, nameSpan.start).col; + var nameText = compilerService.host.getScriptSnapshot(file).getText(nameSpan.start, ts.textSpanEnd(nameSpan)); + var bakedRefs: protocol.ReferencesResponseItem[] = references.map((ref) => { + var start = compilerService.host.positionToLineCol(ref.fileName, ref.textSpan.start); + var refLineSpan = compilerService.host.lineToTextSpan(ref.fileName, start.line - 1); + var snap = compilerService.host.getScriptSnapshot(ref.fileName); + var lineText = snap.getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); + return { + file: ref.fileName, + start: start, + lineText: lineText, + end: compilerService.host.positionToLineCol(ref.fileName, ts.textSpanEnd(ref.textSpan)), + isWriteAccess: ref.isWriteAccess + }; + }).sort(compareFileStart); + return { + refs: bakedRefs, + symbolName: nameText, + symbolStartCol: nameColStart, + symbolDisplayString: displayString + }; + } + + openClientFile(fileName: string) { + var file = ts.normalizePath(fileName); + this.projectService.openClientFile(file); + } + + getQuickInfo(line: number, col: number, fileName: string): protocol.QuickInfoResponseBody { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + var quickInfo = compilerService.languageService.getQuickInfoAtPosition(file, position); + if (!quickInfo) { + throw Errors.NoContent; + } + + var displayString = ts.displayPartsToString(quickInfo.displayParts); + var docString = ts.displayPartsToString(quickInfo.documentation); + return { + kind: quickInfo.kind, + kindModifiers: quickInfo.kindModifiers, + start: compilerService.host.positionToLineCol(file, quickInfo.textSpan.start), + end: compilerService.host.positionToLineCol(file, ts.textSpanEnd(quickInfo.textSpan)), + displayString: displayString, + documentation: docString, + }; + } + + getFormattingEditsForRange(line: number, col: number, endLine: number, endCol: number, fileName: string): protocol.CodeEdit[] { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var startPosition = compilerService.host.lineColToPosition(file, line, col); + var endPosition = compilerService.host.lineColToPosition(file, endLine, endCol); + + // TODO: avoid duplicate code (with formatonkey) + var edits = compilerService.languageService.getFormattingEditsForRange(file, startPosition, endPosition, compilerService.formatCodeOptions); + if (!edits) { + throw Errors.NoContent; + } + + return edits.map((edit) => { + return { + start: compilerService.host.positionToLineCol(file, edit.span.start), + end: compilerService.host.positionToLineCol(file, ts.textSpanEnd(edit.span)), + newText: edit.newText ? edit.newText : "" + }; + }); + } + + getFormattingEditsAfterKeystroke(line: number, col: number, key: string, fileName: string): protocol.CodeEdit[] { + var file = ts.normalizePath(fileName); + + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + var edits = compilerService.languageService.getFormattingEditsAfterKeystroke(file, position, key, + compilerService.formatCodeOptions); + if ((key == "\n") && ((!edits) || (edits.length == 0) || allEditsBeforePos(edits, position))) { + // TODO: get these options from host + var editorOptions: ts.EditorOptions = { + IndentSize: 4, + TabSize: 4, + NewLineCharacter: "\n", + ConvertTabsToSpaces: true, + }; + var indentPosition = compilerService.languageService.getIndentationAtPosition(file, position, editorOptions); + var spaces = generateSpaces(indentPosition); + if (indentPosition > 0) { + edits.push({ span: ts.createTextSpanFromBounds(position, position), newText: spaces }); + } + } + + if (!edits) { + throw Errors.NoContent; + } + + return edits.map((edit) => { + return { + start: compilerService.host.positionToLineCol(file, + edit.span.start), + end: compilerService.host.positionToLineCol(file, + ts.textSpanEnd(edit.span)), + newText: edit.newText ? edit.newText : "" + }; + }); + } + + getCompletions(line: number, col: number, prefix: string, fileName: string): protocol.CompletionEntry[] { + if (!prefix) { + prefix = ""; + } + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + + var completions = compilerService.languageService.getCompletionsAtPosition(file, position); + if (!completions) { + throw Errors.NoContent; + } + + return completions.entries.reduce((result: protocol.CompletionEntry[], entry: ts.CompletionEntry) => { + if (completions.isMemberCompletion || entry.name.indexOf(prefix) == 0) { + result.push(entry); + } + return result; + }, []); + } + + getCompletionEntryDetails(line: number, col: number, + entryNames: string[], fileName: string): protocol.CompletionEntryDetails[] { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + + return entryNames.reduce((accum: protocol.CompletionEntryDetails[], entryName: string) => { + var details = compilerService.languageService.getCompletionEntryDetails(file, position, entryName); + if (details) { + accum.push(details); + } + return accum; + }, []); + } + + getDiagnostics(delay: number, fileNames: string[]) { + var checkList = fileNames.reduce((accum: PendingErrorCheck[], fileName: string) => { + fileName = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(fileName); + if (project) { + accum.push({ fileName, project }); + } + return accum; + }, []); + + if (checkList.length > 0) { + this.updateErrorCheck(checkList, this.changeSeq,(n) => n == this.changeSeq, delay) + } + } + + change(line: number, col: number, endLine: number, endCol: number, insertString: string, fileName: string) { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (project) { + var compilerService = project.compilerService; + var start = compilerService.host.lineColToPosition(file, line, col); + var end = compilerService.host.lineColToPosition(file, endLine, endCol); + if (start >= 0) { + compilerService.host.editScript(file, start, end, insertString); + this.changeSeq++; + } + } + } + + reload(fileName: string, tempFileName: string, reqSeq = 0) { + var file = ts.normalizePath(fileName); + var tmpfile = ts.normalizePath(tempFileName); + var project = this.projectService.getProjectForFile(file); + if (project) { + this.changeSeq++; + // make sure no changes happen before this one is finished + project.compilerService.host.reloadScript(file, tmpfile,() => { + this.output(undefined, CommandNames.Reload, reqSeq); + }); + } + } + + saveToTmp(fileName: string, tempFileName: string) { + var file = ts.normalizePath(fileName); + var tmpfile = ts.normalizePath(tempFileName); + + var project = this.projectService.getProjectForFile(file); + if (project) { + project.compilerService.host.saveTo(file, tmpfile); + } + } + + closeClientFile(fileName: string) { + var file = ts.normalizePath(fileName); + this.projectService.closeClientFile(file); + } + + decorateNavigationBarItem(project: Project, fileName: string, items: ts.NavigationBarItem[]): protocol.NavigationBarItem[] { + if (!items) { + return undefined; + } + + var compilerService = project.compilerService; + + return items.map(item => ({ + text: item.text, + kind: item.kind, + kindModifiers: item.kindModifiers, + spans: item.spans.map(span => ({ + start: compilerService.host.positionToLineCol(fileName, span.start), + end: compilerService.host.positionToLineCol(fileName, ts.textSpanEnd(span)) + })), + childItems: this.decorateNavigationBarItem(project, fileName, item.childItems) + })); + } + + getNavigationBarItems(fileName: string): protocol.NavigationBarItem[] { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var items = compilerService.languageService.getNavigationBarItems(file); + if (!items) { + throw Errors.NoContent; + } + + return this.decorateNavigationBarItem(project, fileName, items); + } + + getNavigateToItems(searchTerm: string, fileName: string): protocol.NavtoItem[] { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var navItems = sortNavItems(compilerService.languageService.getNavigateToItems(searchTerm)); + if (!navItems) { + throw Errors.NoContent; + } + + return navItems.map((navItem) => { + var start = compilerService.host.positionToLineCol(navItem.fileName, navItem.textSpan.start); + var end = compilerService.host.positionToLineCol(navItem.fileName, ts.textSpanEnd(navItem.textSpan)); + var bakedItem: protocol.NavtoItem = { + name: navItem.name, + kind: navItem.kind, + file: navItem.fileName, + start: start, + end: end, + }; + if (navItem.kindModifiers && (navItem.kindModifiers != "")) { + bakedItem.kindModifiers = navItem.kindModifiers; + } + if (navItem.matchKind != 'none') { + bakedItem.matchKind = navItem.matchKind; + } + if (navItem.containerName && (navItem.containerName.length > 0)) { + bakedItem.containerName = navItem.containerName; + } + if (navItem.containerKind && (navItem.containerKind.length > 0)) { + bakedItem.containerKind = navItem.containerKind; + } + return bakedItem; + }); + } + + getBraceMatching(line: number, col: number, fileName: string): protocol.TextSpan[] { + var file = ts.normalizePath(fileName); + + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + + var spans = compilerService.languageService.getBraceMatchingAtPosition(file, position); + if (!spans) { + throw Errors.NoContent; + } + + return spans.map(span => ({ + start: compilerService.host.positionToLineCol(file, span.start), + end: compilerService.host.positionToLineCol(file, span.start + span.length) + })); + } + + onMessage(message: string) { + try { + var request = JSON.parse(message); + var response: any; + switch (request.command) { + case CommandNames.Definition: { + var defArgs = request.arguments; + response = this.getDefinition(defArgs.line, defArgs.col, defArgs.file); + break; + } + case CommandNames.References: { + var refArgs = request.arguments; + response = this.getReferences(refArgs.line, refArgs.col, refArgs.file); + break; + } + case CommandNames.Rename: { + var renameArgs = request.arguments; + response = this.getRenameLocations(renameArgs.line, renameArgs.col, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings); + break; + } + case CommandNames.Open: { + var openArgs = request.arguments; + this.openClientFile(openArgs.file); + break; + } + case CommandNames.Quickinfo: { + var quickinfoArgs = request.arguments; + response = this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.col, quickinfoArgs.file); + break; + } + case CommandNames.Format: { + var formatArgs = request.arguments; + response = this.getFormattingEditsForRange(formatArgs.line, formatArgs.col, formatArgs.endLine, formatArgs.endCol, formatArgs.file); + break; + } + case CommandNames.Formatonkey: { + var formatOnKeyArgs = request.arguments; + response = this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.col, formatOnKeyArgs.key, formatOnKeyArgs.file); + break; + } + case CommandNames.Completions: { + var completionsArgs = request.arguments; + response = this.getCompletions(request.arguments.line, request.arguments.col, completionsArgs.prefix, request.arguments.file); + break; + } + case CommandNames.CompletionDetails: { + var completionDetailsArgs = request.arguments; + response = this.getCompletionEntryDetails(request.arguments.line, request.arguments.col, completionDetailsArgs.entryNames, + request.arguments.file); + break; + } + case CommandNames.Geterr: { + var geterrArgs = request.arguments; + response = this.getDiagnostics(geterrArgs.delay, geterrArgs.files); + break; + } + case CommandNames.Change: { + var changeArgs = request.arguments; + this.change(changeArgs.line, changeArgs.col, changeArgs.endLine, changeArgs.endCol, + changeArgs.insertString, changeArgs.file); + break; + } + case CommandNames.Reload: { + var reloadArgs = request.arguments; + this.reload(reloadArgs.file, reloadArgs.tmpfile, request.seq); + break; + } + case CommandNames.Saveto: { + var savetoArgs = request.arguments; + this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile); + break; + } + case CommandNames.Close: { + var closeArgs = request.arguments; + this.closeClientFile(closeArgs.file); + break; + } + case CommandNames.Navto: { + var navtoArgs = request.arguments; + response = this.getNavigateToItems(navtoArgs.searchTerm, navtoArgs.file); + break; + } + case CommandNames.Brace: { + var braceArguments = request.arguments; + response = this.getBraceMatching(braceArguments.line, braceArguments.col, braceArguments.file); + break; + } + case CommandNames.NavBar: { + var navBarArgs = request.arguments; + response = this.getNavigationBarItems(navBarArgs.file); + break; + } + default: { + this.projectService.log("Unrecognized JSON command: " + message); + this.output(undefined, CommandNames.Unknown, request.seq, "Unrecognized JSON command: " + request.command); + break; + } + } + + if (response) { + this.output(response, request.command, request.seq); + } + + } catch (err) { + if (err instanceof OperationCanceledException) { + // Handle cancellation exceptions + } + this.logError(err, message); + this.output(undefined, request ? request.command : CommandNames.Unknown, request ? request.seq : 0, "Error processing request. " + err.message); + } + } + } +} diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index e9f580be3bc..a4943705e72 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -14,17 +14,17 @@ module ts.BreakpointResolver { } var tokenAtLocation = getTokenAtPosition(sourceFile, position); - var lineOfPosition = sourceFile.getLineAndCharacterFromPosition(position).line; - if (sourceFile.getLineAndCharacterFromPosition(tokenAtLocation.getStart()).line > lineOfPosition) { + var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line; + if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart()).line > lineOfPosition) { // Get previous token if the token is returned starts on new line - // eg: var x =10; |--- curser is here + // eg: var x =10; |--- cursor is here // var y = 10; // token at position will return var keyword on second line as the token but we would like to use // token on same line if trailing trivia (comments or white spaces on same line) part of the last token on that line tokenAtLocation = findPrecedingToken(tokenAtLocation.pos, sourceFile); // Its a blank line - if (!tokenAtLocation || sourceFile.getLineAndCharacterFromPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { + if (!tokenAtLocation || sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { return undefined; } } @@ -42,7 +42,7 @@ module ts.BreakpointResolver { } function spanInNodeIfStartsOnSameLine(node: Node, otherwiseOnNode?: Node): TextSpan { - if (node && lineOfPosition === sourceFile.getLineAndCharacterFromPosition(node.getStart()).line) { + if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart()).line) { return spanInNode(node); } return spanInNode(otherwiseOnNode); @@ -69,7 +69,7 @@ module ts.BreakpointResolver { return textSpan(node); } - if (node.parent.kind === SyntaxKind.BinaryExpression && (node.parent).operator === SyntaxKind.CommaToken) { + if (node.parent.kind === SyntaxKind.BinaryExpression && (node.parent).operatorToken.kind === SyntaxKind.CommaToken) { // if this is comma expression, the breakpoint is possible in this expression return textSpan(node); } @@ -151,8 +151,9 @@ module ts.BreakpointResolver { return spanInForStatement(node); case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: // span on for (a in ...) - return textSpan(node, findNextToken((node).expression, node)); + return textSpan(node, findNextToken((node).expression, node)); case SyntaxKind.SwitchStatement: // span on switch(...) @@ -261,7 +262,8 @@ module ts.BreakpointResolver { function spanInVariableDeclaration(variableDeclaration: VariableDeclaration): TextSpan { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === SyntaxKind.ForInStatement) { + if (variableDeclaration.parent.parent.kind === SyntaxKind.ForInStatement || + variableDeclaration.parent.parent.kind === SyntaxKind.ForOfStatement) { return spanInNode(variableDeclaration.parent.parent); } @@ -362,6 +364,7 @@ module ts.BreakpointResolver { case SyntaxKind.WhileStatement: case SyntaxKind.IfStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.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 diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 969f7260744..180ff0c9e95 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -67,8 +67,8 @@ module ts.formatting { } export function formatOnEnter(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeOptions): TextChange[] { - var line = sourceFile.getLineAndCharacterFromPosition(position).line; - if (line === 1) { + var line = sourceFile.getLineAndCharacterOfPosition(position).line; + if (line === 0) { return []; } // get the span for the previous\current line @@ -100,7 +100,7 @@ module ts.formatting { export function formatSelection(start: number, end: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeOptions): TextChange[] { // format from the beginning of the line var span = { - pos: getStartLinePositionForPosition(start, sourceFile), + pos: getLineStartPositionForPosition(start, sourceFile), end: end }; return formatSpan(span, sourceFile, options, rulesProvider, FormattingRequestKind.FormatSelection); @@ -112,7 +112,7 @@ module ts.formatting { return []; } var span = { - pos: getStartLinePositionForPosition(parent.getStart(sourceFile), sourceFile), + pos: getLineStartPositionForPosition(parent.getStart(sourceFile), sourceFile), end: parent.end }; return formatSpan(span, sourceFile, options, rulesProvider, requestKind); @@ -283,7 +283,7 @@ module ts.formatting { var previousLine = Constants.Unknown; var childKind = SyntaxKind.Unknown; while (n) { - var line = sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)).line; + var line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line; if (previousLine !== Constants.Unknown && line !== previousLine) { break; } @@ -327,7 +327,7 @@ module ts.formatting { formattingScanner.advance(); if (formattingScanner.isOnToken()) { - var startLine = sourceFile.getLineAndCharacterFromPosition(enclosingNode.getStart(sourceFile)).line; + var startLine = sourceFile.getLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line; var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile); processNode(enclosingNode, enclosingNode, startLine, initialIndentation, delta); } @@ -357,8 +357,8 @@ module ts.formatting { } } else { - var startLine = sourceFile.getLineAndCharacterFromPosition(startPos).line; - var startLinePosition = getStartLinePositionForPosition(startPos, sourceFile); + var startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line; + var startLinePosition = getLineStartPositionForPosition(startPos, sourceFile); var column = SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options); if (startLine !== parentStartLine || startPos === column) { return column @@ -521,7 +521,7 @@ module ts.formatting { var childStartPos = child.getStart(sourceFile); - var childStart = sourceFile.getLineAndCharacterFromPosition(childStartPos); + var childStart = sourceFile.getLineAndCharacterOfPosition(childStartPos); // if child is a list item - try to get its indentation var childIndentationAmount = Constants.Unknown; @@ -594,7 +594,7 @@ module ts.formatting { } else if (tokenInfo.token.kind === listStartToken) { // consume list start token - startLine = sourceFile.getLineAndCharacterFromPosition(tokenInfo.token.pos).line; + startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; var indentation = computeIndentation(tokenInfo.token, startLine, Constants.Unknown, parent, parentDynamicIndentation, startLine); @@ -641,7 +641,7 @@ module ts.formatting { var lineAdded: boolean; var isTokenInRange = rangeContainsRange(originalRange, currentTokenInfo.token); - var tokenStart = sourceFile.getLineAndCharacterFromPosition(currentTokenInfo.token.pos); + var tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos); if (isTokenInRange) { var rangeHasError = rangeContainsError(currentTokenInfo.token); // save prevStartLine since processRange will overwrite this value with current ones @@ -674,7 +674,7 @@ module ts.formatting { continue; } - var triviaStartLine = sourceFile.getLineAndCharacterFromPosition(triviaItem.pos).line; + var triviaStartLine = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos).line; switch (triviaItem.kind) { case SyntaxKind.MultiLineCommentTrivia: var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); @@ -712,7 +712,7 @@ module ts.formatting { for (var i = 0, len = trivia.length; i < len; ++i) { var triviaItem = trivia[i]; if (isComment(triviaItem.kind) && rangeContainsRange(originalRange, triviaItem)) { - var triviaItemStart = sourceFile.getLineAndCharacterFromPosition(triviaItem.pos); + var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation); } } @@ -729,7 +729,7 @@ module ts.formatting { if (!rangeHasError && !previousRangeHasError) { if (!previousRange) { // trim whitespaces starting from the beginning of the span up to the current line - var originalStart = sourceFile.getLineAndCharacterFromPosition(originalRange.pos); + var originalStart = sourceFile.getLineAndCharacterOfPosition(originalRange.pos); trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); } else { @@ -807,18 +807,18 @@ module ts.formatting { recordReplace(pos, 0, indentationString); } else { - var tokenStart = sourceFile.getLineAndCharacterFromPosition(pos); - if (indentation !== tokenStart.character - 1) { + var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos); + if (indentation !== tokenStart.character) { var startLinePosition = getStartPositionOfLine(tokenStart.line, sourceFile); - recordReplace(startLinePosition, tokenStart.character - 1, indentationString); + recordReplace(startLinePosition, tokenStart.character, indentationString); } } } function indentMultilineComment(commentRange: TextRange, indentation: number, firstLineIsIndented: boolean) { // split comment in lines - var startLine = sourceFile.getLineAndCharacterFromPosition(commentRange.pos).line; - var endLine = sourceFile.getLineAndCharacterFromPosition(commentRange.end).line; + var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; + var endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line; if (startLine === endLine) { if (!firstLineIsIndented) { diff --git a/src/services/formatting/formattingContext.ts b/src/services/formatting/formattingContext.ts index 2bfb155921e..b7573526f78 100644 --- a/src/services/formatting/formattingContext.ts +++ b/src/services/formatting/formattingContext.ts @@ -71,8 +71,8 @@ module ts.formatting { public TokensAreOnSameLine(): boolean { if (this.tokensAreOnSameLine === undefined) { - var startLine = this.sourceFile.getLineAndCharacterFromPosition(this.currentTokenSpan.pos).line; - var endLine = this.sourceFile.getLineAndCharacterFromPosition(this.nextTokenSpan.pos).line; + var startLine = this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(this.nextTokenSpan.pos).line; this.tokensAreOnSameLine = (startLine == endLine); } @@ -96,8 +96,8 @@ module ts.formatting { } private NodeIsOnOneLine(node: Node): boolean { - var startLine = this.sourceFile.getLineAndCharacterFromPosition(node.getStart(this.sourceFile)).line; - var endLine = this.sourceFile.getLineAndCharacterFromPosition(node.getEnd()).line; + var startLine = this.sourceFile.getLineAndCharacterOfPosition(node.getStart(this.sourceFile)).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(node.getEnd()).line; return startLine == endLine; } @@ -105,8 +105,8 @@ module ts.formatting { var openBrace = findChildOfKind(node, SyntaxKind.OpenBraceToken, this.sourceFile); var closeBrace = findChildOfKind(node, SyntaxKind.CloseBraceToken, this.sourceFile); if (openBrace && closeBrace) { - var startLine = this.sourceFile.getLineAndCharacterFromPosition(openBrace.getEnd()).line; - var endLine = this.sourceFile.getLineAndCharacterFromPosition(closeBrace.getStart(this.sourceFile)).line; + var startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line; return startLine === endLine; } return false; diff --git a/src/services/formatting/formattingScanner.ts b/src/services/formatting/formattingScanner.ts index e9485158aba..962f142f609 100644 --- a/src/services/formatting/formattingScanner.ts +++ b/src/services/formatting/formattingScanner.ts @@ -93,17 +93,16 @@ module ts.formatting { savedPos = scanner.getStartPos(); } - function shouldRescanGreaterThanToken(container: Node): boolean { - if (container.kind !== SyntaxKind.BinaryExpression) { - return false; - } - switch ((container).operator) { - case SyntaxKind.GreaterThanEqualsToken: - case SyntaxKind.GreaterThanGreaterThanEqualsToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: - case SyntaxKind.GreaterThanGreaterThanToken: - return true; + function shouldRescanGreaterThanToken(node: Node): boolean { + if (node) { + switch (node.kind) { + case SyntaxKind.GreaterThanEqualsToken: + case SyntaxKind.GreaterThanGreaterThanEqualsToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case SyntaxKind.GreaterThanGreaterThanToken: + return true; + } } return false; @@ -164,7 +163,7 @@ module ts.formatting { if (expectedScanAction === ScanAction.RescanGreaterThanToken && currentToken === SyntaxKind.GreaterThanToken) { currentToken = scanner.reScanGreaterToken(); - Debug.assert((n).operator === currentToken); + Debug.assert(n.kind === currentToken); lastScanAction = ScanAction.RescanGreaterThanToken; } else if (expectedScanAction === ScanAction.RescanSlashToken && startsWithSlashToken(currentToken)) { diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 81325452135..e64e29d2808 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -464,6 +464,9 @@ module ts.formatting { // "in" keyword in for (var x in []) { } case SyntaxKind.ForInStatement: return context.currentTokenSpan.kind === SyntaxKind.InKeyword || context.nextTokenSpan.kind === SyntaxKind.InKeyword; + // Technically, "of" is not a binary operator, but format it the same way as "in" + case SyntaxKind.ForOfStatement: + return context.currentTokenSpan.kind === SyntaxKind.OfKeyword || context.nextTokenSpan.kind === SyntaxKind.OfKeyword; } return false; } @@ -592,6 +595,7 @@ module ts.formatting { case SyntaxKind.SwitchStatement: case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.WhileStatement: case SyntaxKind.TryStatement: case SyntaxKind.DoStatement: diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 3aa97fe6ae6..04849420e70 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -24,7 +24,7 @@ module ts.formatting { return 0; } - var lineAtPosition = sourceFile.getLineAndCharacterFromPosition(position).line; + var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; if (precedingToken.kind === SyntaxKind.CommaToken && precedingToken.parent.kind !== SyntaxKind.BinaryExpression) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it @@ -74,7 +74,7 @@ module ts.formatting { } export function getIndentationForNode(n: Node, ignoreActualIndentationRange: TextRange, sourceFile: SourceFile, options: FormatCodeOptions): number { - var start = sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)); + var start = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, /*indentationDelta*/ 0, sourceFile, options); } @@ -135,10 +135,10 @@ module ts.formatting { function getParentStart(parent: Node, child: Node, sourceFile: SourceFile): LineAndCharacter { var containingList = getContainingList(child, sourceFile); if (containingList) { - return sourceFile.getLineAndCharacterFromPosition(containingList.pos); + return sourceFile.getLineAndCharacterOfPosition(containingList.pos); } - return sourceFile.getLineAndCharacterFromPosition(parent.getStart(sourceFile)); + return sourceFile.getLineAndCharacterOfPosition(parent.getStart(sourceFile)); } /* @@ -204,7 +204,7 @@ module ts.formatting { } function getStartLineAndCharacterForNode(n: Node, sourceFile: SourceFile): LineAndCharacter { - return sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)); + return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function positionBelongsToNode(candidate: Node, position: number, sourceFile: SourceFile): boolean { @@ -279,7 +279,6 @@ module ts.formatting { } } - function deriveActualIndentationFromList(list: Node[], index: number, sourceFile: SourceFile, options: EditorOptions): number { Debug.assert(index >= 0 && index < list.length); var node = list[index]; @@ -292,7 +291,7 @@ module ts.formatting { continue; } // skip list items that ends on the same line with the current list element - var prevEndLine = sourceFile.getLineAndCharacterFromPosition(list[i].end).line; + var prevEndLine = sourceFile.getLineAndCharacterOfPosition(list[i].end).line; if (prevEndLine !== lineAndCharacter.line) { return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options); } @@ -303,7 +302,7 @@ module ts.formatting { } function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter: LineAndCharacter, sourceFile: SourceFile, options: EditorOptions): number { - var lineStart = sourceFile.getPositionFromLineAndCharacter(lineAndCharacter.line, 1); + var lineStart = sourceFile.getPositionOfLineAndCharacter(lineAndCharacter.line, 0); return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options); } @@ -359,6 +358,7 @@ module ts.formatting { case SyntaxKind.DoStatement: case SyntaxKind.WhileStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.ForStatement: case SyntaxKind.IfStatement: case SyntaxKind.FunctionDeclaration: diff --git a/src/services/formatting/tokenRange.ts b/src/services/formatting/tokenRange.ts index 61fcb26dc9b..ff9cb91ce68 100644 --- a/src/services/formatting/tokenRange.ts +++ b/src/services/formatting/tokenRange.ts @@ -126,7 +126,7 @@ module ts.formatting { static AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([SyntaxKind.MultiLineCommentTrivia])); static Keywords = TokenRange.FromRange(SyntaxKind.FirstKeyword, SyntaxKind.LastKeyword); static BinaryOperators = TokenRange.FromRange(SyntaxKind.FirstBinaryOperator, SyntaxKind.LastBinaryOperator); - static BinaryKeywordOperators = TokenRange.FromTokens([SyntaxKind.InKeyword, SyntaxKind.InstanceOfKeyword]); + static BinaryKeywordOperators = TokenRange.FromTokens([SyntaxKind.InKeyword, SyntaxKind.InstanceOfKeyword, SyntaxKind.OfKeyword]); static UnaryPrefixOperators = TokenRange.FromTokens([SyntaxKind.PlusPlusToken, SyntaxKind.MinusMinusToken, SyntaxKind.TildeToken, SyntaxKind.ExclamationToken]); static UnaryPrefixExpressions = TokenRange.FromTokens([SyntaxKind.NumericLiteral, SyntaxKind.Identifier, SyntaxKind.OpenParenToken, SyntaxKind.OpenBracketToken, SyntaxKind.OpenBraceToken, SyntaxKind.ThisKeyword, SyntaxKind.NewKeyword]); static UnaryPreincrementExpressions = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.OpenParenToken, SyntaxKind.ThisKeyword, SyntaxKind.NewKeyword]); @@ -134,7 +134,7 @@ module ts.formatting { static UnaryPredecrementExpressions = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.OpenParenToken, SyntaxKind.ThisKeyword, SyntaxKind.NewKeyword]); static UnaryPostdecrementExpressions = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.CloseParenToken, SyntaxKind.CloseBracketToken, SyntaxKind.NewKeyword]); static Comments = TokenRange.FromTokens([SyntaxKind.SingleLineCommentTrivia, SyntaxKind.MultiLineCommentTrivia]); - static TypeNames = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.NumberKeyword, SyntaxKind.StringKeyword, SyntaxKind.BooleanKeyword, SyntaxKind.VoidKeyword, SyntaxKind.AnyKeyword]); + static TypeNames = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.NumberKeyword, SyntaxKind.StringKeyword, SyntaxKind.BooleanKeyword, SyntaxKind.SymbolKeyword, SyntaxKind.VoidKeyword, SyntaxKind.AnyKeyword]); } } } \ No newline at end of file diff --git a/src/services/navigateTo.ts b/src/services/navigateTo.ts new file mode 100644 index 00000000000..d008cac80f7 --- /dev/null +++ b/src/services/navigateTo.ts @@ -0,0 +1,117 @@ +module ts.NavigateTo { + type RawNavigateToItem = { name: string; fileName: string; matchKind: MatchKind; declaration: Declaration }; + + enum MatchKind { + none = 0, + exact = 1, + substring = 2, + prefix = 3 + } + + export function getNavigateToItems(program: Program, cancellationToken: CancellationTokenObject, searchValue: string, maxResultCount: number): NavigateToItem[]{ + // Split search value in terms array + var terms = searchValue.split(" "); + + // default NavigateTo approach: if search term contains only lower-case chars - use case-insensitive search, otherwise switch to case-sensitive version + var searchTerms = map(terms, t => ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t })); + + var rawItems: RawNavigateToItem[] = []; + + // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] + forEach(program.getSourceFiles(), sourceFile => { + cancellationToken.throwIfCancellationRequested(); + + var fileName = sourceFile.fileName; + var declarations = sourceFile.getNamedDeclarations(); + for (var i = 0, n = declarations.length; i < n; i++) { + var declaration = declarations[i]; + // TODO(jfreeman): Skip this declaration if it has a computed name + var name = (declaration.name).text; + var matchKind = getMatchKind(searchTerms, name); + if (matchKind !== MatchKind.none) { + rawItems.push({ name, fileName, matchKind, declaration }); + } + } + }); + + rawItems.sort(compareNavigateToItems); + if (maxResultCount !== undefined) { + rawItems = rawItems.slice(0, maxResultCount); + } + + var items = map(rawItems, createNavigateToItem); + + return items; + + // This means "compare in a case insensitive manner." + var baseSensitivity: Intl.CollatorOptions = { sensitivity: "base" }; + function compareNavigateToItems(i1: RawNavigateToItem, i2: RawNavigateToItem) { + // TODO(cyrusn): get the gamut of comparisons that VS already uses here. + // Right now we just sort by kind first, and then by name of the item. + // We first sort case insensitively. So "Aaa" will come before "bar". + // Then we sort case sensitively, so "aaa" will come before "Aaa". + return i1.matchKind - i2.matchKind || + i1.name.localeCompare(i2.name, undefined, baseSensitivity) || + i1.name.localeCompare(i2.name); + } + + function createNavigateToItem(rawItem: RawNavigateToItem): NavigateToItem { + var declaration = rawItem.declaration; + var container = getContainerNode(declaration); + return { + name: rawItem.name, + kind: getNodeKind(declaration), + kindModifiers: getNodeModifiers(declaration), + matchKind: MatchKind[rawItem.matchKind], + fileName: rawItem.fileName, + textSpan: createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), + // TODO(jfreeman): What should be the containerName when the container has a computed name? + containerName: container && container.name ? (container.name).text : "", + containerKind: container && container.name ? getNodeKind(container) : "" + }; + } + + function hasAnyUpperCaseCharacter(s: string): boolean { + for (var i = 0, n = s.length; i < n; i++) { + var c = s.charCodeAt(i); + if ((CharacterCodes.A <= c && c <= CharacterCodes.Z) || + (c >= CharacterCodes.maxAsciiCharacter && s.charAt(i).toLocaleLowerCase() !== s.charAt(i))) { + return true; + } + } + + return false; + } + + function getMatchKind(searchTerms: { caseSensitive: boolean; term: string }[], name: string): MatchKind { + var matchKind = MatchKind.none; + + if (name) { + for (var j = 0, n = searchTerms.length; j < n; j++) { + var searchTerm = searchTerms[j]; + var nameToSearch = searchTerm.caseSensitive ? name : name.toLocaleLowerCase(); + // in case of case-insensitive search searchTerm.term will already be lower-cased + var index = nameToSearch.indexOf(searchTerm.term); + if (index < 0) { + // Didn't match. + return MatchKind.none; + } + + var termKind = MatchKind.substring; + if (index === 0) { + // here we know that match occur at the beginning of the string. + // if search term and declName has the same length - we have an exact match, otherwise declName have longer length and this will be prefix match + termKind = name.length === searchTerm.term.length ? MatchKind.exact : MatchKind.prefix; + } + + // Update our match kind if we don't have one, or if this match is better. + if (matchKind === MatchKind.none || termKind < matchKind) { + matchKind = termKind; + } + } + } + + return matchKind; + } + } +} \ No newline at end of file diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 771fe48219f..b254397f8b0 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -97,8 +97,7 @@ module ts.NavigationBar { function sortNodes(nodes: Node[]): Node[] { return nodes.slice(0).sort((n1: Declaration, n2: Declaration) => { if (n1.name && n2.name) { - // TODO(jfreeman): How do we sort declarations with computed names? - return (n1.name).text.localeCompare((n2.name).text); + return getPropertyNameForPropertyNameNode(n1.name).localeCompare(getPropertyNameForPropertyNameNode(n2.name)); } else if (n1.name) { return 1; @@ -426,7 +425,7 @@ module ts.NavigationBar { // Add the constructor parameters in as children of the class (for property parameters). // Note that *all* parameters will be added to the nodes array, but parameters that // are not properties will be filtered out later by createChildItem. - var nodes: Node[] = removeComputedProperties(node); + var nodes: Node[] = removeDynamicallyNamedProperties(node); if (constructor) { nodes.push.apply(nodes, constructor.parameters); } @@ -455,7 +454,7 @@ module ts.NavigationBar { } function createIterfaceItem(node: InterfaceDeclaration): ts.NavigationBarItem { - var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); + var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); return getNavigationBarItem( node.name.text, ts.ScriptElementKind.interfaceElement, @@ -466,10 +465,17 @@ module ts.NavigationBar { } } - function removeComputedProperties(node: ClassDeclaration | InterfaceDeclaration | EnumDeclaration): Declaration[] { + function removeComputedProperties(node: EnumDeclaration): Declaration[] { return filter(node.members, member => member.name === undefined || member.name.kind !== SyntaxKind.ComputedPropertyName); } + /** + * Like removeComputedProperties, but retains the properties with well known symbol names + */ + function removeDynamicallyNamedProperties(node: ClassDeclaration | InterfaceDeclaration): Declaration[]{ + return filter(node.members, member => !hasDynamicName(member)); + } + function getInnermostModule(node: ModuleDeclaration): ModuleDeclaration { while (node.body.kind === SyntaxKind.ModuleDeclaration) { node = node.body; diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index 0b39f54ca29..b65ad7e36c8 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -61,6 +61,7 @@ module ts { // to be the entire span of the parent. if (parent.kind === SyntaxKind.DoStatement || parent.kind === SyntaxKind.ForInStatement || + parent.kind === SyntaxKind.ForOfStatement || parent.kind === SyntaxKind.ForStatement || parent.kind === SyntaxKind.IfStatement || parent.kind === SyntaxKind.WhileStatement || diff --git a/src/services/patternMatcher.ts b/src/services/patternMatcher.ts new file mode 100644 index 00000000000..da07c4400bc --- /dev/null +++ b/src/services/patternMatcher.ts @@ -0,0 +1,813 @@ +module ts { + // Note(cyrusn): this enum is ordered from strongest match type to weakest match type. + export enum PatternMatchKind { + Exact, + Prefix, + Substring, + CamelCase + } + + // Information about a match made by the pattern matcher between a candidate and the + // search pattern. + export interface PatternMatch { + // What kind of match this was. Exact matches are better than prefix matches which are + // better than substring matches which are better than CamelCase matches. + kind: PatternMatchKind; + + // If this was a camel case match, how strong the match is. Higher number means + // it was a better match. + camelCaseWeight?: number; + + // If this was a match where all constituent parts of the candidate and search pattern + // matched case sensitively or case insensitively. Case sensitive matches of the kind + // are better matches than insensitive matches. + isCaseSensitive: boolean; + + // Whether or not this match occurred with the punctuation from the search pattern stripped + // out or not. Matches without the punctuation stripped are better than ones with punctuation + // stripped. + punctuationStripped: boolean; + } + + // The pattern matcher maintains an internal cache of information as it is used. Therefore, + // you should not keep it around forever and should get and release the matcher appropriately + // once you no longer need it. + export interface PatternMatcher { + // Used to match a candidate against the last segment of a possibly dotted pattern. This + // is useful as a quick check to prevent having to compute a container before calling + // "getMatches". + // + // For example, if the search pattern is "ts.c.SK" and the candidate is "SyntaxKind", then + // this will return a successful match, having only tested "SK" against "SyntaxKind". At + // that point a call can be made to 'getMatches("SyntaxKind", "ts.compiler")', with the + // work to create 'ts.compiler' only being done once the first match succeeded. + getMatchesForLastSegmentOfPattern(candidate: string): PatternMatch[]; + + // Fully checks a candidate, with an dotted container, against the search pattern. + // The candidate must match the last part of the search pattern, and the dotted container + // must match the preceding segments of the pattern. + getMatches(candidate: string, dottedContainer: string): PatternMatch[]; + + // Whether or not the pattern contained dots or not. Clients can use this to determine + // If they should call getMatches, or if getMatchesForLastSegmentOfPattern is sufficient. + patternContainsDots: boolean; + } + + // First we break up the pattern given by dots. Each portion of the pattern between the + // dots is a 'Segment'. The 'Segment' contains information about the entire section of + // text between the dots, as well as information about any individual 'Words' that we + // can break the segment into. A 'Word' is simply a contiguous sequence of characters + // that can appear in a typescript identifier. So "GetKeyword" would be one word, while + // "Get Keyword" would be two words. Once we have the individual 'words', we break those + // into constituent 'character spans' of interest. For example, while 'UIElement' is one + // word, it make character spans corresponding to "U", "I" and "Element". These spans + // are then used when doing camel cased matches against candidate patterns. + interface Segment { + // Information about the entire piece of text between the dots. For example, if the + // text between the dots is 'GetKeyword', then TotalTextChunk.Text will be 'GetKeyword' and + // TotalTextChunk.CharacterSpans will correspond to 'Get', 'Keyword'. + totalTextChunk: TextChunk; + + // Information about the subwords compromising the total word. For example, if the + // text between the dots is 'GetFoo KeywordBar', then the subwords will be 'GetFoo' + // and 'KeywordBar'. Those individual words will have CharacterSpans of ('Get' and + // 'Foo') and('Keyword' and 'Bar') respectively. + subWordTextChunks: TextChunk[]; + } + + // Information about a chunk of text from the pattern. The chunk is a piece of text, with + // cached information about the character spans within in. Character spans are used for + // camel case matching. + interface TextChunk { + // The text of the chunk. This should be a contiguous sequence of character that could + // occur in a symbol name. + text: string; + + // The text of a chunk in lower case. Cached because it is needed often to check for + // case insensitive matches. + textLowerCase: string; + + // Whether or not this chunk is entirely lowercase. We have different rules when searching + // for something entirely lowercase or not. + isLowerCase: boolean; + + // The spans in this text chunk that we think are of interest and should be matched + // independently. For example, if the chunk is for "UIElement" the the spans of interest + // correspond to "U", "I" and "Element". If "UIElement" isn't found as an exaxt, prefix. + // or substring match, then the character spans will be used to attempt a camel case match. + characterSpans: TextSpan[]; + } + + function createPatternMatch(kind: PatternMatchKind, punctuationStripped: boolean, isCaseSensitive: boolean, camelCaseWeight?: number): PatternMatch { + return { + kind, + punctuationStripped, + isCaseSensitive, + camelCaseWeight + }; + } + + export function createPatternMatcher(pattern: string): PatternMatcher { + // We'll often see the same candidate string many times when searching (For example, when + // we see the name of a module that is used everywhere, or the name of an overload). As + // such, we cache the information we compute about the candidate for the life of this + // pattern matcher so we don't have to compute it multiple times. + var stringToWordSpans: Map = {}; + + pattern = pattern.trim(); + + var fullPatternSegment = createSegment(pattern); + var dotSeparatedSegments = pattern.split(".").map(p => createSegment(p.trim())); + var invalidPattern = dotSeparatedSegments.length === 0 || forEach(dotSeparatedSegments, segmentIsInvalid); + + return { + getMatches, + getMatchesForLastSegmentOfPattern, + patternContainsDots: dotSeparatedSegments.length > 1 + }; + + // Quick checks so we can bail out when asked to match a candidate. + function skipMatch(candidate: string) { + return invalidPattern || !candidate; + } + + function getMatchesForLastSegmentOfPattern(candidate: string): PatternMatch[] { + if (skipMatch(candidate)) { + return undefined; + } + + return matchSegment(candidate, lastOrUndefined(dotSeparatedSegments)); + } + + function getMatches(candidate: string, dottedContainer: string): PatternMatch[] { + if (skipMatch(candidate)) { + return undefined; + } + + // First, check that the last part of the dot separated pattern matches the name of the + // candidate. If not, then there's no point in proceeding and doing the more + // expensive work. + var candidateMatch = matchSegment(candidate, lastOrUndefined(dotSeparatedSegments)); + if (!candidateMatch) { + return undefined; + } + + dottedContainer = dottedContainer || ""; + var containerParts = dottedContainer.split("."); + + // -1 because the last part was checked against the name, and only the rest + // of the parts are checked against the container. + if (dotSeparatedSegments.length - 1 > containerParts.length) { + // There weren't enough container parts to match against the pattern parts. + // So this definitely doesn't match. + return null; + } + + // So far so good. Now break up the container for the candidate and check if all + // the dotted parts match up correctly. + var totalMatch = candidateMatch; + + for (var i = dotSeparatedSegments.length - 2, j = containerParts.length - 1; + i >= 0; + i--, j--) { + + var segment = dotSeparatedSegments[i]; + var containerName = containerParts[j]; + + var containerMatch = matchSegment(containerName, segment); + if (!containerMatch) { + // This container didn't match the pattern piece. So there's no match at all. + return undefined; + } + + addRange(totalMatch, containerMatch); + } + + // Success, this symbol's full name matched against the dotted name the user was asking + // about. + return totalMatch; + } + + function getWordSpans(word: string): TextSpan[] { + if (!hasProperty(stringToWordSpans, word)) { + stringToWordSpans[word] = breakIntoWordSpans(word); + } + + return stringToWordSpans[word]; + } + + function matchTextChunk(candidate: string, chunk: TextChunk, punctuationStripped: boolean): PatternMatch { + var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); + if (index === 0) { + if (chunk.text.length === candidate.length) { + // a) Check if the part matches the candidate entirely, in an case insensitive or + // sensitive manner. If it does, return that there was an exact match. + return createPatternMatch(PatternMatchKind.Exact, punctuationStripped, /*isCaseSensitive:*/ candidate === chunk.text); + } + else { + // b) Check if the part is a prefix of the candidate, in a case insensitive or sensitive + // manner. If it does, return that there was a prefix match. + return createPatternMatch(PatternMatchKind.Prefix, punctuationStripped, /*isCaseSensitive:*/ startsWith(candidate, chunk.text)); + } + } + + var isLowercase = chunk.isLowerCase; + if (isLowercase) { + if (index > 0) { + // c) If the part is entirely lowercase, then check if it is contained anywhere in the + // candidate in a case insensitive manner. If so, return that there was a substring + // match. + // + // Note: We only have a substring match if the lowercase part is prefix match of some + // word part. That way we don't match something like 'Class' when the user types 'a'. + // But we would match 'FooAttribute' (since 'Attribute' starts with 'a'). + var wordSpans = getWordSpans(candidate); + for (var i = 0, n = wordSpans.length; i < n; i++) { + var span = wordSpans[i] + if (partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ true)) { + return createPatternMatch(PatternMatchKind.Substring, punctuationStripped, + /*isCaseSensitive:*/ partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ false)); + } + } + } + } + else { + // d) If the part was not entirely lowercase, then check if it is contained in the + // candidate in a case *sensitive* manner. If so, return that there was a substring + // match. + if (candidate.indexOf(chunk.text) > 0) { + return createPatternMatch(PatternMatchKind.Substring, punctuationStripped, /*isCaseSensitive:*/ true); + } + } + + if (!isLowercase) { + // e) If the part was not entirely lowercase, then attempt a camel cased match as well. + if (chunk.characterSpans.length > 0) { + var candidateParts = getWordSpans(candidate); + var camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ false); + if (camelCaseWeight !== undefined) { + return createPatternMatch(PatternMatchKind.CamelCase, punctuationStripped, /*isCaseSensitive:*/ true, /*camelCaseWeight:*/ camelCaseWeight); + } + + camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ true); + if (camelCaseWeight !== undefined) { + return createPatternMatch(PatternMatchKind.CamelCase, punctuationStripped, /*isCaseSensitive:*/ false, /*camelCaseWeight:*/ camelCaseWeight); + } + } + } + + if (isLowercase) { + // f) Is the pattern a substring of the candidate starting on one of the candidate's word boundaries? + + // We could check every character boundary start of the candidate for the pattern. However, that's + // an m * n operation in the wost case. Instead, find the first instance of the pattern + // substring, and see if it starts on a capital letter. It seems unlikely that the user will try to + // filter the list based on a substring that starts on a capital letter and also with a lowercase one. + // (Pattern: fogbar, Candidate: quuxfogbarFogBar). + if (chunk.text.length < candidate.length) { + if (index > 0 && isUpperCaseLetter(candidate.charCodeAt(index))) { + return createPatternMatch(PatternMatchKind.Substring, punctuationStripped, /*isCaseSensitive:*/ false); + } + } + } + + return undefined; + } + + function containsSpaceOrAsterisk(text: string): boolean { + for (var i = 0; i < text.length; i++) { + var ch = text.charCodeAt(i); + if (ch === CharacterCodes.space || ch === CharacterCodes.asterisk) { + return true; + } + } + + return false; + } + + function matchSegment(candidate: string, segment: Segment): PatternMatch[] { + // First check if the segment matches as is. This is also useful if the segment contains + // characters we would normally strip when splitting into parts that we also may want to + // match in the candidate. For example if the segment is "@int" and the candidate is + // "@int", then that will show up as an exact match here. + // + // Note: if the segment contains a space or an asterisk then we must assume that it's a + // multi-word segment. + if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) { + var match = matchTextChunk(candidate, segment.totalTextChunk, /*punctuationStripped:*/ false); + if (match) { + return [match]; + } + } + + // The logic for pattern matching is now as follows: + // + // 1) Break the segment passed in into words. Breaking is rather simple and a + // good way to think about it that if gives you all the individual alphanumeric words + // of the pattern. + // + // 2) For each word try to match the word against the candidate value. + // + // 3) Matching is as follows: + // + // a) Check if the word matches the candidate entirely, in an case insensitive or + // sensitive manner. If it does, return that there was an exact match. + // + // b) Check if the word is a prefix of the candidate, in a case insensitive or + // sensitive manner. If it does, return that there was a prefix match. + // + // c) If the word is entirely lowercase, then check if it is contained anywhere in the + // candidate in a case insensitive manner. If so, return that there was a substring + // match. + // + // Note: We only have a substring match if the lowercase part is prefix match of + // some word part. That way we don't match something like 'Class' when the user + // types 'a'. But we would match 'FooAttribute' (since 'Attribute' starts with + // 'a'). + // + // d) If the word was not entirely lowercase, then check if it is contained in the + // candidate in a case *sensitive* manner. If so, return that there was a substring + // match. + // + // e) If the word was not entirely lowercase, then attempt a camel cased match as + // well. + // + // f) The word is all lower case. Is it a case insensitive substring of the candidate starting + // on a part boundary of the candidate? + // + // Only if all words have some sort of match is the pattern considered matched. + + var subWordTextChunks = segment.subWordTextChunks; + var matches: PatternMatch[] = undefined; + + for (var i = 0, n = subWordTextChunks.length; i < n; i++) { + var subWordTextChunk = subWordTextChunks[i]; + + // Try to match the candidate with this word + var result = matchTextChunk(candidate, subWordTextChunk, /*punctuationStripped:*/ true); + if (!result) { + return undefined; + } + + matches = matches || []; + matches.push(result); + } + + return matches; + } + + function partStartsWith(candidate: string, candidateSpan: TextSpan, pattern: string, ignoreCase: boolean, patternSpan?: TextSpan): boolean { + var patternPartStart = patternSpan ? patternSpan.start : 0; + var patternPartLength = patternSpan ? patternSpan.length : pattern.length; + + if (patternPartLength > candidateSpan.length) { + // Pattern part is longer than the candidate part. There can never be a match. + return false; + } + + if (ignoreCase) { + for (var i = 0; i < patternPartLength; i++) { + var ch1 = pattern.charCodeAt(patternPartStart + i); + var ch2 = candidate.charCodeAt(candidateSpan.start + i); + if (toLowerCase(ch1) !== toLowerCase(ch2)) { + return false; + } + } + } + else { + for (var i = 0; i < patternPartLength; i++) { + var ch1 = pattern.charCodeAt(patternPartStart + i); + var ch2 = candidate.charCodeAt(candidateSpan.start + i); + if (ch1 !== ch2) { + return false; + } + } + } + + return true; + } + + function tryCamelCaseMatch(candidate: string, candidateParts: TextSpan[], chunk: TextChunk, ignoreCase: boolean): number { + var chunkCharacterSpans = chunk.characterSpans; + + // Note: we may have more pattern parts than candidate parts. This is because multiple + // pattern parts may match a candidate part. For example "SiUI" against "SimpleUI". + // We'll have 3 pattern parts Si/U/I against two candidate parts Simple/UI. However, U + // and I will both match in UI. + + var currentCandidate = 0; + var currentChunkSpan = 0; + var firstMatch: number = undefined; + var contiguous: boolean = undefined; + + while (true) { + // Let's consider our termination cases + if (currentChunkSpan === chunkCharacterSpans.length) { + // We did match! We shall assign a weight to this + var weight = 0; + + // Was this contiguous? + if (contiguous) { + weight += 1; + } + + // Did we start at the beginning of the candidate? + if (firstMatch === 0) { + weight += 2; + } + + return weight; + } + else if (currentCandidate === candidateParts.length) { + // No match, since we still have more of the pattern to hit + return undefined; + } + + var candidatePart = candidateParts[currentCandidate]; + var gotOneMatchThisCandidate = false; + + // Consider the case of matching SiUI against SimpleUIElement. The candidate parts + // will be Simple/UI/Element, and the pattern parts will be Si/U/I. We'll match 'Si' + // against 'Simple' first. Then we'll match 'U' against 'UI'. However, we want to + // still keep matching pattern parts against that candidate part. + for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { + var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; + + if (gotOneMatchThisCandidate) { + // We've already gotten one pattern part match in this candidate. We will + // only continue trying to consumer pattern parts if the last part and this + // part are both upper case. + if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || + !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { + break; + } + } + + if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) { + break; + } + + gotOneMatchThisCandidate = true; + + firstMatch = firstMatch === undefined ? currentCandidate : firstMatch; + + // If we were contiguous, then keep that value. If we weren't, then keep that + // value. If we don't know, then set the value to 'true' as an initial match is + // obviously contiguous. + contiguous = contiguous === undefined ? true : contiguous; + + candidatePart = createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length); + } + + // Check if we matched anything at all. If we didn't, then we need to unset the + // contiguous bit if we currently had it set. + // If we haven't set the bit yet, then that means we haven't matched anything so + // far, and we don't want to change that. + if (!gotOneMatchThisCandidate && contiguous !== undefined) { + contiguous = false; + } + + // Move onto the next candidate. + currentCandidate++; + } + } + } + + // Helper function to compare two matches to determine which is better. Matches are first + // ordered by kind (so all prefix matches always beat all substring matches). Then, if the + // match is a camel case match, the relative weights of hte match are used to determine + // which is better (with a greater weight being better). Then if the match is of the same + // type, then a case sensitive match is considered better than an insensitive one. + function patternMatchCompareTo(match1: PatternMatch, match2: PatternMatch): number { + return compareType(match1, match2) || + compareCamelCase(match1, match2) || + compareCase(match1, match2) || + comparePunctuation(match1, match2); + } + + function comparePunctuation(result1: PatternMatch, result2: PatternMatch) { + // Consider a match to be better if it was successful without stripping punctuation + // versus a match that had to strip punctuation to succeed. + if (result1.punctuationStripped !== result2.punctuationStripped) { + return result1.punctuationStripped ? 1 : -1; + } + + return 0; + } + + function compareCase(result1: PatternMatch, result2: PatternMatch) { + if (result1.isCaseSensitive !== result2.isCaseSensitive) { + return result1.isCaseSensitive ? -1 : 1; + } + + return 0; + } + + function compareType(result1: PatternMatch, result2: PatternMatch) { + return result1.kind - result2.kind; + } + + function compareCamelCase(result1: PatternMatch, result2: PatternMatch) { + if (result1.kind === PatternMatchKind.CamelCase && result2.kind === PatternMatchKind.CamelCase) { + // Swap the values here. If result1 has a higher weight, then we want it to come + // first. + return result2.camelCaseWeight - result1.camelCaseWeight; + } + + return 0; + } + + function createSegment(text: string): Segment { + return { + totalTextChunk: createTextChunk(text), + subWordTextChunks: breakPatternIntoTextChunks(text) + } + } + + // A segment is considered invalid if we couldn't find any words in it. + function segmentIsInvalid(segment: Segment) { + return segment.subWordTextChunks.length === 0; + } + + function isUpperCaseLetter(ch: number) { + // Fast check for the ascii range. + if (ch >= CharacterCodes.A && ch <= CharacterCodes.Z) { + return true; + } + + if (ch < CharacterCodes.maxAsciiCharacter || !isUnicodeIdentifierStart(ch, ScriptTarget.Latest)) { + return false; + } + + // TODO: find a way to determine this for any unicode characters in a + // non-allocating manner. + var str = String.fromCharCode(ch); + return str === str.toUpperCase(); + } + + function isLowerCaseLetter(ch: number) { + // Fast check for the ascii range. + if (ch >= CharacterCodes.a && ch <= CharacterCodes.z) { + return true; + } + + if (ch < CharacterCodes.maxAsciiCharacter || !isUnicodeIdentifierStart(ch, ScriptTarget.Latest)) { + return false; + } + + + // TODO: find a way to determine this for any unicode characters in a + // non-allocating manner. + var str = String.fromCharCode(ch); + return str === str.toLowerCase(); + } + + function containsUpperCaseLetter(string: string): boolean { + for (var i = 0, n = string.length; i < n; i++) { + if (isUpperCaseLetter(string.charCodeAt(i))) { + return true; + } + } + + return false; + } + + function startsWith(string: string, search: string) { + for (var i = 0, n = search.length; i < n; i++) { + if (string.charCodeAt(i) !== search.charCodeAt(i)) { + return false; + } + } + + return true; + } + + // Assumes 'value' is already lowercase. + function indexOfIgnoringCase(string: string, value: string): number { + for (var i = 0, n = string.length - value.length; i <= n; i++) { + if (startsWithIgnoringCase(string, value, i)) { + return i; + } + } + + return -1; + } + + // Assumes 'value' is already lowercase. + function startsWithIgnoringCase(string: string, value: string, start: number): boolean { + for (var i = 0, n = value.length; i < n; i++) { + var ch1 = toLowerCase(string.charCodeAt(i + start)); + var ch2 = value.charCodeAt(i); + + if (ch1 !== ch2) { + return false; + } + } + + return true; + } + + function toLowerCase(ch: number): number { + // Fast convert for the ascii range. + if (ch >= CharacterCodes.A && ch <= CharacterCodes.Z) { + return CharacterCodes.a + (ch - CharacterCodes.A); + } + + if (ch < CharacterCodes.maxAsciiCharacter) { + return ch; + } + + // TODO: find a way to compute this for any unicode characters in a + // non-allocating manner. + return String.fromCharCode(ch).toLowerCase().charCodeAt(0); + } + + function isDigit(ch: number) { + // TODO(cyrusn): Find a way to support this for unicode digits. + return ch >= CharacterCodes._0 && ch <= CharacterCodes._9; + } + + function isWordChar(ch: number) { + return isUpperCaseLetter(ch) || isLowerCaseLetter(ch) || isDigit(ch) || ch === CharacterCodes._ || ch === CharacterCodes.$; + } + + function breakPatternIntoTextChunks(pattern: string): TextChunk[] { + var result: TextChunk[] = []; + var wordStart = 0; + var wordLength = 0; + + for (var i = 0; i < pattern.length; i++) { + var ch = pattern.charCodeAt(i); + if (isWordChar(ch)) { + if (wordLength++ === 0) { + wordStart = i; + } + } + else { + if (wordLength > 0) { + result.push(createTextChunk(pattern.substr(wordStart, wordLength))); + wordLength = 0; + } + } + } + + if (wordLength > 0) { + result.push(createTextChunk(pattern.substr(wordStart, wordLength))); + } + + return result; + } + + function createTextChunk(text: string): TextChunk { + var textLowerCase = text.toLowerCase(); + return { + text, + textLowerCase, + isLowerCase: text === textLowerCase, + characterSpans: breakIntoCharacterSpans(text) + } + } + + /* @internal */ export function breakIntoCharacterSpans(identifier: string): TextSpan[] { + return breakIntoSpans(identifier, /*word:*/ false); + } + + /* @internal */ export function breakIntoWordSpans(identifier: string): TextSpan[] { + return breakIntoSpans(identifier, /*word:*/ true); + } + + function breakIntoSpans(identifier: string, word: boolean): TextSpan[] { + var result: TextSpan[] = []; + + var wordStart = 0; + for (var i = 1, n = identifier.length; i < n; i++) { + var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); + var currentIsDigit = isDigit(identifier.charCodeAt(i)); + + var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); + var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart); + + if (charIsPunctuation(identifier.charCodeAt(i - 1)) || + charIsPunctuation(identifier.charCodeAt(i)) || + lastIsDigit != currentIsDigit || + hasTransitionFromLowerToUpper || + hasTransitionFromUpperToLower) { + + if (!isAllPunctuation(identifier, wordStart, i)) { + result.push(createTextSpan(wordStart, i - wordStart)); + } + + wordStart = i; + } + } + + if (!isAllPunctuation(identifier, wordStart, identifier.length)) { + result.push(createTextSpan(wordStart, identifier.length - wordStart)); + } + + return result; + } + + function charIsPunctuation(ch: number) { + switch (ch) { + case CharacterCodes.exclamation: + case CharacterCodes.doubleQuote: + case CharacterCodes.hash: + case CharacterCodes.percent: + case CharacterCodes.ampersand: + case CharacterCodes.singleQuote: + case CharacterCodes.openParen: + case CharacterCodes.closeParen: + case CharacterCodes.asterisk: + case CharacterCodes.comma: + case CharacterCodes.minus: + case CharacterCodes.dot: + case CharacterCodes.slash: + case CharacterCodes.colon: + case CharacterCodes.semicolon: + case CharacterCodes.question: + case CharacterCodes.at: + case CharacterCodes.openBracket: + case CharacterCodes.backslash: + case CharacterCodes.closeBracket: + case CharacterCodes._: + case CharacterCodes.openBrace: + case CharacterCodes.closeBrace: + return true; + } + + return false; + } + + function isAllPunctuation(identifier: string, start: number, end: number): boolean { + for (var i = start; i < end; i++) { + var ch = identifier.charCodeAt(i); + + // We don't consider _ or $ as punctuation as there may be things with that name. + if (!charIsPunctuation(ch) || ch === CharacterCodes._ || ch === CharacterCodes.$) { + return false; + } + } + + return true; + } + + function transitionFromUpperToLower(identifier: string, word: boolean, index: number, wordStart: number): boolean { + if (word) { + // Cases this supports: + // 1) IDisposable -> I, Disposable + // 2) UIElement -> UI, Element + // 3) HTMLDocument -> HTML, Document + // + // etc. + if (index != wordStart && + index + 1 < identifier.length) { + var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); + var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1)); + + if (currentIsUpper && nextIsLower) { + // We have a transition from an upper to a lower letter here. But we only + // want to break if all the letters that preceded are uppercase. i.e. if we + // have "Foo" we don't want to break that into "F, oo". But if we have + // "IFoo" or "UIFoo", then we want to break that into "I, Foo" and "UI, + // Foo". i.e. the last uppercase letter belongs to the lowercase letters + // that follows. Note: this will make the following not split properly: + // "HELLOthere". However, these sorts of names do not show up in .Net + // programs. + for (var i = wordStart; i < index; i++) { + if (!isUpperCaseLetter(identifier.charCodeAt(i))) { + return false; + } + } + + return true; + } + } + } + + return false; + } + + function transitionFromLowerToUpper(identifier: string, word: boolean, index: number): boolean { + var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); + var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); + + // See if the casing indicates we're starting a new word. Note: if we're breaking on + // words, then just seeing an upper case character isn't enough. Instead, it has to + // be uppercase and the previous character can't be uppercase. + // + // For example, breaking "AddMetadata" on words would make: Add Metadata + // + // on characters would be: A dd M etadata + // + // Break "AM" on words would be: AM + // + // on characters would be: A M + // + // We break the search string on characters. But we break the symbol name on words. + var transition = word + ? (currentIsUpper && !lastIsUpper) + : currentIsUpper; + return transition; + } +} \ No newline at end of file diff --git a/src/services/services.ts b/src/services/services.ts index 95a8c6a4c32..9ed39b65092 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2,14 +2,15 @@ /// /// +/// /// +/// /// /// /// /// module ts { - export var servicesVersion = "0.4" export interface Node { @@ -61,9 +62,9 @@ module ts { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } @@ -612,7 +613,7 @@ module ts { } if (paramHelpStringMargin === undefined) { - paramHelpStringMargin = sourceFile.getLineAndCharacterFromPosition(firstLineParamHelpStringPos).character - 1; + paramHelpStringMargin = sourceFile.getLineAndCharacterOfPosition(firstLineParamHelpStringPos).character; } // Now consume white spaces max @@ -725,7 +726,7 @@ module ts { public statements: NodeArray; public endOfFileToken: Node; - public amdDependencies: string[]; + public amdDependencies: {name: string; path: string}[]; public amdModuleName: string; public referencedFiles: FileReference[]; @@ -750,16 +751,16 @@ module ts { return updateSourceFile(this, newText, textChangeRange); } - public getLineAndCharacterFromPosition(position: number): LineAndCharacter { - return getLineAndCharacterOfPosition(this, position); + public getLineAndCharacterOfPosition(position: number): LineAndCharacter { + return ts.getLineAndCharacterOfPosition(this, position); } public getLineStarts(): number[] { return getLineStarts(this); } - public getPositionFromLineAndCharacter(line: number, character: number): number { - return getPositionFromLineAndCharacter(this, line, character); + public getPositionOfLineAndCharacter(line: number, character: number): number { + return ts.getPositionOfLineAndCharacter(this, line, character); } public getNamedDeclarations() { @@ -900,7 +901,7 @@ module ts { getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; @@ -991,6 +992,7 @@ module ts { InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; + [s: string]: boolean | number| string; } export interface DefinitionInfo { @@ -1143,6 +1145,9 @@ module ts { InMultiLineCommentTrivia, InSingleQuoteStringLiteral, InDoubleQuoteStringLiteral, + InTemplateHeadOrNoSubstitutionTemplate, + InTemplateMiddleOrTail, + InTemplateSubstitutionPosition, } export enum TokenClass { @@ -1168,7 +1173,26 @@ module ts { } export interface Classifier { - getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult; + /** + * Gives lexical classifications of tokens on a line without any syntactic context. + * For instance, a token consisting of the text 'string' can be either an identifier + * named 'string' or the keyword 'string', however, because this classifier is not aware, + * it relies on certain heuristics to give acceptable results. For classifications where + * speed trumps accuracy, this function is preferable; however, for true accuracy, the + * syntactic classifier is ideal. In fact, in certain editing scenarios, combining the + * lexical, syntactic, and semantic classifiers may issue the best user experience. + * + * @param text The text of a line to classify. + * @param lexState The state of the lexical classifier at the end of the previous line. + * @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier. + * If there is no syntactic classifier (syntacticClassifierAbsent=true), + * certain heuristics may be used in its place; however, if there is a + * syntactic classifier (syntacticClassifierAbsent=false), certain + * classifications which may be incorrectly categorized will be given + * back as Identifiers in order to allow the syntactic classifier to + * subsume the classification. + */ + getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; } /** @@ -1355,13 +1379,6 @@ module ts { public static typeAlias = "type alias name"; } - enum MatchKind { - none = 0, - exact = 1, - substring = 2, - prefix = 3 - } - /// Language Service interface CompletionSession { @@ -1969,6 +1986,62 @@ module ts { }); } + /* @internal */ export function getContainerNode(node: Node): Node { + while (true) { + node = node.parent; + if (!node) { + return undefined; + } + switch (node.kind) { + case SyntaxKind.SourceFile: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.MethodSignature: + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.ClassDeclaration: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.EnumDeclaration: + case SyntaxKind.ModuleDeclaration: + return node; + } + } + } + + /* @internal */ export function getNodeKind(node: Node): string { + switch (node.kind) { + case SyntaxKind.ModuleDeclaration: return ScriptElementKind.moduleElement; + case SyntaxKind.ClassDeclaration: return ScriptElementKind.classElement; + case SyntaxKind.InterfaceDeclaration: return ScriptElementKind.interfaceElement; + case SyntaxKind.TypeAliasDeclaration: return ScriptElementKind.typeElement; + case SyntaxKind.EnumDeclaration: return ScriptElementKind.enumElement; + case SyntaxKind.VariableDeclaration: + return isConst(node) + ? ScriptElementKind.constElement + : isLet(node) + ? ScriptElementKind.letElement + : ScriptElementKind.variableElement; + case SyntaxKind.FunctionDeclaration: return ScriptElementKind.functionElement; + case SyntaxKind.GetAccessor: return ScriptElementKind.memberGetAccessorElement; + case SyntaxKind.SetAccessor: return ScriptElementKind.memberSetAccessorElement; + case SyntaxKind.MethodDeclaration: + case SyntaxKind.MethodSignature: + return ScriptElementKind.memberFunctionElement; + case SyntaxKind.PropertyDeclaration: + case SyntaxKind.PropertySignature: + return ScriptElementKind.memberVariableElement; + case SyntaxKind.IndexSignature: return ScriptElementKind.indexSignatureElement; + case SyntaxKind.ConstructSignature: return ScriptElementKind.constructSignatureElement; + case SyntaxKind.CallSignature: return ScriptElementKind.callSignatureElement; + case SyntaxKind.Constructor: return ScriptElementKind.constructorImplementationElement; + case SyntaxKind.TypeParameter: return ScriptElementKind.typeParameterElement; + case SyntaxKind.EnumMember: return ScriptElementKind.variableElement; + case SyntaxKind.Parameter: return (node.flags & NodeFlags.AccessibilityModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + } + return ScriptElementKind.unknown; + } + export function createLanguageService(host: LanguageServiceHost, documentRegistry: DocumentRegistry = createDocumentRegistry()): LanguageService { var syntaxTreeCache: SyntaxTreeCache = new SyntaxTreeCache(host); var ruleProvider: formatting.RulesProvider; @@ -2699,29 +2772,6 @@ module ts { } } - function getContainerNode(node: Node): Node { - while (true) { - node = node.parent; - if (!node) { - return undefined; - } - switch (node.kind) { - case SyntaxKind.SourceFile: - case SyntaxKind.MethodDeclaration: - case SyntaxKind.MethodSignature: - case SyntaxKind.FunctionDeclaration: - case SyntaxKind.FunctionExpression: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - case SyntaxKind.ClassDeclaration: - case SyntaxKind.InterfaceDeclaration: - case SyntaxKind.EnumDeclaration: - case SyntaxKind.ModuleDeclaration: - return node; - } - } - } - // TODO(drosen): use contextual SemanticMeaning. function getSymbolKind(symbol: Symbol, typeResolver: TypeChecker, location: Node): string { var flags = symbol.getFlags(); @@ -2808,39 +2858,6 @@ module ts { return ScriptElementKind.unknown; } - function getNodeKind(node: Node): string { - switch (node.kind) { - case SyntaxKind.ModuleDeclaration: return ScriptElementKind.moduleElement; - case SyntaxKind.ClassDeclaration: return ScriptElementKind.classElement; - case SyntaxKind.InterfaceDeclaration: return ScriptElementKind.interfaceElement; - case SyntaxKind.TypeAliasDeclaration: return ScriptElementKind.typeElement; - case SyntaxKind.EnumDeclaration: return ScriptElementKind.enumElement; - case SyntaxKind.VariableDeclaration: - return isConst(node) - ? ScriptElementKind.constElement - : isLet(node) - ? ScriptElementKind.letElement - : ScriptElementKind.variableElement; - case SyntaxKind.FunctionDeclaration: return ScriptElementKind.functionElement; - case SyntaxKind.GetAccessor: return ScriptElementKind.memberGetAccessorElement; - case SyntaxKind.SetAccessor: return ScriptElementKind.memberSetAccessorElement; - case SyntaxKind.MethodDeclaration: - case SyntaxKind.MethodSignature: - return ScriptElementKind.memberFunctionElement; - case SyntaxKind.PropertyDeclaration: - case SyntaxKind.PropertySignature: - return ScriptElementKind.memberVariableElement; - case SyntaxKind.IndexSignature: return ScriptElementKind.indexSignatureElement; - case SyntaxKind.ConstructSignature: return ScriptElementKind.constructSignatureElement; - case SyntaxKind.CallSignature: return ScriptElementKind.callSignatureElement; - case SyntaxKind.Constructor: return ScriptElementKind.constructorImplementationElement; - case SyntaxKind.TypeParameter: return ScriptElementKind.typeParameterElement; - case SyntaxKind.EnumMember: return ScriptElementKind.variableElement; - case SyntaxKind.Parameter: return (node.flags & NodeFlags.AccessibilityModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - } - return ScriptElementKind.unknown; - } - function getSymbolModifiers(symbol: Symbol): string { return symbol && symbol.declarations && symbol.declarations.length > 0 ? getNodeModifiers(symbol.declarations[0]) @@ -3419,7 +3436,9 @@ module ts { } break; case SyntaxKind.ForKeyword: - if (hasKind(node.parent, SyntaxKind.ForStatement) || hasKind(node.parent, SyntaxKind.ForInStatement)) { + if (hasKind(node.parent, SyntaxKind.ForStatement) || + hasKind(node.parent, SyntaxKind.ForInStatement) || + hasKind(node.parent, SyntaxKind.ForOfStatement)) { return getLoopBreakContinueOccurrences(node.parent); } break; @@ -3696,6 +3715,7 @@ module ts { switch (owner.kind) { case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.DoStatement: case SyntaxKind.WhileStatement: return getLoopBreakContinueOccurrences(owner) @@ -3740,6 +3760,7 @@ module ts { // Fall through. case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.WhileStatement: case SyntaxKind.DoStatement: if (!statement.label || isLabeledBy(node, statement.label.text)) { @@ -4627,7 +4648,7 @@ module ts { return true; } else if (parent.kind === SyntaxKind.BinaryExpression && (parent).left === node) { - var operator = (parent).operator; + var operator = (parent).operatorToken.kind; return SyntaxKind.FirstAssignment <= operator && operator <= SyntaxKind.LastAssignment; } } @@ -4636,89 +4657,10 @@ module ts { } /// NavigateTo - function getNavigateToItems(searchValue: string): NavigateToItem[] { + function getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[] { synchronizeHostData(); - // Split search value in terms array - var terms = searchValue.split(" "); - - // default NavigateTo approach: if search term contains only lower-case chars - use case-insensitive search, otherwise switch to case-sensitive version - var searchTerms = map(terms, t => ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t })); - - var items: NavigateToItem[] = []; - - // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] - forEach(program.getSourceFiles(), sourceFile => { - cancellationToken.throwIfCancellationRequested(); - - var fileName = sourceFile.fileName; - var declarations = sourceFile.getNamedDeclarations(); - for (var i = 0, n = declarations.length; i < n; i++) { - var declaration = declarations[i]; - // TODO(jfreeman): Skip this declaration if it has a computed name - var name = (declaration.name).text; - var matchKind = getMatchKind(searchTerms, name); - if (matchKind !== MatchKind.none) { - var container = getContainerNode(declaration); - items.push({ - name: name, - kind: getNodeKind(declaration), - kindModifiers: getNodeModifiers(declaration), - matchKind: MatchKind[matchKind], - fileName: fileName, - textSpan: createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), - // TODO(jfreeman): What should be the containerName when the container has a computed name? - containerName: container && container.name ? (container.name).text : "", - containerKind: container && container.name ? getNodeKind(container) : "" - }); - } - } - }); - - return items; - - function hasAnyUpperCaseCharacter(s: string): boolean { - for (var i = 0, n = s.length; i < n; i++) { - var c = s.charCodeAt(i); - if ((CharacterCodes.A <= c && c <= CharacterCodes.Z) || - (c >= CharacterCodes.maxAsciiCharacter && s.charAt(i).toLocaleLowerCase() !== s.charAt(i))) { - return true; - } - } - - return false; - } - - function getMatchKind(searchTerms: { caseSensitive: boolean; term: string }[], name: string): MatchKind { - var matchKind = MatchKind.none; - - if (name) { - for (var j = 0, n = searchTerms.length; j < n; j++) { - var searchTerm = searchTerms[j]; - var nameToSearch = searchTerm.caseSensitive ? name : name.toLocaleLowerCase(); - // in case of case-insensitive search searchTerm.term will already be lower-cased - var index = nameToSearch.indexOf(searchTerm.term); - if (index < 0) { - // Didn't match. - return MatchKind.none; - } - - var termKind = MatchKind.substring; - if (index === 0) { - // here we know that match occur at the beginning of the string. - // if search term and declName has the same length - we have an exact match, otherwise declName have longer length and this will be prefix match - termKind = name.length === searchTerm.term.length ? MatchKind.exact : MatchKind.prefix; - } - - // Update our match kind if we don't have one, or if this match is better. - if (matchKind === MatchKind.none || termKind < matchKind) { - matchKind = termKind; - } - } - } - - return matchKind; - } + return ts.NavigateTo.getNavigateToItems(program, cancellationToken, searchValue, maxResultCount); } function containErrors(diagnostics: Diagnostic[]): boolean { @@ -5518,11 +5460,13 @@ module ts { var declarations = symbol.getDeclarations(); if (declarations && declarations.length > 0) { // Disallow rename for elements that are defined in the standard TypeScript library. - var defaultLibFile = getDefaultLibFileName(host.getCompilationSettings()); - for (var i = 0; i < declarations.length; i++) { - var sourceFile = declarations[i].getSourceFile(); - if (sourceFile && endsWith(sourceFile.fileName, defaultLibFile)) { - return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key)); + var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); + if (defaultLibFileName) { + for (var i = 0; i < declarations.length; i++) { + var sourceFile = declarations[i].getSourceFile(); + if (sourceFile && getCanonicalFileName(ts.normalizePath(sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { + return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key)); + } } } @@ -5544,10 +5488,6 @@ module ts { return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_this_element.key)); - function endsWith(string: string, value: string): boolean { - return string.lastIndexOf(value) + value.length === string.length; - } - function getRenameInfoError(localizedErrorMessage: string): RenameInfo { return { canRename: false, @@ -5617,6 +5557,28 @@ module ts { noRegexTable[SyntaxKind.TrueKeyword] = true; noRegexTable[SyntaxKind.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 + // lines, just as we do with the end-of-line state. However, this is a burden for implementers, + // and the behavior is entirely subsumed by the syntactic classifier anyway, so we instead + // flatten any nesting when the template stack is non-empty and encode it in the end-of-line state. + // Situations in which this fails are + // 1) When template strings are nested across different lines: + // `hello ${ `world + // ` }` + // + // Where on the second line, you will get the closing of a template, + // a closing curly, and a new template. + // + // 2) When substitution expressions have curly braces and the curly brace falls on the next line: + // `hello ${ () => { + // return "world" } } ` + // + // Where on the second line, you will get the 'return' keyword, + // a string literal, and a template end consisting of '} } `'. + var templateStack: SyntaxKind[] = []; + function isAccessibilityModifier(kind: SyntaxKind) { switch (kind) { case SyntaxKind.PublicKeyword: @@ -5636,7 +5598,7 @@ module ts { keyword2 === SyntaxKind.ConstructorKeyword || keyword2 === SyntaxKind.StaticKeyword) { - // Allow things like "public get", "public constructor" and "public static". + // Allow things like "public get", "public constructor" and "public static". // These are all legal. return true; } @@ -5650,13 +5612,19 @@ module ts { // if there are more cases we want the classifier to be better at. return true; } - - // 'classifyKeywordsInGenerics' should be 'true' when a syntactic classifier is not present. - function getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult { + + // If there is a syntactic classifier ('syntacticClassifierAbsent' is false), + // we will be more conservative in order to avoid conflicting with the syntactic classifier. + function getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult { var offset = 0; var token = SyntaxKind.Unknown; var lastNonTriviaToken = SyntaxKind.Unknown; + // Empty out the template stack for reuse. + while (templateStack.length > 0) { + templateStack.pop(); + } + // If we're in a string literal, then prepend: "\ // (and a newline). That way when we lex we'll think we're still in a string literal. // @@ -5675,6 +5643,17 @@ module ts { text = "/*\n" + text; offset = 3; break; + case EndOfLineState.InTemplateHeadOrNoSubstitutionTemplate: + text = "`\n" + text; + offset = 2; + break; + case EndOfLineState.InTemplateMiddleOrTail: + text = "}\n" + text; + offset = 2; + // fallthrough + case EndOfLineState.InTemplateSubstitutionPosition: + templateStack.push(SyntaxKind.TemplateHead); + break; } scanner.setText(text); @@ -5715,36 +5694,70 @@ module ts { } } else if (lastNonTriviaToken === SyntaxKind.DotToken && isKeyword(token)) { - token = SyntaxKind.Identifier; + token = SyntaxKind.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 = SyntaxKind.Identifier; + // 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 = SyntaxKind.Identifier; } else if (lastNonTriviaToken === SyntaxKind.Identifier && token === SyntaxKind.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. - angleBracketStack++; + // Could be the start of something generic. Keep track of that by bumping + // up the current count of generic contexts we may be in. + angleBracketStack++; } else if (token === SyntaxKind.GreaterThanToken && angleBracketStack > 0) { - // If we think we're currently in something generic, then mark that that - // generic entity is complete. - angleBracketStack--; + // If we think we're currently in something generic, then mark that that + // generic entity is complete. + angleBracketStack--; } else if (token === SyntaxKind.AnyKeyword || token === SyntaxKind.StringKeyword || token === SyntaxKind.NumberKeyword || - token === SyntaxKind.BooleanKeyword) { - if (angleBracketStack > 0 && !classifyKeywordsInGenerics) { - // 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 = SyntaxKind.Identifier; - } + token === SyntaxKind.BooleanKeyword || + token === SyntaxKind.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 = SyntaxKind.Identifier; + } + } + else if (token === SyntaxKind.TemplateHead) { + templateStack.push(token); + } + else if (token === SyntaxKind.OpenBraceToken) { + // If we don't have anything on the template stack, + // then we aren't trying to keep track of a previously scanned template head. + if (templateStack.length > 0) { + templateStack.push(token); + } + } + else if (token === SyntaxKind.CloseBraceToken) { + // If we don't have anything on the template stack, + // then we aren't trying to keep track of a previously scanned template head. + if (templateStack.length > 0) { + var lastTemplateStackToken = lastOrUndefined(templateStack); + + if (lastTemplateStackToken === SyntaxKind.TemplateHead) { + token = scanner.reScanTemplateToken(); + + // Only pop on a TemplateTail; a TemplateMiddle indicates there is more for us. + if (token === SyntaxKind.TemplateTail) { + templateStack.pop(); + } + else { + Debug.assert(token === SyntaxKind.TemplateMiddle, "Should have been a template middle. Was " + token); + } + } + else { + Debug.assert(lastTemplateStackToken === SyntaxKind.OpenBraceToken, "Should have been an open brace. Was: " + token); + templateStack.pop(); + } + } } lastNonTriviaToken = token; @@ -5789,6 +5802,22 @@ module ts { result.finalLexState = EndOfLineState.InMultiLineCommentTrivia; } } + else if (isTemplateLiteralKind(token)) { + if (scanner.isUnterminated()) { + if (token === SyntaxKind.TemplateTail) { + result.finalLexState = EndOfLineState.InTemplateMiddleOrTail; + } + else if (token === SyntaxKind.NoSubstitutionTemplateLiteral) { + result.finalLexState = EndOfLineState.InTemplateHeadOrNoSubstitutionTemplate; + } + else { + Debug.fail("Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #" + token); + } + } + } + else if (templateStack.length > 0 && lastOrUndefined(templateStack) === SyntaxKind.TemplateHead) { + result.finalLexState = EndOfLineState.InTemplateSubstitutionPosition; + } } } @@ -5844,7 +5873,8 @@ module ts { case SyntaxKind.EqualsToken: case SyntaxKind.CommaToken: return true; - default: return false; + default: + return false; } } @@ -5889,9 +5919,13 @@ module ts { case SyntaxKind.SingleLineCommentTrivia: return TokenClass.Comment; case SyntaxKind.WhitespaceTrivia: + case SyntaxKind.NewLineTrivia: return TokenClass.Whitespace; case SyntaxKind.Identifier: default: + if (isTemplateLiteralKind(token)) { + return TokenClass.StringLiteral; + } return TokenClass.Identifier; } } diff --git a/src/services/shims.ts b/src/services/shims.ts index 0f9f1a12cd1..01950772903 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -138,7 +138,7 @@ module ts { * Returns a JSON-encoded value of the type: * { name: string; kind: string; kindModifiers: string; containerName: string; containerKind: string; matchKind: string; fileName: string; textSpan: { start: number; length: number}; } [] = []; */ - getNavigateToItems(searchValue: string): string; + getNavigateToItems(searchValue: string, maxResultCount?: number): string; /** * Returns a JSON-encoded value of the type: @@ -165,7 +165,7 @@ module ts { } export interface ClassifierShim extends Shim { - getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): string; + getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): string; } export interface CoreServicesShim extends Shim { @@ -274,10 +274,7 @@ module ts { } public getDefaultLibFileName(options: CompilerOptions): string { - // Shim the API changes for 1.5 release. This should be removed once - // TypeScript 1.5 has shipped. - return ""; - //return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); + return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); } } @@ -631,11 +628,11 @@ module ts { /// NAVIGATE TO /** Return a list of symbols that are interesting to navigate to */ - public getNavigateToItems(searchValue: string): string { + public getNavigateToItems(searchValue: string, maxResultCount?: number): string { return this.forwardJSONCall( - "getNavigateToItems('" + searchValue + "')", + "getNavigateToItems('" + searchValue + "', " + maxResultCount+ ")", () => { - var items = this.languageService.getNavigateToItems(searchValue); + var items = this.languageService.getNavigateToItems(searchValue, maxResultCount); return items; }); } diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 426bd732882..8b7dea13ead 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -295,8 +295,8 @@ module ts.SignatureHelp { var tagExpression = templateExpression.parent; Debug.assert(templateExpression.kind === SyntaxKind.TemplateExpression); - // If we're just after a template tail, don't show signature help. - if (node.kind === SyntaxKind.TemplateTail && position >= node.getEnd() && !(node).isUnterminated) { + // If we're just after a template tail, don't show signature help. + if (node.kind === SyntaxKind.TemplateTail && !isInsideTemplateLiteral(node, position)) { return undefined; } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 10d00398160..13156523045 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -6,12 +6,11 @@ module ts { } export function getEndLinePosition(line: number, sourceFile: SourceFile): number { - Debug.assert(line >= 1); + Debug.assert(line >= 0); var lineStarts = sourceFile.getLineStarts(); - // lines returned by SourceFile.getLineAndCharacterForPosition are 1-based - var lineIndex = line - 1; - if (lineIndex === lineStarts.length - 1) { + var lineIndex = line; + if (lineIndex + 1 === lineStarts.length) { // last line - return EOF return sourceFile.text.length - 1; } @@ -32,15 +31,10 @@ module ts { } } - export function getStartPositionOfLine(line: number, sourceFile: SourceFile): number { - Debug.assert(line >= 1); - return sourceFile.getLineStarts()[line - 1]; - } - - export function getStartLinePositionForPosition(position: number, sourceFile: SourceFile): number { + export function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number { var lineStarts = sourceFile.getLineStarts(); - var line = sourceFile.getLineAndCharacterFromPosition(position).line; - return lineStarts[line - 1]; + var line = sourceFile.getLineAndCharacterOfPosition(position).line; + return lineStarts[line]; } export function rangeContainsRange(r1: TextRange, r2: TextRange): boolean { diff --git a/tests/baselines/reference/2dArrays.js b/tests/baselines/reference/2dArrays.js index 7840f3d8c54..fe8ab380ba7 100644 --- a/tests/baselines/reference/2dArrays.js +++ b/tests/baselines/reference/2dArrays.js @@ -30,9 +30,7 @@ var Board = (function () { function Board() { } Board.prototype.allShipsSunk = function () { - return this.ships.every(function (val) { - return val.isSunk; - }); + return this.ships.every(function (val) { return val.isSunk; }); }; return Board; })(); diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 49eed12dc70..ae9a91e9e4e 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -21,8 +21,8 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); allDiagnostics.forEach(diagnostic => { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); }); var exitCode = emitResult.emitSkipped ? 1 : 0; @@ -181,118 +181,121 @@ declare module "typescript" { NumberKeyword = 119, SetKeyword = 120, StringKeyword = 121, - TypeKeyword = 122, - QualifiedName = 123, - ComputedPropertyName = 124, - TypeParameter = 125, - Parameter = 126, - PropertySignature = 127, - PropertyDeclaration = 128, - MethodSignature = 129, - MethodDeclaration = 130, - Constructor = 131, - GetAccessor = 132, - SetAccessor = 133, - CallSignature = 134, - ConstructSignature = 135, - IndexSignature = 136, - TypeReference = 137, - FunctionType = 138, - ConstructorType = 139, - TypeQuery = 140, - TypeLiteral = 141, - ArrayType = 142, - TupleType = 143, - UnionType = 144, - ParenthesizedType = 145, - ObjectBindingPattern = 146, - ArrayBindingPattern = 147, - BindingElement = 148, - ArrayLiteralExpression = 149, - ObjectLiteralExpression = 150, - PropertyAccessExpression = 151, - ElementAccessExpression = 152, - CallExpression = 153, - NewExpression = 154, - TaggedTemplateExpression = 155, - TypeAssertionExpression = 156, - ParenthesizedExpression = 157, - FunctionExpression = 158, - ArrowFunction = 159, - DeleteExpression = 160, - TypeOfExpression = 161, - VoidExpression = 162, - PrefixUnaryExpression = 163, - PostfixUnaryExpression = 164, - BinaryExpression = 165, - ConditionalExpression = 166, - TemplateExpression = 167, - YieldExpression = 168, - SpreadElementExpression = 169, - OmittedExpression = 170, - TemplateSpan = 171, - Block = 172, - VariableStatement = 173, - EmptyStatement = 174, - ExpressionStatement = 175, - IfStatement = 176, - DoStatement = 177, - WhileStatement = 178, - ForStatement = 179, - ForInStatement = 180, - ContinueStatement = 181, - BreakStatement = 182, - ReturnStatement = 183, - WithStatement = 184, - SwitchStatement = 185, - LabeledStatement = 186, - ThrowStatement = 187, - TryStatement = 188, - DebuggerStatement = 189, - VariableDeclaration = 190, - VariableDeclarationList = 191, - FunctionDeclaration = 192, - ClassDeclaration = 193, - InterfaceDeclaration = 194, - TypeAliasDeclaration = 195, - EnumDeclaration = 196, - ModuleDeclaration = 197, - ModuleBlock = 198, - ImportEqualsDeclaration = 199, - ImportDeclaration = 200, - ImportClause = 201, - NamespaceImport = 202, - NamedImports = 203, - ImportSpecifier = 204, - ExportAssignment = 205, - ExportDeclaration = 206, - NamedExports = 207, - ExportSpecifier = 208, - ExternalModuleReference = 209, - CaseClause = 210, - DefaultClause = 211, - HeritageClause = 212, - CatchClause = 213, - PropertyAssignment = 214, - ShorthandPropertyAssignment = 215, - EnumMember = 216, - SourceFile = 217, - SyntaxList = 218, - Count = 219, + SymbolKeyword = 122, + TypeKeyword = 123, + OfKeyword = 124, + QualifiedName = 125, + ComputedPropertyName = 126, + TypeParameter = 127, + Parameter = 128, + PropertySignature = 129, + PropertyDeclaration = 130, + MethodSignature = 131, + MethodDeclaration = 132, + Constructor = 133, + GetAccessor = 134, + SetAccessor = 135, + CallSignature = 136, + ConstructSignature = 137, + IndexSignature = 138, + TypeReference = 139, + FunctionType = 140, + ConstructorType = 141, + TypeQuery = 142, + TypeLiteral = 143, + ArrayType = 144, + TupleType = 145, + UnionType = 146, + ParenthesizedType = 147, + ObjectBindingPattern = 148, + ArrayBindingPattern = 149, + BindingElement = 150, + ArrayLiteralExpression = 151, + ObjectLiteralExpression = 152, + PropertyAccessExpression = 153, + ElementAccessExpression = 154, + CallExpression = 155, + NewExpression = 156, + TaggedTemplateExpression = 157, + TypeAssertionExpression = 158, + ParenthesizedExpression = 159, + FunctionExpression = 160, + ArrowFunction = 161, + DeleteExpression = 162, + TypeOfExpression = 163, + VoidExpression = 164, + PrefixUnaryExpression = 165, + PostfixUnaryExpression = 166, + BinaryExpression = 167, + ConditionalExpression = 168, + TemplateExpression = 169, + YieldExpression = 170, + SpreadElementExpression = 171, + OmittedExpression = 172, + TemplateSpan = 173, + Block = 174, + VariableStatement = 175, + EmptyStatement = 176, + ExpressionStatement = 177, + IfStatement = 178, + DoStatement = 179, + WhileStatement = 180, + ForStatement = 181, + ForInStatement = 182, + ForOfStatement = 183, + ContinueStatement = 184, + BreakStatement = 185, + ReturnStatement = 186, + WithStatement = 187, + SwitchStatement = 188, + LabeledStatement = 189, + ThrowStatement = 190, + TryStatement = 191, + DebuggerStatement = 192, + VariableDeclaration = 193, + VariableDeclarationList = 194, + FunctionDeclaration = 195, + ClassDeclaration = 196, + InterfaceDeclaration = 197, + TypeAliasDeclaration = 198, + EnumDeclaration = 199, + ModuleDeclaration = 200, + ModuleBlock = 201, + ImportEqualsDeclaration = 202, + ImportDeclaration = 203, + ImportClause = 204, + NamespaceImport = 205, + NamedImports = 206, + ImportSpecifier = 207, + ExportAssignment = 208, + ExportDeclaration = 209, + NamedExports = 210, + ExportSpecifier = 211, + ExternalModuleReference = 212, + CaseClause = 213, + DefaultClause = 214, + HeritageClause = 215, + CatchClause = 216, + PropertyAssignment = 217, + ShorthandPropertyAssignment = 218, + EnumMember = 219, + SourceFile = 220, + SyntaxList = 221, + Count = 222, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 122, + LastKeyword = 124, FirstFutureReservedWord = 103, LastFutureReservedWord = 111, - FirstTypeNode = 137, - LastTypeNode = 145, + FirstTypeNode = 139, + LastTypeNode = 147, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 122, + LastToken = 124, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -301,7 +304,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 123, + FirstNode = 125, } const enum NodeFlags { Export = 1, @@ -534,7 +537,7 @@ declare module "typescript" { } interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } interface ConditionalExpression extends Expression { @@ -632,6 +635,10 @@ declare module "typescript" { initializer: VariableDeclarationList | Expression; expression: Expression; } + interface ForOfStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } interface BreakOrContinueStatement extends Statement { label?: Identifier; } @@ -762,7 +769,10 @@ declare module "typescript" { endOfFileToken: Node; fileName: string; text: string; - amdDependencies: string[]; + amdDependencies: { + path: string; + name: string; + }[]; amdModuleName: string; referencedFiles: FileReference[]; hasNoDefaultLib: boolean; @@ -1070,8 +1080,9 @@ declare module "typescript" { ObjectLiteral = 131072, ContainsUndefinedOrNull = 262144, ContainsObjectLiteral = 524288, - Intrinsic = 127, - Primitive = 510, + ESSymbol = 1048576, + Intrinsic = 1048703, + Primitive = 1049086, StringLike = 258, NumberLike = 132, ObjectType = 48128, @@ -1357,6 +1368,7 @@ declare module "typescript" { equals = 61, exclamation = 33, greaterThan = 62, + hash = 35, lessThan = 60, minus = 45, openBrace = 123, @@ -1423,8 +1435,8 @@ declare module "typescript" { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; @@ -1508,9 +1520,9 @@ declare module "typescript" { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** @@ -1572,7 +1584,7 @@ declare module "typescript" { getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; @@ -1647,6 +1659,7 @@ declare module "typescript" { InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; + [s: string]: boolean | number | string; } interface DefinitionInfo { fileName: string; @@ -1780,6 +1793,9 @@ declare module "typescript" { InMultiLineCommentTrivia = 1, InSingleQuoteStringLiteral = 2, InDoubleQuoteStringLiteral = 3, + InTemplateHeadOrNoSubstitutionTemplate = 4, + InTemplateMiddleOrTail = 5, + InTemplateSubstitutionPosition = 6, } enum TokenClass { Punctuation = 0, @@ -1801,7 +1817,26 @@ declare module "typescript" { classification: TokenClass; } interface Classifier { - getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult; + /** + * Gives lexical classifications of tokens on a line without any syntactic context. + * For instance, a token consisting of the text 'string' can be either an identifier + * named 'string' or the keyword 'string', however, because this classifier is not aware, + * it relies on certain heuristics to give acceptable results. For classifications where + * speed trumps accuracy, this function is preferable; however, for true accuracy, the + * syntactic classifier is ideal. In fact, in certain editing scenarios, combining the + * lexical, syntactic, and semantic classifiers may issue the best user experience. + * + * @param text The text of a line to classify. + * @param lexState The state of the lexical classifier at the end of the previous line. + * @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier. + * If there is no syntactic classifier (syntacticClassifierAbsent=true), + * certain heuristics may be used in its place; however, if there is a + * syntactic classifier (syntacticClassifierAbsent=false), certain + * classifications which may be incorrectly categorized will be given + * back as Identifiers in order to allow the syntactic classifier to + * subsume the classification. + */ + getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; } /** * The document registry represents a store of SourceFile objects that can be shared between @@ -1963,8 +1998,8 @@ function compile(fileNames, options) { var emitResult = program.emit(); var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); allDiagnostics.forEach(function (diagnostic) { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(diagnostic.file.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(diagnostic.file.fileName + " (" + (lineChar.line + 1) + "," + (lineChar.character + 1) + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)); }); var exitCode = emitResult.emitSkipped ? 1 : 0; console.log("Process exiting with code '" + exitCode + "'."); @@ -1972,8 +2007,6 @@ function compile(fileNames, options) { } exports.compile = compile; compile(process.argv.slice(2), { - noEmitOnError: true, - noImplicitAny: true, - target: 1 /* ES5 */, - module: 1 /* CommonJS */ + noEmitOnError: true, noImplicitAny: true, + target: 1 /* ES5 */, module: 1 /* CommonJS */ }); diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index 9232f281940..a2f2a706eaa 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -56,27 +56,27 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void >diagnostics : ts.Diagnostic[] allDiagnostics.forEach(diagnostic => { ->allDiagnostics.forEach(diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); }) : void +>allDiagnostics.forEach(diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); }) : void >allDiagnostics.forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void >allDiagnostics : ts.Diagnostic[] >forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void ->diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); } : (diagnostic: ts.Diagnostic) => void +>diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); } : (diagnostic: ts.Diagnostic) => void >diagnostic : ts.Diagnostic - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); >lineChar : ts.LineAndCharacter ->diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start) : ts.LineAndCharacter ->diagnostic.file.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : ts.LineAndCharacter +>diagnostic.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >diagnostic.file : ts.SourceFile >diagnostic : ts.Diagnostic >file : ts.SourceFile ->getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >diagnostic.start : number >diagnostic : ts.Diagnostic >start : number - console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); ->console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`) : any + console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); +>console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`) : any >console.log : any >console : any >log : any @@ -85,9 +85,11 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void >diagnostic : ts.Diagnostic >file : ts.SourceFile >fileName : string +>lineChar.line + 1 : number >lineChar.line : number >lineChar : ts.LineAndCharacter >line : number +>lineChar.character + 1 : number >lineChar.character : number >lineChar : ts.LineAndCharacter >character : number @@ -559,298 +561,307 @@ declare module "typescript" { StringKeyword = 121, >StringKeyword : SyntaxKind - TypeKeyword = 122, + SymbolKeyword = 122, +>SymbolKeyword : SyntaxKind + + TypeKeyword = 123, >TypeKeyword : SyntaxKind - QualifiedName = 123, + OfKeyword = 124, +>OfKeyword : SyntaxKind + + QualifiedName = 125, >QualifiedName : SyntaxKind - ComputedPropertyName = 124, + ComputedPropertyName = 126, >ComputedPropertyName : SyntaxKind - TypeParameter = 125, + TypeParameter = 127, >TypeParameter : SyntaxKind - Parameter = 126, + Parameter = 128, >Parameter : SyntaxKind - PropertySignature = 127, + PropertySignature = 129, >PropertySignature : SyntaxKind - PropertyDeclaration = 128, + PropertyDeclaration = 130, >PropertyDeclaration : SyntaxKind - MethodSignature = 129, + MethodSignature = 131, >MethodSignature : SyntaxKind - MethodDeclaration = 130, + MethodDeclaration = 132, >MethodDeclaration : SyntaxKind - Constructor = 131, + Constructor = 133, >Constructor : SyntaxKind - GetAccessor = 132, + GetAccessor = 134, >GetAccessor : SyntaxKind - SetAccessor = 133, + SetAccessor = 135, >SetAccessor : SyntaxKind - CallSignature = 134, + CallSignature = 136, >CallSignature : SyntaxKind - ConstructSignature = 135, + ConstructSignature = 137, >ConstructSignature : SyntaxKind - IndexSignature = 136, + IndexSignature = 138, >IndexSignature : SyntaxKind - TypeReference = 137, + TypeReference = 139, >TypeReference : SyntaxKind - FunctionType = 138, + FunctionType = 140, >FunctionType : SyntaxKind - ConstructorType = 139, + ConstructorType = 141, >ConstructorType : SyntaxKind - TypeQuery = 140, + TypeQuery = 142, >TypeQuery : SyntaxKind - TypeLiteral = 141, + TypeLiteral = 143, >TypeLiteral : SyntaxKind - ArrayType = 142, + ArrayType = 144, >ArrayType : SyntaxKind - TupleType = 143, + TupleType = 145, >TupleType : SyntaxKind - UnionType = 144, + UnionType = 146, >UnionType : SyntaxKind - ParenthesizedType = 145, + ParenthesizedType = 147, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 146, + ObjectBindingPattern = 148, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 147, + ArrayBindingPattern = 149, >ArrayBindingPattern : SyntaxKind - BindingElement = 148, + BindingElement = 150, >BindingElement : SyntaxKind - ArrayLiteralExpression = 149, + ArrayLiteralExpression = 151, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 150, + ObjectLiteralExpression = 152, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 151, + PropertyAccessExpression = 153, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 152, + ElementAccessExpression = 154, >ElementAccessExpression : SyntaxKind - CallExpression = 153, + CallExpression = 155, >CallExpression : SyntaxKind - NewExpression = 154, + NewExpression = 156, >NewExpression : SyntaxKind - TaggedTemplateExpression = 155, + TaggedTemplateExpression = 157, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 156, + TypeAssertionExpression = 158, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 157, + ParenthesizedExpression = 159, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 158, + FunctionExpression = 160, >FunctionExpression : SyntaxKind - ArrowFunction = 159, + ArrowFunction = 161, >ArrowFunction : SyntaxKind - DeleteExpression = 160, + DeleteExpression = 162, >DeleteExpression : SyntaxKind - TypeOfExpression = 161, + TypeOfExpression = 163, >TypeOfExpression : SyntaxKind - VoidExpression = 162, + VoidExpression = 164, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 163, + PrefixUnaryExpression = 165, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 164, + PostfixUnaryExpression = 166, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 165, + BinaryExpression = 167, >BinaryExpression : SyntaxKind - ConditionalExpression = 166, + ConditionalExpression = 168, >ConditionalExpression : SyntaxKind - TemplateExpression = 167, + TemplateExpression = 169, >TemplateExpression : SyntaxKind - YieldExpression = 168, + YieldExpression = 170, >YieldExpression : SyntaxKind - SpreadElementExpression = 169, + SpreadElementExpression = 171, >SpreadElementExpression : SyntaxKind - OmittedExpression = 170, + OmittedExpression = 172, >OmittedExpression : SyntaxKind - TemplateSpan = 171, + TemplateSpan = 173, >TemplateSpan : SyntaxKind - Block = 172, + Block = 174, >Block : SyntaxKind - VariableStatement = 173, + VariableStatement = 175, >VariableStatement : SyntaxKind - EmptyStatement = 174, + EmptyStatement = 176, >EmptyStatement : SyntaxKind - ExpressionStatement = 175, + ExpressionStatement = 177, >ExpressionStatement : SyntaxKind - IfStatement = 176, + IfStatement = 178, >IfStatement : SyntaxKind - DoStatement = 177, + DoStatement = 179, >DoStatement : SyntaxKind - WhileStatement = 178, + WhileStatement = 180, >WhileStatement : SyntaxKind - ForStatement = 179, + ForStatement = 181, >ForStatement : SyntaxKind - ForInStatement = 180, + ForInStatement = 182, >ForInStatement : SyntaxKind - ContinueStatement = 181, + ForOfStatement = 183, +>ForOfStatement : SyntaxKind + + ContinueStatement = 184, >ContinueStatement : SyntaxKind - BreakStatement = 182, + BreakStatement = 185, >BreakStatement : SyntaxKind - ReturnStatement = 183, + ReturnStatement = 186, >ReturnStatement : SyntaxKind - WithStatement = 184, + WithStatement = 187, >WithStatement : SyntaxKind - SwitchStatement = 185, + SwitchStatement = 188, >SwitchStatement : SyntaxKind - LabeledStatement = 186, + LabeledStatement = 189, >LabeledStatement : SyntaxKind - ThrowStatement = 187, + ThrowStatement = 190, >ThrowStatement : SyntaxKind - TryStatement = 188, + TryStatement = 191, >TryStatement : SyntaxKind - DebuggerStatement = 189, + DebuggerStatement = 192, >DebuggerStatement : SyntaxKind - VariableDeclaration = 190, + VariableDeclaration = 193, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 191, + VariableDeclarationList = 194, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 192, + FunctionDeclaration = 195, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 193, + ClassDeclaration = 196, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 194, + InterfaceDeclaration = 197, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 195, + TypeAliasDeclaration = 198, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 196, + EnumDeclaration = 199, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 197, + ModuleDeclaration = 200, >ModuleDeclaration : SyntaxKind - ModuleBlock = 198, + ModuleBlock = 201, >ModuleBlock : SyntaxKind - ImportEqualsDeclaration = 199, + ImportEqualsDeclaration = 202, >ImportEqualsDeclaration : SyntaxKind - ImportDeclaration = 200, + ImportDeclaration = 203, >ImportDeclaration : SyntaxKind - ImportClause = 201, + ImportClause = 204, >ImportClause : SyntaxKind - NamespaceImport = 202, + NamespaceImport = 205, >NamespaceImport : SyntaxKind - NamedImports = 203, + NamedImports = 206, >NamedImports : SyntaxKind - ImportSpecifier = 204, + ImportSpecifier = 207, >ImportSpecifier : SyntaxKind - ExportAssignment = 205, + ExportAssignment = 208, >ExportAssignment : SyntaxKind - ExportDeclaration = 206, + ExportDeclaration = 209, >ExportDeclaration : SyntaxKind - NamedExports = 207, + NamedExports = 210, >NamedExports : SyntaxKind - ExportSpecifier = 208, + ExportSpecifier = 211, >ExportSpecifier : SyntaxKind - ExternalModuleReference = 209, + ExternalModuleReference = 212, >ExternalModuleReference : SyntaxKind - CaseClause = 210, + CaseClause = 213, >CaseClause : SyntaxKind - DefaultClause = 211, + DefaultClause = 214, >DefaultClause : SyntaxKind - HeritageClause = 212, + HeritageClause = 215, >HeritageClause : SyntaxKind - CatchClause = 213, + CatchClause = 216, >CatchClause : SyntaxKind - PropertyAssignment = 214, + PropertyAssignment = 217, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 215, + ShorthandPropertyAssignment = 218, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 216, + EnumMember = 219, >EnumMember : SyntaxKind - SourceFile = 217, + SourceFile = 220, >SourceFile : SyntaxKind - SyntaxList = 218, + SyntaxList = 221, >SyntaxList : SyntaxKind - Count = 219, + Count = 222, >Count : SyntaxKind FirstAssignment = 52, @@ -868,7 +879,7 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 122, + LastKeyword = 124, >LastKeyword : SyntaxKind FirstFutureReservedWord = 103, @@ -877,10 +888,10 @@ declare module "typescript" { LastFutureReservedWord = 111, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 137, + FirstTypeNode = 139, >FirstTypeNode : SyntaxKind - LastTypeNode = 145, + LastTypeNode = 147, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -892,7 +903,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 122, + LastToken = 124, >LastToken : SyntaxKind FirstTriviaToken = 2, @@ -919,7 +930,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 123, + FirstNode = 125, >FirstNode : SyntaxKind } const enum NodeFlags { @@ -1606,9 +1617,9 @@ declare module "typescript" { >left : Expression >Expression : Expression - operator: SyntaxKind; ->operator : SyntaxKind ->SyntaxKind : SyntaxKind + operatorToken: Node; +>operatorToken : Node +>Node : Node right: Expression; >right : Expression @@ -1900,6 +1911,19 @@ declare module "typescript" { expression: Expression; >expression : Expression +>Expression : Expression + } + interface ForOfStatement extends IterationStatement { +>ForOfStatement : ForOfStatement +>IterationStatement : IterationStatement + + initializer: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + expression: Expression; +>expression : Expression >Expression : Expression } interface BreakOrContinueStatement extends Statement { @@ -2318,9 +2342,16 @@ declare module "typescript" { text: string; >text : string - amdDependencies: string[]; ->amdDependencies : string[] + amdDependencies: { +>amdDependencies : { path: string; name: string; }[] + path: string; +>path : string + + name: string; +>name : string + + }[]; amdModuleName: string; >amdModuleName : string @@ -3447,10 +3478,13 @@ declare module "typescript" { ContainsObjectLiteral = 524288, >ContainsObjectLiteral : TypeFlags - Intrinsic = 127, + ESSymbol = 1048576, +>ESSymbol : TypeFlags + + Intrinsic = 1048703, >Intrinsic : TypeFlags - Primitive = 510, + Primitive = 1049086, >Primitive : TypeFlags StringLike = 258, @@ -4292,6 +4326,9 @@ declare module "typescript" { greaterThan = 62, >greaterThan : CharacterCodes + hash = 35, +>hash : CharacterCodes + lessThan = 60, >lessThan : CharacterCodes @@ -4497,15 +4534,15 @@ declare module "typescript" { >computeLineStarts : (text: string) => number[] >text : string - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; ->getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number >sourceFile : SourceFile >SourceFile : SourceFile >line : number >character : number - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; ->computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number >lineStarts : number[] >line : number >character : number @@ -4864,16 +4901,16 @@ declare module "typescript" { >getNamedDeclarations : () => Declaration[] >Declaration : Declaration - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; ->getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter >pos : number >LineAndCharacter : LineAndCharacter getLineStarts(): number[]; >getLineStarts : () => number[] - getPositionFromLineAndCharacter(line: number, character: number): number; ->getPositionFromLineAndCharacter : (line: number, character: number) => number + getPositionOfLineAndCharacter(line: number, character: number): number; +>getPositionOfLineAndCharacter : (line: number, character: number) => number >line : number >character : number @@ -5090,9 +5127,10 @@ declare module "typescript" { >position : number >ReferenceEntry : ReferenceEntry - getNavigateToItems(searchValue: string): NavigateToItem[]; ->getNavigateToItems : (searchValue: string) => NavigateToItem[] + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; +>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[] >searchValue : string +>maxResultCount : number >NavigateToItem : NavigateToItem getNavigationBarItems(fileName: string): NavigationBarItem[]; @@ -5331,6 +5369,9 @@ declare module "typescript" { PlaceOpenBraceOnNewLineForControlBlocks: boolean; >PlaceOpenBraceOnNewLineForControlBlocks : boolean + + [s: string]: boolean | number | string; +>s : string } interface DefinitionInfo { >DefinitionInfo : DefinitionInfo @@ -5668,6 +5709,15 @@ declare module "typescript" { InDoubleQuoteStringLiteral = 3, >InDoubleQuoteStringLiteral : EndOfLineState + + InTemplateHeadOrNoSubstitutionTemplate = 4, +>InTemplateHeadOrNoSubstitutionTemplate : EndOfLineState + + InTemplateMiddleOrTail = 5, +>InTemplateMiddleOrTail : EndOfLineState + + InTemplateSubstitutionPosition = 6, +>InTemplateSubstitutionPosition : EndOfLineState } enum TokenClass { >TokenClass : TokenClass @@ -5723,12 +5773,31 @@ declare module "typescript" { interface Classifier { >Classifier : Classifier - getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult; ->getClassificationsForLine : (text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean) => ClassificationResult + /** + * Gives lexical classifications of tokens on a line without any syntactic context. + * For instance, a token consisting of the text 'string' can be either an identifier + * named 'string' or the keyword 'string', however, because this classifier is not aware, + * it relies on certain heuristics to give acceptable results. For classifications where + * speed trumps accuracy, this function is preferable; however, for true accuracy, the + * syntactic classifier is ideal. In fact, in certain editing scenarios, combining the + * lexical, syntactic, and semantic classifiers may issue the best user experience. + * + * @param text The text of a line to classify. + * @param lexState The state of the lexical classifier at the end of the previous line. + * @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier. + * If there is no syntactic classifier (syntacticClassifierAbsent=true), + * certain heuristics may be used in its place; however, if there is a + * syntactic classifier (syntacticClassifierAbsent=false), certain + * classifications which may be incorrectly categorized will be given + * back as Identifiers in order to allow the syntactic classifier to + * subsume the classification. + */ + getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; +>getClassificationsForLine : (text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean) => ClassificationResult >text : string >lexState : EndOfLineState >EndOfLineState : EndOfLineState ->classifyKeywordsInGenerics : boolean +>syntacticClassifierAbsent : boolean >ClassificationResult : ClassificationResult } /** diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 9af13574ae6..13b3e4f068a 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -39,7 +39,7 @@ export function delint(sourceFile: ts.SourceFile) { break; case ts.SyntaxKind.BinaryExpression: - var op = (node).operator; + var op = (node).operatorToken.kind; if (op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken) { report(node, "Use '===' and '!=='.") @@ -51,8 +51,8 @@ export function delint(sourceFile: ts.SourceFile) { } function report(node: ts.Node, message: string) { - var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart()); - console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) + var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart()); + console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) } } @@ -212,118 +212,121 @@ declare module "typescript" { NumberKeyword = 119, SetKeyword = 120, StringKeyword = 121, - TypeKeyword = 122, - QualifiedName = 123, - ComputedPropertyName = 124, - TypeParameter = 125, - Parameter = 126, - PropertySignature = 127, - PropertyDeclaration = 128, - MethodSignature = 129, - MethodDeclaration = 130, - Constructor = 131, - GetAccessor = 132, - SetAccessor = 133, - CallSignature = 134, - ConstructSignature = 135, - IndexSignature = 136, - TypeReference = 137, - FunctionType = 138, - ConstructorType = 139, - TypeQuery = 140, - TypeLiteral = 141, - ArrayType = 142, - TupleType = 143, - UnionType = 144, - ParenthesizedType = 145, - ObjectBindingPattern = 146, - ArrayBindingPattern = 147, - BindingElement = 148, - ArrayLiteralExpression = 149, - ObjectLiteralExpression = 150, - PropertyAccessExpression = 151, - ElementAccessExpression = 152, - CallExpression = 153, - NewExpression = 154, - TaggedTemplateExpression = 155, - TypeAssertionExpression = 156, - ParenthesizedExpression = 157, - FunctionExpression = 158, - ArrowFunction = 159, - DeleteExpression = 160, - TypeOfExpression = 161, - VoidExpression = 162, - PrefixUnaryExpression = 163, - PostfixUnaryExpression = 164, - BinaryExpression = 165, - ConditionalExpression = 166, - TemplateExpression = 167, - YieldExpression = 168, - SpreadElementExpression = 169, - OmittedExpression = 170, - TemplateSpan = 171, - Block = 172, - VariableStatement = 173, - EmptyStatement = 174, - ExpressionStatement = 175, - IfStatement = 176, - DoStatement = 177, - WhileStatement = 178, - ForStatement = 179, - ForInStatement = 180, - ContinueStatement = 181, - BreakStatement = 182, - ReturnStatement = 183, - WithStatement = 184, - SwitchStatement = 185, - LabeledStatement = 186, - ThrowStatement = 187, - TryStatement = 188, - DebuggerStatement = 189, - VariableDeclaration = 190, - VariableDeclarationList = 191, - FunctionDeclaration = 192, - ClassDeclaration = 193, - InterfaceDeclaration = 194, - TypeAliasDeclaration = 195, - EnumDeclaration = 196, - ModuleDeclaration = 197, - ModuleBlock = 198, - ImportEqualsDeclaration = 199, - ImportDeclaration = 200, - ImportClause = 201, - NamespaceImport = 202, - NamedImports = 203, - ImportSpecifier = 204, - ExportAssignment = 205, - ExportDeclaration = 206, - NamedExports = 207, - ExportSpecifier = 208, - ExternalModuleReference = 209, - CaseClause = 210, - DefaultClause = 211, - HeritageClause = 212, - CatchClause = 213, - PropertyAssignment = 214, - ShorthandPropertyAssignment = 215, - EnumMember = 216, - SourceFile = 217, - SyntaxList = 218, - Count = 219, + SymbolKeyword = 122, + TypeKeyword = 123, + OfKeyword = 124, + QualifiedName = 125, + ComputedPropertyName = 126, + TypeParameter = 127, + Parameter = 128, + PropertySignature = 129, + PropertyDeclaration = 130, + MethodSignature = 131, + MethodDeclaration = 132, + Constructor = 133, + GetAccessor = 134, + SetAccessor = 135, + CallSignature = 136, + ConstructSignature = 137, + IndexSignature = 138, + TypeReference = 139, + FunctionType = 140, + ConstructorType = 141, + TypeQuery = 142, + TypeLiteral = 143, + ArrayType = 144, + TupleType = 145, + UnionType = 146, + ParenthesizedType = 147, + ObjectBindingPattern = 148, + ArrayBindingPattern = 149, + BindingElement = 150, + ArrayLiteralExpression = 151, + ObjectLiteralExpression = 152, + PropertyAccessExpression = 153, + ElementAccessExpression = 154, + CallExpression = 155, + NewExpression = 156, + TaggedTemplateExpression = 157, + TypeAssertionExpression = 158, + ParenthesizedExpression = 159, + FunctionExpression = 160, + ArrowFunction = 161, + DeleteExpression = 162, + TypeOfExpression = 163, + VoidExpression = 164, + PrefixUnaryExpression = 165, + PostfixUnaryExpression = 166, + BinaryExpression = 167, + ConditionalExpression = 168, + TemplateExpression = 169, + YieldExpression = 170, + SpreadElementExpression = 171, + OmittedExpression = 172, + TemplateSpan = 173, + Block = 174, + VariableStatement = 175, + EmptyStatement = 176, + ExpressionStatement = 177, + IfStatement = 178, + DoStatement = 179, + WhileStatement = 180, + ForStatement = 181, + ForInStatement = 182, + ForOfStatement = 183, + ContinueStatement = 184, + BreakStatement = 185, + ReturnStatement = 186, + WithStatement = 187, + SwitchStatement = 188, + LabeledStatement = 189, + ThrowStatement = 190, + TryStatement = 191, + DebuggerStatement = 192, + VariableDeclaration = 193, + VariableDeclarationList = 194, + FunctionDeclaration = 195, + ClassDeclaration = 196, + InterfaceDeclaration = 197, + TypeAliasDeclaration = 198, + EnumDeclaration = 199, + ModuleDeclaration = 200, + ModuleBlock = 201, + ImportEqualsDeclaration = 202, + ImportDeclaration = 203, + ImportClause = 204, + NamespaceImport = 205, + NamedImports = 206, + ImportSpecifier = 207, + ExportAssignment = 208, + ExportDeclaration = 209, + NamedExports = 210, + ExportSpecifier = 211, + ExternalModuleReference = 212, + CaseClause = 213, + DefaultClause = 214, + HeritageClause = 215, + CatchClause = 216, + PropertyAssignment = 217, + ShorthandPropertyAssignment = 218, + EnumMember = 219, + SourceFile = 220, + SyntaxList = 221, + Count = 222, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 122, + LastKeyword = 124, FirstFutureReservedWord = 103, LastFutureReservedWord = 111, - FirstTypeNode = 137, - LastTypeNode = 145, + FirstTypeNode = 139, + LastTypeNode = 147, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 122, + LastToken = 124, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -332,7 +335,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 123, + FirstNode = 125, } const enum NodeFlags { Export = 1, @@ -565,7 +568,7 @@ declare module "typescript" { } interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } interface ConditionalExpression extends Expression { @@ -663,6 +666,10 @@ declare module "typescript" { initializer: VariableDeclarationList | Expression; expression: Expression; } + interface ForOfStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } interface BreakOrContinueStatement extends Statement { label?: Identifier; } @@ -793,7 +800,10 @@ declare module "typescript" { endOfFileToken: Node; fileName: string; text: string; - amdDependencies: string[]; + amdDependencies: { + path: string; + name: string; + }[]; amdModuleName: string; referencedFiles: FileReference[]; hasNoDefaultLib: boolean; @@ -1101,8 +1111,9 @@ declare module "typescript" { ObjectLiteral = 131072, ContainsUndefinedOrNull = 262144, ContainsObjectLiteral = 524288, - Intrinsic = 127, - Primitive = 510, + ESSymbol = 1048576, + Intrinsic = 1048703, + Primitive = 1049086, StringLike = 258, NumberLike = 132, ObjectType = 48128, @@ -1388,6 +1399,7 @@ declare module "typescript" { equals = 61, exclamation = 33, greaterThan = 62, + hash = 35, lessThan = 60, minus = 45, openBrace = 123, @@ -1454,8 +1466,8 @@ declare module "typescript" { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; @@ -1539,9 +1551,9 @@ declare module "typescript" { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** @@ -1603,7 +1615,7 @@ declare module "typescript" { getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; @@ -1678,6 +1690,7 @@ declare module "typescript" { InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; + [s: string]: boolean | number | string; } interface DefinitionInfo { fileName: string; @@ -1811,6 +1824,9 @@ declare module "typescript" { InMultiLineCommentTrivia = 1, InSingleQuoteStringLiteral = 2, InDoubleQuoteStringLiteral = 3, + InTemplateHeadOrNoSubstitutionTemplate = 4, + InTemplateMiddleOrTail = 5, + InTemplateSubstitutionPosition = 6, } enum TokenClass { Punctuation = 0, @@ -1832,7 +1848,26 @@ declare module "typescript" { classification: TokenClass; } interface Classifier { - getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult; + /** + * Gives lexical classifications of tokens on a line without any syntactic context. + * For instance, a token consisting of the text 'string' can be either an identifier + * named 'string' or the keyword 'string', however, because this classifier is not aware, + * it relies on certain heuristics to give acceptable results. For classifications where + * speed trumps accuracy, this function is preferable; however, for true accuracy, the + * syntactic classifier is ideal. In fact, in certain editing scenarios, combining the + * lexical, syntactic, and semantic classifiers may issue the best user experience. + * + * @param text The text of a line to classify. + * @param lexState The state of the lexical classifier at the end of the previous line. + * @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier. + * If there is no syntactic classifier (syntacticClassifierAbsent=true), + * certain heuristics may be used in its place; however, if there is a + * syntactic classifier (syntacticClassifierAbsent=false), certain + * classifications which may be incorrectly categorized will be given + * back as Identifiers in order to allow the syntactic classifier to + * subsume the classification. + */ + getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; } /** * The document registry represents a store of SourceFile objects that can be shared between @@ -1993,25 +2028,26 @@ function delint(sourceFile) { delintNode(sourceFile); function delintNode(node) { switch (node.kind) { - case 179 /* ForStatement */: - case 180 /* ForInStatement */: - case 178 /* WhileStatement */: - case 177 /* DoStatement */: - if (node.statement.kind !== 172 /* Block */) { + case 181 /* ForStatement */: + case 182 /* ForInStatement */: + case 180 /* WhileStatement */: + case 179 /* DoStatement */: + if (node.statement.kind !== 174 /* Block */) { report(node, "A looping statement's contents should be wrapped in a block body."); } break; - case 176 /* IfStatement */: + case 178 /* IfStatement */: var ifStatement = node; - if (ifStatement.thenStatement.kind !== 172 /* Block */) { + if (ifStatement.thenStatement.kind !== 174 /* Block */) { report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body."); } - if (ifStatement.elseStatement && ifStatement.elseStatement.kind !== 172 /* Block */ && ifStatement.elseStatement.kind !== 176 /* IfStatement */) { + if (ifStatement.elseStatement && + ifStatement.elseStatement.kind !== 174 /* Block */ && ifStatement.elseStatement.kind !== 178 /* IfStatement */) { report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body."); } break; - case 165 /* BinaryExpression */: - var op = node.operator; + case 167 /* BinaryExpression */: + var op = node.operatorToken.kind; if (op === 28 /* EqualsEqualsToken */ || op === 29 /* ExclamationEqualsToken */) { report(node, "Use '===' and '!=='."); } @@ -2020,8 +2056,8 @@ function delint(sourceFile) { ts.forEachChild(node, delintNode); } function report(node, message) { - var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart()); - console.log(sourceFile.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + message); + var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart()); + console.log(sourceFile.fileName + " (" + (lineChar.line + 1) + "," + (lineChar.character + 1) + "): " + message); } } exports.delint = delint; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index dc30fedce35..0adce16104c 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -173,15 +173,17 @@ export function delint(sourceFile: ts.SourceFile) { >SyntaxKind : typeof ts.SyntaxKind >BinaryExpression : ts.SyntaxKind - var op = (node).operator; + var op = (node).operatorToken.kind; >op : ts.SyntaxKind ->(node).operator : ts.SyntaxKind +>(node).operatorToken.kind : ts.SyntaxKind +>(node).operatorToken : ts.Node >(node) : ts.BinaryExpression >node : ts.BinaryExpression >ts : unknown >BinaryExpression : ts.BinaryExpression >node : ts.Node ->operator : ts.SyntaxKind +>operatorToken : ts.Node +>kind : ts.SyntaxKind if (op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken) { >op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken : boolean @@ -224,28 +226,30 @@ export function delint(sourceFile: ts.SourceFile) { >Node : ts.Node >message : string - var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart()); + var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart()); >lineChar : ts.LineAndCharacter ->sourceFile.getLineAndCharacterFromPosition(node.getStart()) : ts.LineAndCharacter ->sourceFile.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>sourceFile.getLineAndCharacterOfPosition(node.getStart()) : ts.LineAndCharacter +>sourceFile.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >sourceFile : ts.SourceFile ->getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >node.getStart() : number >node.getStart : (sourceFile?: ts.SourceFile) => number >node : ts.Node >getStart : (sourceFile?: ts.SourceFile) => number - console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) ->console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) : any + console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) +>console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) : any >console.log : any >console : any >log : any >sourceFile.fileName : string >sourceFile : ts.SourceFile >fileName : string +>lineChar.line + 1 : number >lineChar.line : number >lineChar : ts.LineAndCharacter >line : number +>lineChar.character + 1 : number >lineChar.character : number >lineChar : ts.LineAndCharacter >character : number @@ -703,298 +707,307 @@ declare module "typescript" { StringKeyword = 121, >StringKeyword : SyntaxKind - TypeKeyword = 122, + SymbolKeyword = 122, +>SymbolKeyword : SyntaxKind + + TypeKeyword = 123, >TypeKeyword : SyntaxKind - QualifiedName = 123, + OfKeyword = 124, +>OfKeyword : SyntaxKind + + QualifiedName = 125, >QualifiedName : SyntaxKind - ComputedPropertyName = 124, + ComputedPropertyName = 126, >ComputedPropertyName : SyntaxKind - TypeParameter = 125, + TypeParameter = 127, >TypeParameter : SyntaxKind - Parameter = 126, + Parameter = 128, >Parameter : SyntaxKind - PropertySignature = 127, + PropertySignature = 129, >PropertySignature : SyntaxKind - PropertyDeclaration = 128, + PropertyDeclaration = 130, >PropertyDeclaration : SyntaxKind - MethodSignature = 129, + MethodSignature = 131, >MethodSignature : SyntaxKind - MethodDeclaration = 130, + MethodDeclaration = 132, >MethodDeclaration : SyntaxKind - Constructor = 131, + Constructor = 133, >Constructor : SyntaxKind - GetAccessor = 132, + GetAccessor = 134, >GetAccessor : SyntaxKind - SetAccessor = 133, + SetAccessor = 135, >SetAccessor : SyntaxKind - CallSignature = 134, + CallSignature = 136, >CallSignature : SyntaxKind - ConstructSignature = 135, + ConstructSignature = 137, >ConstructSignature : SyntaxKind - IndexSignature = 136, + IndexSignature = 138, >IndexSignature : SyntaxKind - TypeReference = 137, + TypeReference = 139, >TypeReference : SyntaxKind - FunctionType = 138, + FunctionType = 140, >FunctionType : SyntaxKind - ConstructorType = 139, + ConstructorType = 141, >ConstructorType : SyntaxKind - TypeQuery = 140, + TypeQuery = 142, >TypeQuery : SyntaxKind - TypeLiteral = 141, + TypeLiteral = 143, >TypeLiteral : SyntaxKind - ArrayType = 142, + ArrayType = 144, >ArrayType : SyntaxKind - TupleType = 143, + TupleType = 145, >TupleType : SyntaxKind - UnionType = 144, + UnionType = 146, >UnionType : SyntaxKind - ParenthesizedType = 145, + ParenthesizedType = 147, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 146, + ObjectBindingPattern = 148, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 147, + ArrayBindingPattern = 149, >ArrayBindingPattern : SyntaxKind - BindingElement = 148, + BindingElement = 150, >BindingElement : SyntaxKind - ArrayLiteralExpression = 149, + ArrayLiteralExpression = 151, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 150, + ObjectLiteralExpression = 152, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 151, + PropertyAccessExpression = 153, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 152, + ElementAccessExpression = 154, >ElementAccessExpression : SyntaxKind - CallExpression = 153, + CallExpression = 155, >CallExpression : SyntaxKind - NewExpression = 154, + NewExpression = 156, >NewExpression : SyntaxKind - TaggedTemplateExpression = 155, + TaggedTemplateExpression = 157, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 156, + TypeAssertionExpression = 158, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 157, + ParenthesizedExpression = 159, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 158, + FunctionExpression = 160, >FunctionExpression : SyntaxKind - ArrowFunction = 159, + ArrowFunction = 161, >ArrowFunction : SyntaxKind - DeleteExpression = 160, + DeleteExpression = 162, >DeleteExpression : SyntaxKind - TypeOfExpression = 161, + TypeOfExpression = 163, >TypeOfExpression : SyntaxKind - VoidExpression = 162, + VoidExpression = 164, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 163, + PrefixUnaryExpression = 165, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 164, + PostfixUnaryExpression = 166, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 165, + BinaryExpression = 167, >BinaryExpression : SyntaxKind - ConditionalExpression = 166, + ConditionalExpression = 168, >ConditionalExpression : SyntaxKind - TemplateExpression = 167, + TemplateExpression = 169, >TemplateExpression : SyntaxKind - YieldExpression = 168, + YieldExpression = 170, >YieldExpression : SyntaxKind - SpreadElementExpression = 169, + SpreadElementExpression = 171, >SpreadElementExpression : SyntaxKind - OmittedExpression = 170, + OmittedExpression = 172, >OmittedExpression : SyntaxKind - TemplateSpan = 171, + TemplateSpan = 173, >TemplateSpan : SyntaxKind - Block = 172, + Block = 174, >Block : SyntaxKind - VariableStatement = 173, + VariableStatement = 175, >VariableStatement : SyntaxKind - EmptyStatement = 174, + EmptyStatement = 176, >EmptyStatement : SyntaxKind - ExpressionStatement = 175, + ExpressionStatement = 177, >ExpressionStatement : SyntaxKind - IfStatement = 176, + IfStatement = 178, >IfStatement : SyntaxKind - DoStatement = 177, + DoStatement = 179, >DoStatement : SyntaxKind - WhileStatement = 178, + WhileStatement = 180, >WhileStatement : SyntaxKind - ForStatement = 179, + ForStatement = 181, >ForStatement : SyntaxKind - ForInStatement = 180, + ForInStatement = 182, >ForInStatement : SyntaxKind - ContinueStatement = 181, + ForOfStatement = 183, +>ForOfStatement : SyntaxKind + + ContinueStatement = 184, >ContinueStatement : SyntaxKind - BreakStatement = 182, + BreakStatement = 185, >BreakStatement : SyntaxKind - ReturnStatement = 183, + ReturnStatement = 186, >ReturnStatement : SyntaxKind - WithStatement = 184, + WithStatement = 187, >WithStatement : SyntaxKind - SwitchStatement = 185, + SwitchStatement = 188, >SwitchStatement : SyntaxKind - LabeledStatement = 186, + LabeledStatement = 189, >LabeledStatement : SyntaxKind - ThrowStatement = 187, + ThrowStatement = 190, >ThrowStatement : SyntaxKind - TryStatement = 188, + TryStatement = 191, >TryStatement : SyntaxKind - DebuggerStatement = 189, + DebuggerStatement = 192, >DebuggerStatement : SyntaxKind - VariableDeclaration = 190, + VariableDeclaration = 193, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 191, + VariableDeclarationList = 194, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 192, + FunctionDeclaration = 195, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 193, + ClassDeclaration = 196, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 194, + InterfaceDeclaration = 197, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 195, + TypeAliasDeclaration = 198, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 196, + EnumDeclaration = 199, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 197, + ModuleDeclaration = 200, >ModuleDeclaration : SyntaxKind - ModuleBlock = 198, + ModuleBlock = 201, >ModuleBlock : SyntaxKind - ImportEqualsDeclaration = 199, + ImportEqualsDeclaration = 202, >ImportEqualsDeclaration : SyntaxKind - ImportDeclaration = 200, + ImportDeclaration = 203, >ImportDeclaration : SyntaxKind - ImportClause = 201, + ImportClause = 204, >ImportClause : SyntaxKind - NamespaceImport = 202, + NamespaceImport = 205, >NamespaceImport : SyntaxKind - NamedImports = 203, + NamedImports = 206, >NamedImports : SyntaxKind - ImportSpecifier = 204, + ImportSpecifier = 207, >ImportSpecifier : SyntaxKind - ExportAssignment = 205, + ExportAssignment = 208, >ExportAssignment : SyntaxKind - ExportDeclaration = 206, + ExportDeclaration = 209, >ExportDeclaration : SyntaxKind - NamedExports = 207, + NamedExports = 210, >NamedExports : SyntaxKind - ExportSpecifier = 208, + ExportSpecifier = 211, >ExportSpecifier : SyntaxKind - ExternalModuleReference = 209, + ExternalModuleReference = 212, >ExternalModuleReference : SyntaxKind - CaseClause = 210, + CaseClause = 213, >CaseClause : SyntaxKind - DefaultClause = 211, + DefaultClause = 214, >DefaultClause : SyntaxKind - HeritageClause = 212, + HeritageClause = 215, >HeritageClause : SyntaxKind - CatchClause = 213, + CatchClause = 216, >CatchClause : SyntaxKind - PropertyAssignment = 214, + PropertyAssignment = 217, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 215, + ShorthandPropertyAssignment = 218, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 216, + EnumMember = 219, >EnumMember : SyntaxKind - SourceFile = 217, + SourceFile = 220, >SourceFile : SyntaxKind - SyntaxList = 218, + SyntaxList = 221, >SyntaxList : SyntaxKind - Count = 219, + Count = 222, >Count : SyntaxKind FirstAssignment = 52, @@ -1012,7 +1025,7 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 122, + LastKeyword = 124, >LastKeyword : SyntaxKind FirstFutureReservedWord = 103, @@ -1021,10 +1034,10 @@ declare module "typescript" { LastFutureReservedWord = 111, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 137, + FirstTypeNode = 139, >FirstTypeNode : SyntaxKind - LastTypeNode = 145, + LastTypeNode = 147, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -1036,7 +1049,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 122, + LastToken = 124, >LastToken : SyntaxKind FirstTriviaToken = 2, @@ -1063,7 +1076,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 123, + FirstNode = 125, >FirstNode : SyntaxKind } const enum NodeFlags { @@ -1750,9 +1763,9 @@ declare module "typescript" { >left : Expression >Expression : Expression - operator: SyntaxKind; ->operator : SyntaxKind ->SyntaxKind : SyntaxKind + operatorToken: Node; +>operatorToken : Node +>Node : Node right: Expression; >right : Expression @@ -2044,6 +2057,19 @@ declare module "typescript" { expression: Expression; >expression : Expression +>Expression : Expression + } + interface ForOfStatement extends IterationStatement { +>ForOfStatement : ForOfStatement +>IterationStatement : IterationStatement + + initializer: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + expression: Expression; +>expression : Expression >Expression : Expression } interface BreakOrContinueStatement extends Statement { @@ -2462,9 +2488,16 @@ declare module "typescript" { text: string; >text : string - amdDependencies: string[]; ->amdDependencies : string[] + amdDependencies: { +>amdDependencies : { path: string; name: string; }[] + path: string; +>path : string + + name: string; +>name : string + + }[]; amdModuleName: string; >amdModuleName : string @@ -3591,10 +3624,13 @@ declare module "typescript" { ContainsObjectLiteral = 524288, >ContainsObjectLiteral : TypeFlags - Intrinsic = 127, + ESSymbol = 1048576, +>ESSymbol : TypeFlags + + Intrinsic = 1048703, >Intrinsic : TypeFlags - Primitive = 510, + Primitive = 1049086, >Primitive : TypeFlags StringLike = 258, @@ -4436,6 +4472,9 @@ declare module "typescript" { greaterThan = 62, >greaterThan : CharacterCodes + hash = 35, +>hash : CharacterCodes + lessThan = 60, >lessThan : CharacterCodes @@ -4641,15 +4680,15 @@ declare module "typescript" { >computeLineStarts : (text: string) => number[] >text : string - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; ->getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number >sourceFile : SourceFile >SourceFile : SourceFile >line : number >character : number - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; ->computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number >lineStarts : number[] >line : number >character : number @@ -5008,16 +5047,16 @@ declare module "typescript" { >getNamedDeclarations : () => Declaration[] >Declaration : Declaration - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; ->getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter >pos : number >LineAndCharacter : LineAndCharacter getLineStarts(): number[]; >getLineStarts : () => number[] - getPositionFromLineAndCharacter(line: number, character: number): number; ->getPositionFromLineAndCharacter : (line: number, character: number) => number + getPositionOfLineAndCharacter(line: number, character: number): number; +>getPositionOfLineAndCharacter : (line: number, character: number) => number >line : number >character : number @@ -5234,9 +5273,10 @@ declare module "typescript" { >position : number >ReferenceEntry : ReferenceEntry - getNavigateToItems(searchValue: string): NavigateToItem[]; ->getNavigateToItems : (searchValue: string) => NavigateToItem[] + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; +>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[] >searchValue : string +>maxResultCount : number >NavigateToItem : NavigateToItem getNavigationBarItems(fileName: string): NavigationBarItem[]; @@ -5475,6 +5515,9 @@ declare module "typescript" { PlaceOpenBraceOnNewLineForControlBlocks: boolean; >PlaceOpenBraceOnNewLineForControlBlocks : boolean + + [s: string]: boolean | number | string; +>s : string } interface DefinitionInfo { >DefinitionInfo : DefinitionInfo @@ -5812,6 +5855,15 @@ declare module "typescript" { InDoubleQuoteStringLiteral = 3, >InDoubleQuoteStringLiteral : EndOfLineState + + InTemplateHeadOrNoSubstitutionTemplate = 4, +>InTemplateHeadOrNoSubstitutionTemplate : EndOfLineState + + InTemplateMiddleOrTail = 5, +>InTemplateMiddleOrTail : EndOfLineState + + InTemplateSubstitutionPosition = 6, +>InTemplateSubstitutionPosition : EndOfLineState } enum TokenClass { >TokenClass : TokenClass @@ -5867,12 +5919,31 @@ declare module "typescript" { interface Classifier { >Classifier : Classifier - getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult; ->getClassificationsForLine : (text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean) => ClassificationResult + /** + * Gives lexical classifications of tokens on a line without any syntactic context. + * For instance, a token consisting of the text 'string' can be either an identifier + * named 'string' or the keyword 'string', however, because this classifier is not aware, + * it relies on certain heuristics to give acceptable results. For classifications where + * speed trumps accuracy, this function is preferable; however, for true accuracy, the + * syntactic classifier is ideal. In fact, in certain editing scenarios, combining the + * lexical, syntactic, and semantic classifiers may issue the best user experience. + * + * @param text The text of a line to classify. + * @param lexState The state of the lexical classifier at the end of the previous line. + * @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier. + * If there is no syntactic classifier (syntacticClassifierAbsent=true), + * certain heuristics may be used in its place; however, if there is a + * syntactic classifier (syntacticClassifierAbsent=false), certain + * classifications which may be incorrectly categorized will be given + * back as Identifiers in order to allow the syntactic classifier to + * subsume the classification. + */ + getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; +>getClassificationsForLine : (text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean) => ClassificationResult >text : string >lexState : EndOfLineState >EndOfLineState : EndOfLineState ->classifyKeywordsInGenerics : boolean +>syntacticClassifierAbsent : boolean >ClassificationResult : ClassificationResult } /** diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 4b556d8db0e..4d9d0def9d9 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -54,7 +54,7 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { return { outputs: outputs, errors: errors.map(function (e) { - return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) }; @@ -213,118 +213,121 @@ declare module "typescript" { NumberKeyword = 119, SetKeyword = 120, StringKeyword = 121, - TypeKeyword = 122, - QualifiedName = 123, - ComputedPropertyName = 124, - TypeParameter = 125, - Parameter = 126, - PropertySignature = 127, - PropertyDeclaration = 128, - MethodSignature = 129, - MethodDeclaration = 130, - Constructor = 131, - GetAccessor = 132, - SetAccessor = 133, - CallSignature = 134, - ConstructSignature = 135, - IndexSignature = 136, - TypeReference = 137, - FunctionType = 138, - ConstructorType = 139, - TypeQuery = 140, - TypeLiteral = 141, - ArrayType = 142, - TupleType = 143, - UnionType = 144, - ParenthesizedType = 145, - ObjectBindingPattern = 146, - ArrayBindingPattern = 147, - BindingElement = 148, - ArrayLiteralExpression = 149, - ObjectLiteralExpression = 150, - PropertyAccessExpression = 151, - ElementAccessExpression = 152, - CallExpression = 153, - NewExpression = 154, - TaggedTemplateExpression = 155, - TypeAssertionExpression = 156, - ParenthesizedExpression = 157, - FunctionExpression = 158, - ArrowFunction = 159, - DeleteExpression = 160, - TypeOfExpression = 161, - VoidExpression = 162, - PrefixUnaryExpression = 163, - PostfixUnaryExpression = 164, - BinaryExpression = 165, - ConditionalExpression = 166, - TemplateExpression = 167, - YieldExpression = 168, - SpreadElementExpression = 169, - OmittedExpression = 170, - TemplateSpan = 171, - Block = 172, - VariableStatement = 173, - EmptyStatement = 174, - ExpressionStatement = 175, - IfStatement = 176, - DoStatement = 177, - WhileStatement = 178, - ForStatement = 179, - ForInStatement = 180, - ContinueStatement = 181, - BreakStatement = 182, - ReturnStatement = 183, - WithStatement = 184, - SwitchStatement = 185, - LabeledStatement = 186, - ThrowStatement = 187, - TryStatement = 188, - DebuggerStatement = 189, - VariableDeclaration = 190, - VariableDeclarationList = 191, - FunctionDeclaration = 192, - ClassDeclaration = 193, - InterfaceDeclaration = 194, - TypeAliasDeclaration = 195, - EnumDeclaration = 196, - ModuleDeclaration = 197, - ModuleBlock = 198, - ImportEqualsDeclaration = 199, - ImportDeclaration = 200, - ImportClause = 201, - NamespaceImport = 202, - NamedImports = 203, - ImportSpecifier = 204, - ExportAssignment = 205, - ExportDeclaration = 206, - NamedExports = 207, - ExportSpecifier = 208, - ExternalModuleReference = 209, - CaseClause = 210, - DefaultClause = 211, - HeritageClause = 212, - CatchClause = 213, - PropertyAssignment = 214, - ShorthandPropertyAssignment = 215, - EnumMember = 216, - SourceFile = 217, - SyntaxList = 218, - Count = 219, + SymbolKeyword = 122, + TypeKeyword = 123, + OfKeyword = 124, + QualifiedName = 125, + ComputedPropertyName = 126, + TypeParameter = 127, + Parameter = 128, + PropertySignature = 129, + PropertyDeclaration = 130, + MethodSignature = 131, + MethodDeclaration = 132, + Constructor = 133, + GetAccessor = 134, + SetAccessor = 135, + CallSignature = 136, + ConstructSignature = 137, + IndexSignature = 138, + TypeReference = 139, + FunctionType = 140, + ConstructorType = 141, + TypeQuery = 142, + TypeLiteral = 143, + ArrayType = 144, + TupleType = 145, + UnionType = 146, + ParenthesizedType = 147, + ObjectBindingPattern = 148, + ArrayBindingPattern = 149, + BindingElement = 150, + ArrayLiteralExpression = 151, + ObjectLiteralExpression = 152, + PropertyAccessExpression = 153, + ElementAccessExpression = 154, + CallExpression = 155, + NewExpression = 156, + TaggedTemplateExpression = 157, + TypeAssertionExpression = 158, + ParenthesizedExpression = 159, + FunctionExpression = 160, + ArrowFunction = 161, + DeleteExpression = 162, + TypeOfExpression = 163, + VoidExpression = 164, + PrefixUnaryExpression = 165, + PostfixUnaryExpression = 166, + BinaryExpression = 167, + ConditionalExpression = 168, + TemplateExpression = 169, + YieldExpression = 170, + SpreadElementExpression = 171, + OmittedExpression = 172, + TemplateSpan = 173, + Block = 174, + VariableStatement = 175, + EmptyStatement = 176, + ExpressionStatement = 177, + IfStatement = 178, + DoStatement = 179, + WhileStatement = 180, + ForStatement = 181, + ForInStatement = 182, + ForOfStatement = 183, + ContinueStatement = 184, + BreakStatement = 185, + ReturnStatement = 186, + WithStatement = 187, + SwitchStatement = 188, + LabeledStatement = 189, + ThrowStatement = 190, + TryStatement = 191, + DebuggerStatement = 192, + VariableDeclaration = 193, + VariableDeclarationList = 194, + FunctionDeclaration = 195, + ClassDeclaration = 196, + InterfaceDeclaration = 197, + TypeAliasDeclaration = 198, + EnumDeclaration = 199, + ModuleDeclaration = 200, + ModuleBlock = 201, + ImportEqualsDeclaration = 202, + ImportDeclaration = 203, + ImportClause = 204, + NamespaceImport = 205, + NamedImports = 206, + ImportSpecifier = 207, + ExportAssignment = 208, + ExportDeclaration = 209, + NamedExports = 210, + ExportSpecifier = 211, + ExternalModuleReference = 212, + CaseClause = 213, + DefaultClause = 214, + HeritageClause = 215, + CatchClause = 216, + PropertyAssignment = 217, + ShorthandPropertyAssignment = 218, + EnumMember = 219, + SourceFile = 220, + SyntaxList = 221, + Count = 222, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 122, + LastKeyword = 124, FirstFutureReservedWord = 103, LastFutureReservedWord = 111, - FirstTypeNode = 137, - LastTypeNode = 145, + FirstTypeNode = 139, + LastTypeNode = 147, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 122, + LastToken = 124, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -333,7 +336,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 123, + FirstNode = 125, } const enum NodeFlags { Export = 1, @@ -566,7 +569,7 @@ declare module "typescript" { } interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } interface ConditionalExpression extends Expression { @@ -664,6 +667,10 @@ declare module "typescript" { initializer: VariableDeclarationList | Expression; expression: Expression; } + interface ForOfStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } interface BreakOrContinueStatement extends Statement { label?: Identifier; } @@ -794,7 +801,10 @@ declare module "typescript" { endOfFileToken: Node; fileName: string; text: string; - amdDependencies: string[]; + amdDependencies: { + path: string; + name: string; + }[]; amdModuleName: string; referencedFiles: FileReference[]; hasNoDefaultLib: boolean; @@ -1102,8 +1112,9 @@ declare module "typescript" { ObjectLiteral = 131072, ContainsUndefinedOrNull = 262144, ContainsObjectLiteral = 524288, - Intrinsic = 127, - Primitive = 510, + ESSymbol = 1048576, + Intrinsic = 1048703, + Primitive = 1049086, StringLike = 258, NumberLike = 132, ObjectType = 48128, @@ -1389,6 +1400,7 @@ declare module "typescript" { equals = 61, exclamation = 33, greaterThan = 62, + hash = 35, lessThan = 60, minus = 45, openBrace = 123, @@ -1455,8 +1467,8 @@ declare module "typescript" { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; @@ -1540,9 +1552,9 @@ declare module "typescript" { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** @@ -1604,7 +1616,7 @@ declare module "typescript" { getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; @@ -1679,6 +1691,7 @@ declare module "typescript" { InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; + [s: string]: boolean | number | string; } interface DefinitionInfo { fileName: string; @@ -1812,6 +1825,9 @@ declare module "typescript" { InMultiLineCommentTrivia = 1, InSingleQuoteStringLiteral = 2, InDoubleQuoteStringLiteral = 3, + InTemplateHeadOrNoSubstitutionTemplate = 4, + InTemplateMiddleOrTail = 5, + InTemplateSubstitutionPosition = 6, } enum TokenClass { Punctuation = 0, @@ -1833,7 +1849,26 @@ declare module "typescript" { classification: TokenClass; } interface Classifier { - getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult; + /** + * Gives lexical classifications of tokens on a line without any syntactic context. + * For instance, a token consisting of the text 'string' can be either an identifier + * named 'string' or the keyword 'string', however, because this classifier is not aware, + * it relies on certain heuristics to give acceptable results. For classifications where + * speed trumps accuracy, this function is preferable; however, for true accuracy, the + * syntactic classifier is ideal. In fact, in certain editing scenarios, combining the + * lexical, syntactic, and semantic classifiers may issue the best user experience. + * + * @param text The text of a line to classify. + * @param lexState The state of the lexical classifier at the end of the previous line. + * @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier. + * If there is no syntactic classifier (syntacticClassifierAbsent=true), + * certain heuristics may be used in its place; however, if there is a + * syntactic classifier (syntacticClassifierAbsent=false), certain + * classifications which may be incorrectly categorized will be given + * back as Identifiers in order to allow the syntactic classifier to + * subsume the classification. + */ + getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; } /** * The document registry represents a store of SourceFile objects that can be shared between @@ -2022,7 +2057,7 @@ function transform(contents, compilerOptions) { return { outputs: outputs, errors: errors.map(function (e) { - return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); + return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) }; } diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 8eb0fd5c34d..ad758be0ab1 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -177,7 +177,7 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { >diagnostics : ts.Diagnostic[] return { ->{ outputs: outputs, errors: errors.map(function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) } : { outputs: any[]; errors: string[]; } +>{ outputs: outputs, errors: errors.map(function (e) { return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) } : { outputs: any[]; errors: string[]; } outputs: outputs, >outputs : any[] @@ -185,30 +185,32 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { errors: errors.map(function (e) { >errors : string[] ->errors.map(function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) : string[] +>errors.map(function (e) { return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) : string[] >errors.map : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => U, thisArg?: any) => U[] >errors : ts.Diagnostic[] >map : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => U, thisArg?: any) => U[] ->function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); } : (e: ts.Diagnostic) => string +>function (e) { return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); } : (e: ts.Diagnostic) => string >e : ts.Diagnostic - return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " ->e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL) : string ->e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " : string ->e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line : string + return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " +>e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL) : string +>e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " : string +>e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) : string >e.file.fileName + "(" : string >e.file.fileName : string >e.file : ts.SourceFile >e : ts.Diagnostic >file : ts.SourceFile >fileName : string ->e.file.getLineAndCharacterFromPosition(e.start).line : number ->e.file.getLineAndCharacterFromPosition(e.start) : ts.LineAndCharacter ->e.file.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>(e.file.getLineAndCharacterOfPosition(e.start).line + 1) : number +>e.file.getLineAndCharacterOfPosition(e.start).line + 1 : number +>e.file.getLineAndCharacterOfPosition(e.start).line : number +>e.file.getLineAndCharacterOfPosition(e.start) : ts.LineAndCharacter +>e.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >e.file : ts.SourceFile >e : ts.Diagnostic >file : ts.SourceFile ->getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >e.start : number >e : ts.Diagnostic >start : number @@ -655,298 +657,307 @@ declare module "typescript" { StringKeyword = 121, >StringKeyword : SyntaxKind - TypeKeyword = 122, + SymbolKeyword = 122, +>SymbolKeyword : SyntaxKind + + TypeKeyword = 123, >TypeKeyword : SyntaxKind - QualifiedName = 123, + OfKeyword = 124, +>OfKeyword : SyntaxKind + + QualifiedName = 125, >QualifiedName : SyntaxKind - ComputedPropertyName = 124, + ComputedPropertyName = 126, >ComputedPropertyName : SyntaxKind - TypeParameter = 125, + TypeParameter = 127, >TypeParameter : SyntaxKind - Parameter = 126, + Parameter = 128, >Parameter : SyntaxKind - PropertySignature = 127, + PropertySignature = 129, >PropertySignature : SyntaxKind - PropertyDeclaration = 128, + PropertyDeclaration = 130, >PropertyDeclaration : SyntaxKind - MethodSignature = 129, + MethodSignature = 131, >MethodSignature : SyntaxKind - MethodDeclaration = 130, + MethodDeclaration = 132, >MethodDeclaration : SyntaxKind - Constructor = 131, + Constructor = 133, >Constructor : SyntaxKind - GetAccessor = 132, + GetAccessor = 134, >GetAccessor : SyntaxKind - SetAccessor = 133, + SetAccessor = 135, >SetAccessor : SyntaxKind - CallSignature = 134, + CallSignature = 136, >CallSignature : SyntaxKind - ConstructSignature = 135, + ConstructSignature = 137, >ConstructSignature : SyntaxKind - IndexSignature = 136, + IndexSignature = 138, >IndexSignature : SyntaxKind - TypeReference = 137, + TypeReference = 139, >TypeReference : SyntaxKind - FunctionType = 138, + FunctionType = 140, >FunctionType : SyntaxKind - ConstructorType = 139, + ConstructorType = 141, >ConstructorType : SyntaxKind - TypeQuery = 140, + TypeQuery = 142, >TypeQuery : SyntaxKind - TypeLiteral = 141, + TypeLiteral = 143, >TypeLiteral : SyntaxKind - ArrayType = 142, + ArrayType = 144, >ArrayType : SyntaxKind - TupleType = 143, + TupleType = 145, >TupleType : SyntaxKind - UnionType = 144, + UnionType = 146, >UnionType : SyntaxKind - ParenthesizedType = 145, + ParenthesizedType = 147, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 146, + ObjectBindingPattern = 148, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 147, + ArrayBindingPattern = 149, >ArrayBindingPattern : SyntaxKind - BindingElement = 148, + BindingElement = 150, >BindingElement : SyntaxKind - ArrayLiteralExpression = 149, + ArrayLiteralExpression = 151, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 150, + ObjectLiteralExpression = 152, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 151, + PropertyAccessExpression = 153, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 152, + ElementAccessExpression = 154, >ElementAccessExpression : SyntaxKind - CallExpression = 153, + CallExpression = 155, >CallExpression : SyntaxKind - NewExpression = 154, + NewExpression = 156, >NewExpression : SyntaxKind - TaggedTemplateExpression = 155, + TaggedTemplateExpression = 157, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 156, + TypeAssertionExpression = 158, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 157, + ParenthesizedExpression = 159, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 158, + FunctionExpression = 160, >FunctionExpression : SyntaxKind - ArrowFunction = 159, + ArrowFunction = 161, >ArrowFunction : SyntaxKind - DeleteExpression = 160, + DeleteExpression = 162, >DeleteExpression : SyntaxKind - TypeOfExpression = 161, + TypeOfExpression = 163, >TypeOfExpression : SyntaxKind - VoidExpression = 162, + VoidExpression = 164, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 163, + PrefixUnaryExpression = 165, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 164, + PostfixUnaryExpression = 166, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 165, + BinaryExpression = 167, >BinaryExpression : SyntaxKind - ConditionalExpression = 166, + ConditionalExpression = 168, >ConditionalExpression : SyntaxKind - TemplateExpression = 167, + TemplateExpression = 169, >TemplateExpression : SyntaxKind - YieldExpression = 168, + YieldExpression = 170, >YieldExpression : SyntaxKind - SpreadElementExpression = 169, + SpreadElementExpression = 171, >SpreadElementExpression : SyntaxKind - OmittedExpression = 170, + OmittedExpression = 172, >OmittedExpression : SyntaxKind - TemplateSpan = 171, + TemplateSpan = 173, >TemplateSpan : SyntaxKind - Block = 172, + Block = 174, >Block : SyntaxKind - VariableStatement = 173, + VariableStatement = 175, >VariableStatement : SyntaxKind - EmptyStatement = 174, + EmptyStatement = 176, >EmptyStatement : SyntaxKind - ExpressionStatement = 175, + ExpressionStatement = 177, >ExpressionStatement : SyntaxKind - IfStatement = 176, + IfStatement = 178, >IfStatement : SyntaxKind - DoStatement = 177, + DoStatement = 179, >DoStatement : SyntaxKind - WhileStatement = 178, + WhileStatement = 180, >WhileStatement : SyntaxKind - ForStatement = 179, + ForStatement = 181, >ForStatement : SyntaxKind - ForInStatement = 180, + ForInStatement = 182, >ForInStatement : SyntaxKind - ContinueStatement = 181, + ForOfStatement = 183, +>ForOfStatement : SyntaxKind + + ContinueStatement = 184, >ContinueStatement : SyntaxKind - BreakStatement = 182, + BreakStatement = 185, >BreakStatement : SyntaxKind - ReturnStatement = 183, + ReturnStatement = 186, >ReturnStatement : SyntaxKind - WithStatement = 184, + WithStatement = 187, >WithStatement : SyntaxKind - SwitchStatement = 185, + SwitchStatement = 188, >SwitchStatement : SyntaxKind - LabeledStatement = 186, + LabeledStatement = 189, >LabeledStatement : SyntaxKind - ThrowStatement = 187, + ThrowStatement = 190, >ThrowStatement : SyntaxKind - TryStatement = 188, + TryStatement = 191, >TryStatement : SyntaxKind - DebuggerStatement = 189, + DebuggerStatement = 192, >DebuggerStatement : SyntaxKind - VariableDeclaration = 190, + VariableDeclaration = 193, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 191, + VariableDeclarationList = 194, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 192, + FunctionDeclaration = 195, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 193, + ClassDeclaration = 196, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 194, + InterfaceDeclaration = 197, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 195, + TypeAliasDeclaration = 198, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 196, + EnumDeclaration = 199, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 197, + ModuleDeclaration = 200, >ModuleDeclaration : SyntaxKind - ModuleBlock = 198, + ModuleBlock = 201, >ModuleBlock : SyntaxKind - ImportEqualsDeclaration = 199, + ImportEqualsDeclaration = 202, >ImportEqualsDeclaration : SyntaxKind - ImportDeclaration = 200, + ImportDeclaration = 203, >ImportDeclaration : SyntaxKind - ImportClause = 201, + ImportClause = 204, >ImportClause : SyntaxKind - NamespaceImport = 202, + NamespaceImport = 205, >NamespaceImport : SyntaxKind - NamedImports = 203, + NamedImports = 206, >NamedImports : SyntaxKind - ImportSpecifier = 204, + ImportSpecifier = 207, >ImportSpecifier : SyntaxKind - ExportAssignment = 205, + ExportAssignment = 208, >ExportAssignment : SyntaxKind - ExportDeclaration = 206, + ExportDeclaration = 209, >ExportDeclaration : SyntaxKind - NamedExports = 207, + NamedExports = 210, >NamedExports : SyntaxKind - ExportSpecifier = 208, + ExportSpecifier = 211, >ExportSpecifier : SyntaxKind - ExternalModuleReference = 209, + ExternalModuleReference = 212, >ExternalModuleReference : SyntaxKind - CaseClause = 210, + CaseClause = 213, >CaseClause : SyntaxKind - DefaultClause = 211, + DefaultClause = 214, >DefaultClause : SyntaxKind - HeritageClause = 212, + HeritageClause = 215, >HeritageClause : SyntaxKind - CatchClause = 213, + CatchClause = 216, >CatchClause : SyntaxKind - PropertyAssignment = 214, + PropertyAssignment = 217, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 215, + ShorthandPropertyAssignment = 218, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 216, + EnumMember = 219, >EnumMember : SyntaxKind - SourceFile = 217, + SourceFile = 220, >SourceFile : SyntaxKind - SyntaxList = 218, + SyntaxList = 221, >SyntaxList : SyntaxKind - Count = 219, + Count = 222, >Count : SyntaxKind FirstAssignment = 52, @@ -964,7 +975,7 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 122, + LastKeyword = 124, >LastKeyword : SyntaxKind FirstFutureReservedWord = 103, @@ -973,10 +984,10 @@ declare module "typescript" { LastFutureReservedWord = 111, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 137, + FirstTypeNode = 139, >FirstTypeNode : SyntaxKind - LastTypeNode = 145, + LastTypeNode = 147, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -988,7 +999,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 122, + LastToken = 124, >LastToken : SyntaxKind FirstTriviaToken = 2, @@ -1015,7 +1026,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 123, + FirstNode = 125, >FirstNode : SyntaxKind } const enum NodeFlags { @@ -1702,9 +1713,9 @@ declare module "typescript" { >left : Expression >Expression : Expression - operator: SyntaxKind; ->operator : SyntaxKind ->SyntaxKind : SyntaxKind + operatorToken: Node; +>operatorToken : Node +>Node : Node right: Expression; >right : Expression @@ -1996,6 +2007,19 @@ declare module "typescript" { expression: Expression; >expression : Expression +>Expression : Expression + } + interface ForOfStatement extends IterationStatement { +>ForOfStatement : ForOfStatement +>IterationStatement : IterationStatement + + initializer: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + expression: Expression; +>expression : Expression >Expression : Expression } interface BreakOrContinueStatement extends Statement { @@ -2414,9 +2438,16 @@ declare module "typescript" { text: string; >text : string - amdDependencies: string[]; ->amdDependencies : string[] + amdDependencies: { +>amdDependencies : { path: string; name: string; }[] + path: string; +>path : string + + name: string; +>name : string + + }[]; amdModuleName: string; >amdModuleName : string @@ -3543,10 +3574,13 @@ declare module "typescript" { ContainsObjectLiteral = 524288, >ContainsObjectLiteral : TypeFlags - Intrinsic = 127, + ESSymbol = 1048576, +>ESSymbol : TypeFlags + + Intrinsic = 1048703, >Intrinsic : TypeFlags - Primitive = 510, + Primitive = 1049086, >Primitive : TypeFlags StringLike = 258, @@ -4388,6 +4422,9 @@ declare module "typescript" { greaterThan = 62, >greaterThan : CharacterCodes + hash = 35, +>hash : CharacterCodes + lessThan = 60, >lessThan : CharacterCodes @@ -4593,15 +4630,15 @@ declare module "typescript" { >computeLineStarts : (text: string) => number[] >text : string - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; ->getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number >sourceFile : SourceFile >SourceFile : SourceFile >line : number >character : number - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; ->computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number >lineStarts : number[] >line : number >character : number @@ -4960,16 +4997,16 @@ declare module "typescript" { >getNamedDeclarations : () => Declaration[] >Declaration : Declaration - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; ->getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter >pos : number >LineAndCharacter : LineAndCharacter getLineStarts(): number[]; >getLineStarts : () => number[] - getPositionFromLineAndCharacter(line: number, character: number): number; ->getPositionFromLineAndCharacter : (line: number, character: number) => number + getPositionOfLineAndCharacter(line: number, character: number): number; +>getPositionOfLineAndCharacter : (line: number, character: number) => number >line : number >character : number @@ -5186,9 +5223,10 @@ declare module "typescript" { >position : number >ReferenceEntry : ReferenceEntry - getNavigateToItems(searchValue: string): NavigateToItem[]; ->getNavigateToItems : (searchValue: string) => NavigateToItem[] + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; +>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[] >searchValue : string +>maxResultCount : number >NavigateToItem : NavigateToItem getNavigationBarItems(fileName: string): NavigationBarItem[]; @@ -5427,6 +5465,9 @@ declare module "typescript" { PlaceOpenBraceOnNewLineForControlBlocks: boolean; >PlaceOpenBraceOnNewLineForControlBlocks : boolean + + [s: string]: boolean | number | string; +>s : string } interface DefinitionInfo { >DefinitionInfo : DefinitionInfo @@ -5764,6 +5805,15 @@ declare module "typescript" { InDoubleQuoteStringLiteral = 3, >InDoubleQuoteStringLiteral : EndOfLineState + + InTemplateHeadOrNoSubstitutionTemplate = 4, +>InTemplateHeadOrNoSubstitutionTemplate : EndOfLineState + + InTemplateMiddleOrTail = 5, +>InTemplateMiddleOrTail : EndOfLineState + + InTemplateSubstitutionPosition = 6, +>InTemplateSubstitutionPosition : EndOfLineState } enum TokenClass { >TokenClass : TokenClass @@ -5819,12 +5869,31 @@ declare module "typescript" { interface Classifier { >Classifier : Classifier - getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult; ->getClassificationsForLine : (text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean) => ClassificationResult + /** + * Gives lexical classifications of tokens on a line without any syntactic context. + * For instance, a token consisting of the text 'string' can be either an identifier + * named 'string' or the keyword 'string', however, because this classifier is not aware, + * it relies on certain heuristics to give acceptable results. For classifications where + * speed trumps accuracy, this function is preferable; however, for true accuracy, the + * syntactic classifier is ideal. In fact, in certain editing scenarios, combining the + * lexical, syntactic, and semantic classifiers may issue the best user experience. + * + * @param text The text of a line to classify. + * @param lexState The state of the lexical classifier at the end of the previous line. + * @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier. + * If there is no syntactic classifier (syntacticClassifierAbsent=true), + * certain heuristics may be used in its place; however, if there is a + * syntactic classifier (syntacticClassifierAbsent=false), certain + * classifications which may be incorrectly categorized will be given + * back as Identifiers in order to allow the syntactic classifier to + * subsume the classification. + */ + getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; +>getClassificationsForLine : (text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean) => ClassificationResult >text : string >lexState : EndOfLineState >EndOfLineState : EndOfLineState ->classifyKeywordsInGenerics : boolean +>syntacticClassifierAbsent : boolean >ClassificationResult : ClassificationResult } /** diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index c97effc3458..25cb4af9e42 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -87,8 +87,8 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); @@ -250,118 +250,121 @@ declare module "typescript" { NumberKeyword = 119, SetKeyword = 120, StringKeyword = 121, - TypeKeyword = 122, - QualifiedName = 123, - ComputedPropertyName = 124, - TypeParameter = 125, - Parameter = 126, - PropertySignature = 127, - PropertyDeclaration = 128, - MethodSignature = 129, - MethodDeclaration = 130, - Constructor = 131, - GetAccessor = 132, - SetAccessor = 133, - CallSignature = 134, - ConstructSignature = 135, - IndexSignature = 136, - TypeReference = 137, - FunctionType = 138, - ConstructorType = 139, - TypeQuery = 140, - TypeLiteral = 141, - ArrayType = 142, - TupleType = 143, - UnionType = 144, - ParenthesizedType = 145, - ObjectBindingPattern = 146, - ArrayBindingPattern = 147, - BindingElement = 148, - ArrayLiteralExpression = 149, - ObjectLiteralExpression = 150, - PropertyAccessExpression = 151, - ElementAccessExpression = 152, - CallExpression = 153, - NewExpression = 154, - TaggedTemplateExpression = 155, - TypeAssertionExpression = 156, - ParenthesizedExpression = 157, - FunctionExpression = 158, - ArrowFunction = 159, - DeleteExpression = 160, - TypeOfExpression = 161, - VoidExpression = 162, - PrefixUnaryExpression = 163, - PostfixUnaryExpression = 164, - BinaryExpression = 165, - ConditionalExpression = 166, - TemplateExpression = 167, - YieldExpression = 168, - SpreadElementExpression = 169, - OmittedExpression = 170, - TemplateSpan = 171, - Block = 172, - VariableStatement = 173, - EmptyStatement = 174, - ExpressionStatement = 175, - IfStatement = 176, - DoStatement = 177, - WhileStatement = 178, - ForStatement = 179, - ForInStatement = 180, - ContinueStatement = 181, - BreakStatement = 182, - ReturnStatement = 183, - WithStatement = 184, - SwitchStatement = 185, - LabeledStatement = 186, - ThrowStatement = 187, - TryStatement = 188, - DebuggerStatement = 189, - VariableDeclaration = 190, - VariableDeclarationList = 191, - FunctionDeclaration = 192, - ClassDeclaration = 193, - InterfaceDeclaration = 194, - TypeAliasDeclaration = 195, - EnumDeclaration = 196, - ModuleDeclaration = 197, - ModuleBlock = 198, - ImportEqualsDeclaration = 199, - ImportDeclaration = 200, - ImportClause = 201, - NamespaceImport = 202, - NamedImports = 203, - ImportSpecifier = 204, - ExportAssignment = 205, - ExportDeclaration = 206, - NamedExports = 207, - ExportSpecifier = 208, - ExternalModuleReference = 209, - CaseClause = 210, - DefaultClause = 211, - HeritageClause = 212, - CatchClause = 213, - PropertyAssignment = 214, - ShorthandPropertyAssignment = 215, - EnumMember = 216, - SourceFile = 217, - SyntaxList = 218, - Count = 219, + SymbolKeyword = 122, + TypeKeyword = 123, + OfKeyword = 124, + QualifiedName = 125, + ComputedPropertyName = 126, + TypeParameter = 127, + Parameter = 128, + PropertySignature = 129, + PropertyDeclaration = 130, + MethodSignature = 131, + MethodDeclaration = 132, + Constructor = 133, + GetAccessor = 134, + SetAccessor = 135, + CallSignature = 136, + ConstructSignature = 137, + IndexSignature = 138, + TypeReference = 139, + FunctionType = 140, + ConstructorType = 141, + TypeQuery = 142, + TypeLiteral = 143, + ArrayType = 144, + TupleType = 145, + UnionType = 146, + ParenthesizedType = 147, + ObjectBindingPattern = 148, + ArrayBindingPattern = 149, + BindingElement = 150, + ArrayLiteralExpression = 151, + ObjectLiteralExpression = 152, + PropertyAccessExpression = 153, + ElementAccessExpression = 154, + CallExpression = 155, + NewExpression = 156, + TaggedTemplateExpression = 157, + TypeAssertionExpression = 158, + ParenthesizedExpression = 159, + FunctionExpression = 160, + ArrowFunction = 161, + DeleteExpression = 162, + TypeOfExpression = 163, + VoidExpression = 164, + PrefixUnaryExpression = 165, + PostfixUnaryExpression = 166, + BinaryExpression = 167, + ConditionalExpression = 168, + TemplateExpression = 169, + YieldExpression = 170, + SpreadElementExpression = 171, + OmittedExpression = 172, + TemplateSpan = 173, + Block = 174, + VariableStatement = 175, + EmptyStatement = 176, + ExpressionStatement = 177, + IfStatement = 178, + DoStatement = 179, + WhileStatement = 180, + ForStatement = 181, + ForInStatement = 182, + ForOfStatement = 183, + ContinueStatement = 184, + BreakStatement = 185, + ReturnStatement = 186, + WithStatement = 187, + SwitchStatement = 188, + LabeledStatement = 189, + ThrowStatement = 190, + TryStatement = 191, + DebuggerStatement = 192, + VariableDeclaration = 193, + VariableDeclarationList = 194, + FunctionDeclaration = 195, + ClassDeclaration = 196, + InterfaceDeclaration = 197, + TypeAliasDeclaration = 198, + EnumDeclaration = 199, + ModuleDeclaration = 200, + ModuleBlock = 201, + ImportEqualsDeclaration = 202, + ImportDeclaration = 203, + ImportClause = 204, + NamespaceImport = 205, + NamedImports = 206, + ImportSpecifier = 207, + ExportAssignment = 208, + ExportDeclaration = 209, + NamedExports = 210, + ExportSpecifier = 211, + ExternalModuleReference = 212, + CaseClause = 213, + DefaultClause = 214, + HeritageClause = 215, + CatchClause = 216, + PropertyAssignment = 217, + ShorthandPropertyAssignment = 218, + EnumMember = 219, + SourceFile = 220, + SyntaxList = 221, + Count = 222, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 122, + LastKeyword = 124, FirstFutureReservedWord = 103, LastFutureReservedWord = 111, - FirstTypeNode = 137, - LastTypeNode = 145, + FirstTypeNode = 139, + LastTypeNode = 147, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 122, + LastToken = 124, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -370,7 +373,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 123, + FirstNode = 125, } const enum NodeFlags { Export = 1, @@ -603,7 +606,7 @@ declare module "typescript" { } interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } interface ConditionalExpression extends Expression { @@ -701,6 +704,10 @@ declare module "typescript" { initializer: VariableDeclarationList | Expression; expression: Expression; } + interface ForOfStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } interface BreakOrContinueStatement extends Statement { label?: Identifier; } @@ -831,7 +838,10 @@ declare module "typescript" { endOfFileToken: Node; fileName: string; text: string; - amdDependencies: string[]; + amdDependencies: { + path: string; + name: string; + }[]; amdModuleName: string; referencedFiles: FileReference[]; hasNoDefaultLib: boolean; @@ -1139,8 +1149,9 @@ declare module "typescript" { ObjectLiteral = 131072, ContainsUndefinedOrNull = 262144, ContainsObjectLiteral = 524288, - Intrinsic = 127, - Primitive = 510, + ESSymbol = 1048576, + Intrinsic = 1048703, + Primitive = 1049086, StringLike = 258, NumberLike = 132, ObjectType = 48128, @@ -1426,6 +1437,7 @@ declare module "typescript" { equals = 61, exclamation = 33, greaterThan = 62, + hash = 35, lessThan = 60, minus = 45, openBrace = 123, @@ -1492,8 +1504,8 @@ declare module "typescript" { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; @@ -1577,9 +1589,9 @@ declare module "typescript" { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** @@ -1641,7 +1653,7 @@ declare module "typescript" { getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; @@ -1716,6 +1728,7 @@ declare module "typescript" { InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; + [s: string]: boolean | number | string; } interface DefinitionInfo { fileName: string; @@ -1849,6 +1862,9 @@ declare module "typescript" { InMultiLineCommentTrivia = 1, InSingleQuoteStringLiteral = 2, InDoubleQuoteStringLiteral = 3, + InTemplateHeadOrNoSubstitutionTemplate = 4, + InTemplateMiddleOrTail = 5, + InTemplateSubstitutionPosition = 6, } enum TokenClass { Punctuation = 0, @@ -1870,7 +1886,26 @@ declare module "typescript" { classification: TokenClass; } interface Classifier { - getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult; + /** + * Gives lexical classifications of tokens on a line without any syntactic context. + * For instance, a token consisting of the text 'string' can be either an identifier + * named 'string' or the keyword 'string', however, because this classifier is not aware, + * it relies on certain heuristics to give acceptable results. For classifications where + * speed trumps accuracy, this function is preferable; however, for true accuracy, the + * syntactic classifier is ideal. In fact, in certain editing scenarios, combining the + * lexical, syntactic, and semantic classifiers may issue the best user experience. + * + * @param text The text of a line to classify. + * @param lexState The state of the lexical classifier at the end of the previous line. + * @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier. + * If there is no syntactic classifier (syntacticClassifierAbsent=true), + * certain heuristics may be used in its place; however, if there is a + * syntactic classifier (syntacticClassifierAbsent=false), certain + * classifications which may be incorrectly categorized will be given + * back as Identifiers in order to allow the syntactic classifier to + * subsume the classification. + */ + getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; } /** * The document registry represents a store of SourceFile objects that can be shared between @@ -2082,8 +2117,8 @@ function watch(rootFileNames, options) { var allDiagnostics = services.getCompilerOptionsDiagnostics().concat(services.getSyntacticDiagnostics(fileName)).concat(services.getSemanticDiagnostics(fileName)); allDiagnostics.forEach(function (diagnostic) { if (diagnostic.file) { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(" Error " + diagnostic.file.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(" Error " + diagnostic.file.fileName + " (" + (lineChar.line + 1) + "," + (lineChar.character + 1) + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")); } else { console.log(" Error: " + diagnostic.messageText); diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index cb46e45347e..1283ed80958 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -317,11 +317,11 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { >fileName : string allDiagnostics.forEach(diagnostic => { ->allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } }) : void +>allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } }) : void >allDiagnostics.forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void >allDiagnostics : ts.Diagnostic[] >forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void ->diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } } : (diagnostic: ts.Diagnostic) => void +>diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } } : (diagnostic: ts.Diagnostic) => void >diagnostic : ts.Diagnostic if (diagnostic.file) { @@ -329,20 +329,20 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { >diagnostic : ts.Diagnostic >file : ts.SourceFile - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); >lineChar : ts.LineAndCharacter ->diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start) : ts.LineAndCharacter ->diagnostic.file.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : ts.LineAndCharacter +>diagnostic.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >diagnostic.file : ts.SourceFile >diagnostic : ts.Diagnostic >file : ts.SourceFile ->getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >diagnostic.start : number >diagnostic : ts.Diagnostic >start : number - console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); ->console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`) : any + console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); +>console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`) : any >console.log : any >console : any >log : any @@ -351,9 +351,11 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { >diagnostic : ts.Diagnostic >file : ts.SourceFile >fileName : string +>lineChar.line + 1 : number >lineChar.line : number >lineChar : ts.LineAndCharacter >line : number +>lineChar.character + 1 : number >lineChar.character : number >lineChar : ts.LineAndCharacter >character : number @@ -828,298 +830,307 @@ declare module "typescript" { StringKeyword = 121, >StringKeyword : SyntaxKind - TypeKeyword = 122, + SymbolKeyword = 122, +>SymbolKeyword : SyntaxKind + + TypeKeyword = 123, >TypeKeyword : SyntaxKind - QualifiedName = 123, + OfKeyword = 124, +>OfKeyword : SyntaxKind + + QualifiedName = 125, >QualifiedName : SyntaxKind - ComputedPropertyName = 124, + ComputedPropertyName = 126, >ComputedPropertyName : SyntaxKind - TypeParameter = 125, + TypeParameter = 127, >TypeParameter : SyntaxKind - Parameter = 126, + Parameter = 128, >Parameter : SyntaxKind - PropertySignature = 127, + PropertySignature = 129, >PropertySignature : SyntaxKind - PropertyDeclaration = 128, + PropertyDeclaration = 130, >PropertyDeclaration : SyntaxKind - MethodSignature = 129, + MethodSignature = 131, >MethodSignature : SyntaxKind - MethodDeclaration = 130, + MethodDeclaration = 132, >MethodDeclaration : SyntaxKind - Constructor = 131, + Constructor = 133, >Constructor : SyntaxKind - GetAccessor = 132, + GetAccessor = 134, >GetAccessor : SyntaxKind - SetAccessor = 133, + SetAccessor = 135, >SetAccessor : SyntaxKind - CallSignature = 134, + CallSignature = 136, >CallSignature : SyntaxKind - ConstructSignature = 135, + ConstructSignature = 137, >ConstructSignature : SyntaxKind - IndexSignature = 136, + IndexSignature = 138, >IndexSignature : SyntaxKind - TypeReference = 137, + TypeReference = 139, >TypeReference : SyntaxKind - FunctionType = 138, + FunctionType = 140, >FunctionType : SyntaxKind - ConstructorType = 139, + ConstructorType = 141, >ConstructorType : SyntaxKind - TypeQuery = 140, + TypeQuery = 142, >TypeQuery : SyntaxKind - TypeLiteral = 141, + TypeLiteral = 143, >TypeLiteral : SyntaxKind - ArrayType = 142, + ArrayType = 144, >ArrayType : SyntaxKind - TupleType = 143, + TupleType = 145, >TupleType : SyntaxKind - UnionType = 144, + UnionType = 146, >UnionType : SyntaxKind - ParenthesizedType = 145, + ParenthesizedType = 147, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 146, + ObjectBindingPattern = 148, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 147, + ArrayBindingPattern = 149, >ArrayBindingPattern : SyntaxKind - BindingElement = 148, + BindingElement = 150, >BindingElement : SyntaxKind - ArrayLiteralExpression = 149, + ArrayLiteralExpression = 151, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 150, + ObjectLiteralExpression = 152, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 151, + PropertyAccessExpression = 153, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 152, + ElementAccessExpression = 154, >ElementAccessExpression : SyntaxKind - CallExpression = 153, + CallExpression = 155, >CallExpression : SyntaxKind - NewExpression = 154, + NewExpression = 156, >NewExpression : SyntaxKind - TaggedTemplateExpression = 155, + TaggedTemplateExpression = 157, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 156, + TypeAssertionExpression = 158, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 157, + ParenthesizedExpression = 159, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 158, + FunctionExpression = 160, >FunctionExpression : SyntaxKind - ArrowFunction = 159, + ArrowFunction = 161, >ArrowFunction : SyntaxKind - DeleteExpression = 160, + DeleteExpression = 162, >DeleteExpression : SyntaxKind - TypeOfExpression = 161, + TypeOfExpression = 163, >TypeOfExpression : SyntaxKind - VoidExpression = 162, + VoidExpression = 164, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 163, + PrefixUnaryExpression = 165, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 164, + PostfixUnaryExpression = 166, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 165, + BinaryExpression = 167, >BinaryExpression : SyntaxKind - ConditionalExpression = 166, + ConditionalExpression = 168, >ConditionalExpression : SyntaxKind - TemplateExpression = 167, + TemplateExpression = 169, >TemplateExpression : SyntaxKind - YieldExpression = 168, + YieldExpression = 170, >YieldExpression : SyntaxKind - SpreadElementExpression = 169, + SpreadElementExpression = 171, >SpreadElementExpression : SyntaxKind - OmittedExpression = 170, + OmittedExpression = 172, >OmittedExpression : SyntaxKind - TemplateSpan = 171, + TemplateSpan = 173, >TemplateSpan : SyntaxKind - Block = 172, + Block = 174, >Block : SyntaxKind - VariableStatement = 173, + VariableStatement = 175, >VariableStatement : SyntaxKind - EmptyStatement = 174, + EmptyStatement = 176, >EmptyStatement : SyntaxKind - ExpressionStatement = 175, + ExpressionStatement = 177, >ExpressionStatement : SyntaxKind - IfStatement = 176, + IfStatement = 178, >IfStatement : SyntaxKind - DoStatement = 177, + DoStatement = 179, >DoStatement : SyntaxKind - WhileStatement = 178, + WhileStatement = 180, >WhileStatement : SyntaxKind - ForStatement = 179, + ForStatement = 181, >ForStatement : SyntaxKind - ForInStatement = 180, + ForInStatement = 182, >ForInStatement : SyntaxKind - ContinueStatement = 181, + ForOfStatement = 183, +>ForOfStatement : SyntaxKind + + ContinueStatement = 184, >ContinueStatement : SyntaxKind - BreakStatement = 182, + BreakStatement = 185, >BreakStatement : SyntaxKind - ReturnStatement = 183, + ReturnStatement = 186, >ReturnStatement : SyntaxKind - WithStatement = 184, + WithStatement = 187, >WithStatement : SyntaxKind - SwitchStatement = 185, + SwitchStatement = 188, >SwitchStatement : SyntaxKind - LabeledStatement = 186, + LabeledStatement = 189, >LabeledStatement : SyntaxKind - ThrowStatement = 187, + ThrowStatement = 190, >ThrowStatement : SyntaxKind - TryStatement = 188, + TryStatement = 191, >TryStatement : SyntaxKind - DebuggerStatement = 189, + DebuggerStatement = 192, >DebuggerStatement : SyntaxKind - VariableDeclaration = 190, + VariableDeclaration = 193, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 191, + VariableDeclarationList = 194, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 192, + FunctionDeclaration = 195, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 193, + ClassDeclaration = 196, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 194, + InterfaceDeclaration = 197, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 195, + TypeAliasDeclaration = 198, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 196, + EnumDeclaration = 199, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 197, + ModuleDeclaration = 200, >ModuleDeclaration : SyntaxKind - ModuleBlock = 198, + ModuleBlock = 201, >ModuleBlock : SyntaxKind - ImportEqualsDeclaration = 199, + ImportEqualsDeclaration = 202, >ImportEqualsDeclaration : SyntaxKind - ImportDeclaration = 200, + ImportDeclaration = 203, >ImportDeclaration : SyntaxKind - ImportClause = 201, + ImportClause = 204, >ImportClause : SyntaxKind - NamespaceImport = 202, + NamespaceImport = 205, >NamespaceImport : SyntaxKind - NamedImports = 203, + NamedImports = 206, >NamedImports : SyntaxKind - ImportSpecifier = 204, + ImportSpecifier = 207, >ImportSpecifier : SyntaxKind - ExportAssignment = 205, + ExportAssignment = 208, >ExportAssignment : SyntaxKind - ExportDeclaration = 206, + ExportDeclaration = 209, >ExportDeclaration : SyntaxKind - NamedExports = 207, + NamedExports = 210, >NamedExports : SyntaxKind - ExportSpecifier = 208, + ExportSpecifier = 211, >ExportSpecifier : SyntaxKind - ExternalModuleReference = 209, + ExternalModuleReference = 212, >ExternalModuleReference : SyntaxKind - CaseClause = 210, + CaseClause = 213, >CaseClause : SyntaxKind - DefaultClause = 211, + DefaultClause = 214, >DefaultClause : SyntaxKind - HeritageClause = 212, + HeritageClause = 215, >HeritageClause : SyntaxKind - CatchClause = 213, + CatchClause = 216, >CatchClause : SyntaxKind - PropertyAssignment = 214, + PropertyAssignment = 217, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 215, + ShorthandPropertyAssignment = 218, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 216, + EnumMember = 219, >EnumMember : SyntaxKind - SourceFile = 217, + SourceFile = 220, >SourceFile : SyntaxKind - SyntaxList = 218, + SyntaxList = 221, >SyntaxList : SyntaxKind - Count = 219, + Count = 222, >Count : SyntaxKind FirstAssignment = 52, @@ -1137,7 +1148,7 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 122, + LastKeyword = 124, >LastKeyword : SyntaxKind FirstFutureReservedWord = 103, @@ -1146,10 +1157,10 @@ declare module "typescript" { LastFutureReservedWord = 111, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 137, + FirstTypeNode = 139, >FirstTypeNode : SyntaxKind - LastTypeNode = 145, + LastTypeNode = 147, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -1161,7 +1172,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 122, + LastToken = 124, >LastToken : SyntaxKind FirstTriviaToken = 2, @@ -1188,7 +1199,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 123, + FirstNode = 125, >FirstNode : SyntaxKind } const enum NodeFlags { @@ -1875,9 +1886,9 @@ declare module "typescript" { >left : Expression >Expression : Expression - operator: SyntaxKind; ->operator : SyntaxKind ->SyntaxKind : SyntaxKind + operatorToken: Node; +>operatorToken : Node +>Node : Node right: Expression; >right : Expression @@ -2169,6 +2180,19 @@ declare module "typescript" { expression: Expression; >expression : Expression +>Expression : Expression + } + interface ForOfStatement extends IterationStatement { +>ForOfStatement : ForOfStatement +>IterationStatement : IterationStatement + + initializer: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + expression: Expression; +>expression : Expression >Expression : Expression } interface BreakOrContinueStatement extends Statement { @@ -2587,9 +2611,16 @@ declare module "typescript" { text: string; >text : string - amdDependencies: string[]; ->amdDependencies : string[] + amdDependencies: { +>amdDependencies : { path: string; name: string; }[] + path: string; +>path : string + + name: string; +>name : string + + }[]; amdModuleName: string; >amdModuleName : string @@ -3716,10 +3747,13 @@ declare module "typescript" { ContainsObjectLiteral = 524288, >ContainsObjectLiteral : TypeFlags - Intrinsic = 127, + ESSymbol = 1048576, +>ESSymbol : TypeFlags + + Intrinsic = 1048703, >Intrinsic : TypeFlags - Primitive = 510, + Primitive = 1049086, >Primitive : TypeFlags StringLike = 258, @@ -4561,6 +4595,9 @@ declare module "typescript" { greaterThan = 62, >greaterThan : CharacterCodes + hash = 35, +>hash : CharacterCodes + lessThan = 60, >lessThan : CharacterCodes @@ -4766,15 +4803,15 @@ declare module "typescript" { >computeLineStarts : (text: string) => number[] >text : string - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; ->getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number >sourceFile : SourceFile >SourceFile : SourceFile >line : number >character : number - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; ->computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number >lineStarts : number[] >line : number >character : number @@ -5133,16 +5170,16 @@ declare module "typescript" { >getNamedDeclarations : () => Declaration[] >Declaration : Declaration - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; ->getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter >pos : number >LineAndCharacter : LineAndCharacter getLineStarts(): number[]; >getLineStarts : () => number[] - getPositionFromLineAndCharacter(line: number, character: number): number; ->getPositionFromLineAndCharacter : (line: number, character: number) => number + getPositionOfLineAndCharacter(line: number, character: number): number; +>getPositionOfLineAndCharacter : (line: number, character: number) => number >line : number >character : number @@ -5359,9 +5396,10 @@ declare module "typescript" { >position : number >ReferenceEntry : ReferenceEntry - getNavigateToItems(searchValue: string): NavigateToItem[]; ->getNavigateToItems : (searchValue: string) => NavigateToItem[] + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; +>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[] >searchValue : string +>maxResultCount : number >NavigateToItem : NavigateToItem getNavigationBarItems(fileName: string): NavigationBarItem[]; @@ -5600,6 +5638,9 @@ declare module "typescript" { PlaceOpenBraceOnNewLineForControlBlocks: boolean; >PlaceOpenBraceOnNewLineForControlBlocks : boolean + + [s: string]: boolean | number | string; +>s : string } interface DefinitionInfo { >DefinitionInfo : DefinitionInfo @@ -5937,6 +5978,15 @@ declare module "typescript" { InDoubleQuoteStringLiteral = 3, >InDoubleQuoteStringLiteral : EndOfLineState + + InTemplateHeadOrNoSubstitutionTemplate = 4, +>InTemplateHeadOrNoSubstitutionTemplate : EndOfLineState + + InTemplateMiddleOrTail = 5, +>InTemplateMiddleOrTail : EndOfLineState + + InTemplateSubstitutionPosition = 6, +>InTemplateSubstitutionPosition : EndOfLineState } enum TokenClass { >TokenClass : TokenClass @@ -5992,12 +6042,31 @@ declare module "typescript" { interface Classifier { >Classifier : Classifier - getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult; ->getClassificationsForLine : (text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean) => ClassificationResult + /** + * Gives lexical classifications of tokens on a line without any syntactic context. + * For instance, a token consisting of the text 'string' can be either an identifier + * named 'string' or the keyword 'string', however, because this classifier is not aware, + * it relies on certain heuristics to give acceptable results. For classifications where + * speed trumps accuracy, this function is preferable; however, for true accuracy, the + * syntactic classifier is ideal. In fact, in certain editing scenarios, combining the + * lexical, syntactic, and semantic classifiers may issue the best user experience. + * + * @param text The text of a line to classify. + * @param lexState The state of the lexical classifier at the end of the previous line. + * @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier. + * If there is no syntactic classifier (syntacticClassifierAbsent=true), + * certain heuristics may be used in its place; however, if there is a + * syntactic classifier (syntacticClassifierAbsent=false), certain + * classifications which may be incorrectly categorized will be given + * back as Identifiers in order to allow the syntactic classifier to + * subsume the classification. + */ + getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; +>getClassificationsForLine : (text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean) => ClassificationResult >text : string >lexState : EndOfLineState >EndOfLineState : EndOfLineState ->classifyKeywordsInGenerics : boolean +>syntacticClassifierAbsent : boolean >ClassificationResult : ClassificationResult } /** diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js index 827557bdbad..5f01b6acff1 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js @@ -19,9 +19,7 @@ module clodule { var clodule = (function () { function clodule() { } - clodule.sfn = function (id) { - return 42; - }; + clodule.sfn = function (id) { return 42; }; return clodule; })(); var clodule; diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js index ae8d594c2f8..a86bc7d2e90 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js @@ -28,16 +28,12 @@ var Point = (function () { this.x = x; this.y = y; } - Point.Origin = function () { - return { x: 0, y: 0 }; - }; // unexpected error here bug 840246 + Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246 return Point; })(); var Point; (function (Point) { - function Origin() { - return null; - } + function Origin() { return null; } Point.Origin = Origin; //expected duplicate identifier error })(Point || (Point = {})); var A; @@ -47,17 +43,13 @@ var A; this.x = x; this.y = y; } - Point.Origin = function () { - return { x: 0, y: 0 }; - }; // unexpected error here bug 840246 + Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246 return Point; })(); A.Point = Point; var Point; (function (Point) { - function Origin() { - return ""; - } + function Origin() { return ""; } Point.Origin = Origin; //expected duplicate identifier error })(Point = A.Point || (A.Point = {})); })(A || (A = {})); diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js index 5bbe60297cc..f462ea9eaa9 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js @@ -28,16 +28,12 @@ var Point = (function () { this.x = x; this.y = y; } - Point.Origin = function () { - return { x: 0, y: 0 }; - }; + Point.Origin = function () { return { x: 0, y: 0 }; }; return Point; })(); var Point; (function (Point) { - function Origin() { - return ""; - } // not an error, since not exported + function Origin() { return ""; } // not an error, since not exported })(Point || (Point = {})); var A; (function (A) { @@ -46,16 +42,12 @@ var A; this.x = x; this.y = y; } - Point.Origin = function () { - return { x: 0, y: 0 }; - }; + Point.Origin = function () { return { x: 0, y: 0 }; }; return Point; })(); A.Point = Point; var Point; (function (Point) { - function Origin() { - return ""; - } // not an error since not exported + function Origin() { return ""; } // not an error since not exported })(Point = A.Point || (A.Point = {})); })(A || (A = {})); diff --git a/tests/baselines/reference/ES5SymbolProperty1.errors.txt b/tests/baselines/reference/ES5SymbolProperty1.errors.txt new file mode 100644 index 00000000000..1b135dcc916 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty1.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty1.ts(7,6): error TS2471: A computed property name of the form 'Symbol.foo' must be of type 'symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty1.ts (1 errors) ==== + interface SymbolConstructor { + foo: string; + } + var Symbol: SymbolConstructor; + + var obj = { + [Symbol.foo]: 0 + ~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.foo' must be of type 'symbol'. + } + + obj[Symbol.foo]; \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty1.js b/tests/baselines/reference/ES5SymbolProperty1.js new file mode 100644 index 00000000000..e977df7dc6b --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty1.js @@ -0,0 +1,19 @@ +//// [ES5SymbolProperty1.ts] +interface SymbolConstructor { + foo: string; +} +var Symbol: SymbolConstructor; + +var obj = { + [Symbol.foo]: 0 +} + +obj[Symbol.foo]; + +//// [ES5SymbolProperty1.js] +var Symbol; +var obj = (_a = {}, _a[Symbol.foo] = +0, +_a); +obj[Symbol.foo]; +var _a; diff --git a/tests/baselines/reference/ES5SymbolProperty2.errors.txt b/tests/baselines/reference/ES5SymbolProperty2.errors.txt new file mode 100644 index 00000000000..9a6526a2f86 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty2.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty2.ts(5,10): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. +tests/cases/conformance/Symbols/ES5SymbolProperty2.ts(10,11): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty2.ts (2 errors) ==== + module M { + var Symbol; + + export class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + (new C)[Symbol.iterator]; + } + + (new M.C)[Symbol.iterator]; + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty2.js b/tests/baselines/reference/ES5SymbolProperty2.js new file mode 100644 index 00000000000..effd1e610f4 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty2.js @@ -0,0 +1,26 @@ +//// [ES5SymbolProperty2.ts] +module M { + var Symbol; + + export class C { + [Symbol.iterator]() { } + } + (new C)[Symbol.iterator]; +} + +(new M.C)[Symbol.iterator]; + +//// [ES5SymbolProperty2.js] +var M; +(function (M) { + var Symbol; + var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; + })(); + M.C = C; + (new C)[Symbol.iterator]; +})(M || (M = {})); +(new M.C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty3.errors.txt b/tests/baselines/reference/ES5SymbolProperty3.errors.txt new file mode 100644 index 00000000000..7c6cc5a9cd7 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty3.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty3.ts(4,6): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty3.ts (1 errors) ==== + var Symbol; + + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + + (new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty3.js b/tests/baselines/reference/ES5SymbolProperty3.js new file mode 100644 index 00000000000..52ea7e091ee --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty3.js @@ -0,0 +1,18 @@ +//// [ES5SymbolProperty3.ts] +var Symbol; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] + +//// [ES5SymbolProperty3.js] +var Symbol; +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; +})(); +(new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty4.errors.txt b/tests/baselines/reference/ES5SymbolProperty4.errors.txt new file mode 100644 index 00000000000..18f065c6bd5 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty4.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty4.ts(4,6): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty4.ts (1 errors) ==== + var Symbol: { iterator: string }; + + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + + (new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty4.js b/tests/baselines/reference/ES5SymbolProperty4.js new file mode 100644 index 00000000000..ae8a539f351 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty4.js @@ -0,0 +1,18 @@ +//// [ES5SymbolProperty4.ts] +var Symbol: { iterator: string }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] + +//// [ES5SymbolProperty4.js] +var Symbol; +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; +})(); +(new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty5.errors.txt b/tests/baselines/reference/ES5SymbolProperty5.errors.txt new file mode 100644 index 00000000000..bbfb64b6459 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty5.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty5.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty5.ts (1 errors) ==== + var Symbol: { iterator: symbol }; + + class C { + [Symbol.iterator]() { } + } + + (new C)[Symbol.iterator](0) // Should 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/ES5SymbolProperty5.js b/tests/baselines/reference/ES5SymbolProperty5.js new file mode 100644 index 00000000000..63b12667d0f --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty5.js @@ -0,0 +1,18 @@ +//// [ES5SymbolProperty5.ts] +var Symbol: { iterator: symbol }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator](0) // Should error + +//// [ES5SymbolProperty5.js] +var Symbol; +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; +})(); +(new C)[Symbol.iterator](0); // Should error diff --git a/tests/baselines/reference/ES5SymbolProperty6.errors.txt b/tests/baselines/reference/ES5SymbolProperty6.errors.txt new file mode 100644 index 00000000000..7e7cb32995a --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty6.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty6.ts(2,6): error TS2304: Cannot find name 'Symbol'. +tests/cases/conformance/Symbols/ES5SymbolProperty6.ts(5,9): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty6.ts (2 errors) ==== + class C { + [Symbol.iterator]() { } + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } + + (new C)[Symbol.iterator] + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty6.js b/tests/baselines/reference/ES5SymbolProperty6.js new file mode 100644 index 00000000000..10eda091e5e --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty6.js @@ -0,0 +1,15 @@ +//// [ES5SymbolProperty6.ts] +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] + +//// [ES5SymbolProperty6.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; +})(); +(new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty7.errors.txt b/tests/baselines/reference/ES5SymbolProperty7.errors.txt new file mode 100644 index 00000000000..21f6f005b3c --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty7.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty7.ts(4,6): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty7.ts (1 errors) ==== + var Symbol: { iterator: any }; + + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + + (new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty7.js b/tests/baselines/reference/ES5SymbolProperty7.js new file mode 100644 index 00000000000..d3f796ce758 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty7.js @@ -0,0 +1,18 @@ +//// [ES5SymbolProperty7.ts] +var Symbol: { iterator: any }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] + +//// [ES5SymbolProperty7.js] +var Symbol; +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; +})(); +(new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolType1.js b/tests/baselines/reference/ES5SymbolType1.js new file mode 100644 index 00000000000..5b555c19e7c --- /dev/null +++ b/tests/baselines/reference/ES5SymbolType1.js @@ -0,0 +1,7 @@ +//// [ES5SymbolType1.ts] +var s: symbol; +s.toString(); + +//// [ES5SymbolType1.js] +var s; +s.toString(); diff --git a/tests/baselines/reference/ES5SymbolType1.types b/tests/baselines/reference/ES5SymbolType1.types new file mode 100644 index 00000000000..79d93902fd6 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolType1.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/Symbols/ES5SymbolType1.ts === +var s: symbol; +>s : symbol + +s.toString(); +>s.toString() : string +>s.toString : () => string +>s : symbol +>toString : () => string + diff --git a/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt index 2c8d034649e..c35015af7cf 100644 --- a/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,12): error TS2304: Cannot find name 'yield'. tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,20): error TS2304: Cannot find name 'foo'. -==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (3 errors) ==== +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (2 errors) ==== var v = { [yield]: foo } - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~ !!! error TS2304: Cannot find name 'yield'. ~~~ diff --git a/tests/baselines/reference/FunctionDeclaration8_es6.js b/tests/baselines/reference/FunctionDeclaration8_es6.js index 5f9f0a2a49e..3f6d2499cef 100644 --- a/tests/baselines/reference/FunctionDeclaration8_es6.js +++ b/tests/baselines/reference/FunctionDeclaration8_es6.js @@ -2,4 +2,7 @@ var v = { [yield]: foo } //// [FunctionDeclaration8_es6.js] -var v = { [yield]: foo }; +var v = (_a = {}, _a[yield] = +foo, +_a); +var _a; diff --git a/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt index ef744681fa1..152b1ffc7cc 100644 --- a/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt @@ -1,15 +1,12 @@ tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(1,10): error TS9001: Generators are not currently supported. -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,14): error TS9000: 'yield' expressions are not currently supported. -==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (3 errors) ==== +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (2 errors) ==== function * foo() { ~ !!! error TS9001: Generators are not currently supported. var v = { [yield]: foo } - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~ !!! error TS9000: 'yield' expressions are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration9_es6.js b/tests/baselines/reference/FunctionDeclaration9_es6.js index 388275ed4fa..04c946a96eb 100644 --- a/tests/baselines/reference/FunctionDeclaration9_es6.js +++ b/tests/baselines/reference/FunctionDeclaration9_es6.js @@ -5,5 +5,8 @@ function * foo() { //// [FunctionDeclaration9_es6.js] function foo() { - var v = { []: foo }; + var v = (_a = {}, _a[] = + foo, + _a); + var _a; } diff --git a/tests/baselines/reference/FunctionPropertyAssignments4_es6.js b/tests/baselines/reference/FunctionPropertyAssignments4_es6.js index 595f7fc9124..71076523414 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments4_es6.js +++ b/tests/baselines/reference/FunctionPropertyAssignments4_es6.js @@ -2,5 +2,4 @@ var v = { * } //// [FunctionPropertyAssignments4_es6.js] -var v = { : function () { -} }; +var v = { : function () { } }; diff --git a/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt b/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt index c8c356a57ad..596764e58ea 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt +++ b/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt @@ -1,13 +1,10 @@ tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,11): error TS9001: Generators are not currently supported. -tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,13): error TS2304: Cannot find name 'foo'. -==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (3 errors) ==== +==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (2 errors) ==== var v = { *[foo()]() { } } ~ !!! error TS9001: Generators are not currently supported. - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~ !!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js index fbde587036d..0b786632bdf 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js +++ b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js @@ -2,4 +2,6 @@ var v = { *[foo()]() { } } //// [FunctionPropertyAssignments5_es6.js] -var v = { [foo()]: function () { } }; +var v = (_a = {}, _a[foo()] = function () { }, +_a); +var _a; diff --git a/tests/baselines/reference/YieldExpression10_es6.js b/tests/baselines/reference/YieldExpression10_es6.js index f111e6e1bdf..3bae1b645fe 100644 --- a/tests/baselines/reference/YieldExpression10_es6.js +++ b/tests/baselines/reference/YieldExpression10_es6.js @@ -7,5 +7,6 @@ var v = { * foo() { //// [YieldExpression10_es6.js] var v = { foo: function () { - ; -} }; + ; + } +}; diff --git a/tests/baselines/reference/YieldExpression13_es6.js b/tests/baselines/reference/YieldExpression13_es6.js index 328fc80dbdd..093759e6bd9 100644 --- a/tests/baselines/reference/YieldExpression13_es6.js +++ b/tests/baselines/reference/YieldExpression13_es6.js @@ -2,6 +2,4 @@ function* foo() { yield } //// [YieldExpression13_es6.js] -function foo() { - ; -} +function foo() { ; } diff --git a/tests/baselines/reference/YieldExpression17_es6.js b/tests/baselines/reference/YieldExpression17_es6.js index 6fd39844d80..cefe4ca28df 100644 --- a/tests/baselines/reference/YieldExpression17_es6.js +++ b/tests/baselines/reference/YieldExpression17_es6.js @@ -2,6 +2,4 @@ var v = { get foo() { yield foo; } } //// [YieldExpression17_es6.js] -var v = { get foo() { - ; -} }; +var v = { get foo() { ; } }; diff --git a/tests/baselines/reference/accessibilityModifiers.js b/tests/baselines/reference/accessibilityModifiers.js index af1832d9340..ebc801ac136 100644 --- a/tests/baselines/reference/accessibilityModifiers.js +++ b/tests/baselines/reference/accessibilityModifiers.js @@ -52,9 +52,7 @@ var C = (function () { } C.privateMethod = function () { }; Object.defineProperty(C, "privateGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -65,9 +63,7 @@ var C = (function () { }); C.protectedMethod = function () { }; Object.defineProperty(C, "protectedGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -78,9 +74,7 @@ var C = (function () { }); C.publicMethod = function () { }; Object.defineProperty(C, "publicGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -97,9 +91,7 @@ var D = (function () { } D.privateMethod = function () { }; Object.defineProperty(D, "privateGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -110,9 +102,7 @@ var D = (function () { }); D.protectedMethod = function () { }; Object.defineProperty(D, "protectedGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -123,9 +113,7 @@ var D = (function () { }); D.publicMethod = function () { }; Object.defineProperty(D, "publicGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -142,9 +130,7 @@ var E = (function () { } E.prototype.method = function () { }; Object.defineProperty(E.prototype, "getter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/accessorWithES3.js b/tests/baselines/reference/accessorWithES3.js index 8c0d353b310..1eecaa68d64 100644 --- a/tests/baselines/reference/accessorWithES3.js +++ b/tests/baselines/reference/accessorWithES3.js @@ -47,9 +47,7 @@ var D = (function () { return D; })(); var x = { - get a() { - return 1; - } + get a() { return 1; } }; var y = { set b(v) { } diff --git a/tests/baselines/reference/accessorWithES5.js b/tests/baselines/reference/accessorWithES5.js index d51f5e7713b..746703bce52 100644 --- a/tests/baselines/reference/accessorWithES5.js +++ b/tests/baselines/reference/accessorWithES5.js @@ -44,9 +44,7 @@ var D = (function () { return D; })(); var x = { - get a() { - return 1; - } + get a() { return 1; } }; var y = { set b(v) { } diff --git a/tests/baselines/reference/accessorWithoutBody1.js b/tests/baselines/reference/accessorWithoutBody1.js index 37f0ecbcfee..e06e305e161 100644 --- a/tests/baselines/reference/accessorWithoutBody1.js +++ b/tests/baselines/reference/accessorWithoutBody1.js @@ -2,5 +2,4 @@ var v = { get foo() } //// [accessorWithoutBody1.js] -var v = { get foo() { -} }; +var v = { get foo() { } }; diff --git a/tests/baselines/reference/accessorWithoutBody2.js b/tests/baselines/reference/accessorWithoutBody2.js index 9dc34c1e744..3b5a821d580 100644 --- a/tests/baselines/reference/accessorWithoutBody2.js +++ b/tests/baselines/reference/accessorWithoutBody2.js @@ -2,5 +2,4 @@ var v = { set foo(a) } //// [accessorWithoutBody2.js] -var v = { set foo(a) { -} }; +var v = { set foo(a) { } }; diff --git a/tests/baselines/reference/accessorsNotAllowedInES3.js b/tests/baselines/reference/accessorsNotAllowedInES3.js index 5cb5a5dc47a..0843a39191c 100644 --- a/tests/baselines/reference/accessorsNotAllowedInES3.js +++ b/tests/baselines/reference/accessorsNotAllowedInES3.js @@ -11,14 +11,10 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); return C; })(); -var y = { get foo() { - return 3; -} }; +var y = { get foo() { return 3; } }; diff --git a/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js b/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js index 11590f6d068..5e527aef3e9 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js +++ b/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js @@ -18,38 +18,26 @@ var LanguageSpec_section_4_5_error_cases = (function () { function LanguageSpec_section_4_5_error_cases() { } Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedSetter_SetterFirst", { - get: function () { - return ""; - }, + get: function () { return ""; }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedSetter_SetterLast", { - get: function () { - return ""; - }, + get: function () { return ""; }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedGetter_GetterFirst", { - get: function () { - return ""; - }, - set: function (aStr) { - aStr = 0; - }, + get: function () { return ""; }, + set: function (aStr) { aStr = 0; }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedGetter_GetterLast", { - get: function () { - return ""; - }, - set: function (aStr) { - aStr = 0; - }, + get: function () { return ""; }, + set: function (aStr) { aStr = 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/accessors_spec_section-4.5_inference.js b/tests/baselines/reference/accessors_spec_section-4.5_inference.js index 6ad452f2a5a..9aa7ce2f408 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_inference.js +++ b/tests/baselines/reference/accessors_spec_section-4.5_inference.js @@ -47,49 +47,37 @@ var LanguageSpec_section_4_5_inference = (function () { function LanguageSpec_section_4_5_inference() { } Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredGetterFromSetterAnnotation", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredGetterFromSetterAnnotation_GetterFirst", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredFromGetter", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredFromGetter_SetterFirst", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredSetterFromGetterAnnotation", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredSetterFromGetterAnnotation_GetterFirst", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js b/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js index 49d4ea66ba8..26a77e917d9 100644 --- a/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js +++ b/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js @@ -84,6 +84,4 @@ var r16 = a + M; var r17 = a + ''; var r18 = a + 123; var r19 = a + { a: '' }; -var r20 = a + (function (a) { - return a; -}); +var r20 = a + (function (a) { return a; }); diff --git a/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js b/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js index 20ac1350ef3..79d3c0b9b8d 100644 --- a/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js +++ b/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js @@ -25,9 +25,7 @@ var r11 = null + (() => { }); //// [additionOperatorWithNullValueAndInvalidOperator.js] // If one operand is the null or undefined value, it is treated as having the type of the other operand. -function foo() { - return undefined; -} +function foo() { return undefined; } var a; var b; var c; diff --git a/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js b/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js index 2cf0ce22259..98935db2b86 100644 --- a/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js +++ b/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js @@ -25,9 +25,7 @@ var r11 = undefined + (() => { }); //// [additionOperatorWithUndefinedValueAndInvalidOperands.js] // If one operand is the null or undefined value, it is treated as having the type of the other operand. -function foo() { - return undefined; -} +function foo() { return undefined; } var a; var b; var c; diff --git a/tests/baselines/reference/aliasUsedAsNameValue.js b/tests/baselines/reference/aliasUsedAsNameValue.js index 4b6debf4c98..fb909181529 100644 --- a/tests/baselines/reference/aliasUsedAsNameValue.js +++ b/tests/baselines/reference/aliasUsedAsNameValue.js @@ -21,9 +21,7 @@ export var a = function () { //// [aliasUsedAsNameValue_0.js] exports.id; //// [aliasUsedAsNameValue_1.js] -function b(a) { - return null; -} +function b(a) { return null; } exports.b = b; //// [aliasUsedAsNameValue_2.js] /// diff --git a/tests/baselines/reference/ambientClassOverloadForFunction.js b/tests/baselines/reference/ambientClassOverloadForFunction.js index cf3a59a465d..402eca63381 100644 --- a/tests/baselines/reference/ambientClassOverloadForFunction.js +++ b/tests/baselines/reference/ambientClassOverloadForFunction.js @@ -5,6 +5,4 @@ function foo() { return null; } //// [ambientClassOverloadForFunction.js] ; -function foo() { - return null; -} +function foo() { return null; } diff --git a/tests/baselines/reference/ambiguousGenericAssertion1.js b/tests/baselines/reference/ambiguousGenericAssertion1.js index 40bbbee6dd2..8d40873036c 100644 --- a/tests/baselines/reference/ambiguousGenericAssertion1.js +++ b/tests/baselines/reference/ambiguousGenericAssertion1.js @@ -6,9 +6,7 @@ var r3 = <(x: T) => T>f; // ambiguous, appears to the parser as a << operatio //// [ambiguousGenericAssertion1.js] -function f(x) { - return null; -} +function f(x) { return null; } var r = function (x) { return x; }; var r2 = f; // valid var r3 = << T > (x), T; diff --git a/tests/baselines/reference/ambiguousOverload.js b/tests/baselines/reference/ambiguousOverload.js index fd373c075a2..642f09dca16 100644 --- a/tests/baselines/reference/ambiguousOverload.js +++ b/tests/baselines/reference/ambiguousOverload.js @@ -12,15 +12,11 @@ var x2: string = foof2("s", null); var y2: number = foof2("s", null); //// [ambiguousOverload.js] -function foof(bar) { - return bar; -} +function foof(bar) { return bar; } ; var x = foof("s", null); var y = foof("s", null); -function foof2(bar) { - return bar; -} +function foof2(bar) { return bar; } ; var x2 = foof2("s", null); var y2 = foof2("s", null); diff --git a/tests/baselines/reference/amdDependencyCommentName1.errors.txt b/tests/baselines/reference/amdDependencyCommentName1.errors.txt new file mode 100644 index 00000000000..6ba879abc72 --- /dev/null +++ b/tests/baselines/reference/amdDependencyCommentName1.errors.txt @@ -0,0 +1,10 @@ +tests/cases/compiler/amdDependencyCommentName1.ts(3,21): error TS2307: Cannot find external module 'm2'. + + +==== tests/cases/compiler/amdDependencyCommentName1.ts (1 errors) ==== + /// + + import m1 = require("m2") + ~~~~ +!!! error TS2307: Cannot find external module 'm2'. + m1.f(); \ No newline at end of file diff --git a/tests/baselines/reference/amdDependencyCommentName1.js b/tests/baselines/reference/amdDependencyCommentName1.js new file mode 100644 index 00000000000..b74e58b8538 --- /dev/null +++ b/tests/baselines/reference/amdDependencyCommentName1.js @@ -0,0 +1,10 @@ +//// [amdDependencyCommentName1.ts] +/// + +import m1 = require("m2") +m1.f(); + +//// [amdDependencyCommentName1.js] +/// +var m1 = require("m2"); +m1.f(); diff --git a/tests/baselines/reference/amdDependencyCommentName2.errors.txt b/tests/baselines/reference/amdDependencyCommentName2.errors.txt new file mode 100644 index 00000000000..e3d6b8d16ec --- /dev/null +++ b/tests/baselines/reference/amdDependencyCommentName2.errors.txt @@ -0,0 +1,10 @@ +tests/cases/compiler/amdDependencyCommentName2.ts(3,21): error TS2307: Cannot find external module 'm2'. + + +==== tests/cases/compiler/amdDependencyCommentName2.ts (1 errors) ==== + /// + + import m1 = require("m2") + ~~~~ +!!! error TS2307: Cannot find external module 'm2'. + m1.f(); \ No newline at end of file diff --git a/tests/baselines/reference/amdDependencyCommentName2.js b/tests/baselines/reference/amdDependencyCommentName2.js new file mode 100644 index 00000000000..4f54c548580 --- /dev/null +++ b/tests/baselines/reference/amdDependencyCommentName2.js @@ -0,0 +1,11 @@ +//// [amdDependencyCommentName2.ts] +/// + +import m1 = require("m2") +m1.f(); + +//// [amdDependencyCommentName2.js] +/// +define(["require", "exports", "m2", "bar"], function (require, exports, m1, b) { + m1.f(); +}); diff --git a/tests/baselines/reference/amdDependencyCommentName3.errors.txt b/tests/baselines/reference/amdDependencyCommentName3.errors.txt new file mode 100644 index 00000000000..a9342218c2c --- /dev/null +++ b/tests/baselines/reference/amdDependencyCommentName3.errors.txt @@ -0,0 +1,12 @@ +tests/cases/compiler/amdDependencyCommentName3.ts(5,21): error TS2307: Cannot find external module 'm2'. + + +==== tests/cases/compiler/amdDependencyCommentName3.ts (1 errors) ==== + /// + /// + /// + + import m1 = require("m2") + ~~~~ +!!! error TS2307: Cannot find external module 'm2'. + m1.f(); \ No newline at end of file diff --git a/tests/baselines/reference/amdDependencyCommentName3.js b/tests/baselines/reference/amdDependencyCommentName3.js new file mode 100644 index 00000000000..ca6b1280585 --- /dev/null +++ b/tests/baselines/reference/amdDependencyCommentName3.js @@ -0,0 +1,15 @@ +//// [amdDependencyCommentName3.ts] +/// +/// +/// + +import m1 = require("m2") +m1.f(); + +//// [amdDependencyCommentName3.js] +/// +/// +/// +define(["require", "exports", "m2", "bar", "goo", "foo"], function (require, exports, m1, b, c) { + m1.f(); +}); diff --git a/tests/baselines/reference/anonterface.js b/tests/baselines/reference/anonterface.js index 59d055b29d7..12bfbc4ec9d 100644 --- a/tests/baselines/reference/anonterface.js +++ b/tests/baselines/reference/anonterface.js @@ -28,6 +28,4 @@ var M; M.C = C; })(M || (M = {})); var c = new M.C(); -c.m(function (n) { - return "hello: " + n; -}, 18); +c.m(function (n) { return "hello: " + n; }, 18); diff --git a/tests/baselines/reference/anyInferenceAnonymousFunctions.js b/tests/baselines/reference/anyInferenceAnonymousFunctions.js index e232ec29593..df921965994 100644 --- a/tests/baselines/reference/anyInferenceAnonymousFunctions.js +++ b/tests/baselines/reference/anyInferenceAnonymousFunctions.js @@ -27,6 +27,4 @@ paired.reduce(function (b1, b2) { }, []); paired.reduce(function (b3, b4) { return b3.concat({}); }, []); paired.map(function (c1) { return c1.count; }); -paired.map(function (c2) { - return c2.count; -}); +paired.map(function (c2) { return c2.count; }); diff --git a/tests/baselines/reference/arrayAssignmentTest1.js b/tests/baselines/reference/arrayAssignmentTest1.js index 2a82d436596..0abfa889bed 100644 --- a/tests/baselines/reference/arrayAssignmentTest1.js +++ b/tests/baselines/reference/arrayAssignmentTest1.js @@ -95,12 +95,8 @@ var __extends = this.__extends || function (d, b) { var C1 = (function () { function C1() { } - C1.prototype.IM1 = function () { - return null; - }; - C1.prototype.C1M1 = function () { - return null; - }; + C1.prototype.IM1 = function () { return null; }; + C1.prototype.C1M1 = function () { return null; }; return C1; })(); var C2 = (function (_super) { @@ -108,17 +104,13 @@ var C2 = (function (_super) { function C2() { _super.apply(this, arguments); } - C2.prototype.C2M1 = function () { - return null; - }; + C2.prototype.C2M1 = function () { return null; }; return C2; })(C1); var C3 = (function () { function C3() { } - C3.prototype.CM3M1 = function () { - return 3; - }; + C3.prototype.CM3M1 = function () { return 3; }; return C3; })(); /* @@ -138,9 +130,7 @@ var i1 = c1; var c2 = new C2(); var c3 = new C3(); var o1 = { one: 1 }; -var f1 = function () { - return new C1(); -}; +var f1 = function () { return new C1(); }; var arr_any = []; var arr_i1 = []; var arr_c1 = []; diff --git a/tests/baselines/reference/arrayAssignmentTest2.js b/tests/baselines/reference/arrayAssignmentTest2.js index a62e0eec9ac..977862866ed 100644 --- a/tests/baselines/reference/arrayAssignmentTest2.js +++ b/tests/baselines/reference/arrayAssignmentTest2.js @@ -69,12 +69,8 @@ var __extends = this.__extends || function (d, b) { var C1 = (function () { function C1() { } - C1.prototype.IM1 = function () { - return null; - }; - C1.prototype.C1M1 = function () { - return null; - }; + C1.prototype.IM1 = function () { return null; }; + C1.prototype.C1M1 = function () { return null; }; return C1; })(); var C2 = (function (_super) { @@ -82,17 +78,13 @@ var C2 = (function (_super) { function C2() { _super.apply(this, arguments); } - C2.prototype.C2M1 = function () { - return null; - }; + C2.prototype.C2M1 = function () { return null; }; return C2; })(C1); var C3 = (function () { function C3() { } - C3.prototype.CM3M1 = function () { - return 3; - }; + C3.prototype.CM3M1 = function () { return 3; }; return C3; })(); /* @@ -112,9 +104,7 @@ var i1 = c1; var c2 = new C2(); var c3 = new C3(); var o1 = { one: 1 }; -var f1 = function () { - return new C1(); -}; +var f1 = function () { return new C1(); }; var arr_any = []; var arr_i1 = []; var arr_c1 = []; @@ -128,9 +118,7 @@ arr_c3 = arr_c2_2; // should be an error - is arr_c3 = arr_c1_2; // should be an error - is arr_c3 = arr_i1_2; // should be an error - is arr_any = f1; // should be an error - is -arr_any = function () { - return null; -}; // should be an error - is +arr_any = function () { return null; }; // should be an error - is arr_any = o1; // should be an error - is arr_any = a1; // should be ok - is arr_any = c1; // should be an error - is diff --git a/tests/baselines/reference/arrayAssignmentTest4.js b/tests/baselines/reference/arrayAssignmentTest4.js index 7ac0ccde77f..c38cdebc06c 100644 --- a/tests/baselines/reference/arrayAssignmentTest4.js +++ b/tests/baselines/reference/arrayAssignmentTest4.js @@ -30,9 +30,7 @@ arr_any = c3; // should be an error - is var C3 = (function () { function C3() { } - C3.prototype.CM3M1 = function () { - return 3; - }; + C3.prototype.CM3M1 = function () { return 3; }; return C3; })(); /* @@ -49,7 +47,5 @@ Type 1 of any[]: var c3 = new C3(); var o1 = { one: 1 }; var arr_any = []; -arr_any = function () { - return null; -}; // should be an error - is +arr_any = function () { return null; }; // should be an error - is arr_any = c3; // should be an error - is diff --git a/tests/baselines/reference/arrowFunctionContexts.js b/tests/baselines/reference/arrowFunctionContexts.js index cdf902a6c37..a10e3955ae0 100644 --- a/tests/baselines/reference/arrowFunctionContexts.js +++ b/tests/baselines/reference/arrowFunctionContexts.js @@ -184,14 +184,10 @@ var M2; // (ParamList) => { ... } is a generic arrow function var generic1 = function (n) { return [n]; }; var generic1; // Incorrect error, Bug 829597 -var generic2 = function (n) { - return [n]; -}; +var generic2 = function (n) { return [n]; }; var generic2; // ((ParamList) => { ... } ) is a type assertion to an arrow function var asserted1 = (function (n) { return [n]; }); var asserted1; -var asserted2 = (function (n) { - return n; -}); +var asserted2 = (function (n) { return n; }); var asserted2; diff --git a/tests/baselines/reference/arrowFunctionExpressions.js b/tests/baselines/reference/arrowFunctionExpressions.js index a828da6cffc..68516b52cb2 100644 --- a/tests/baselines/reference/arrowFunctionExpressions.js +++ b/tests/baselines/reference/arrowFunctionExpressions.js @@ -91,16 +91,10 @@ function tryCatchFn() { //// [arrowFunctionExpressions.js] // ArrowFormalParameters => AssignmentExpression is equivalent to ArrowFormalParameters => { return AssignmentExpression; } var a = function (p) { return p.length; }; -var a = function (p) { - return p.length; -}; +var a = function (p) { return p.length; }; // Identifier => Block is equivalent to(Identifier) => Block -var b = function (j) { - return 0; -}; -var b = function (j) { - return 0; -}; +var b = function (j) { return 0; }; +var b = function (j) { return 0; }; // Identifier => AssignmentExpression is equivalent to(Identifier) => AssignmentExpression var c; var d = function (n) { return c = n; }; diff --git a/tests/baselines/reference/arrowFunctionInConstructorArgument1.js b/tests/baselines/reference/arrowFunctionInConstructorArgument1.js index 3cfc18d2cf7..0f9c3f81b3b 100644 --- a/tests/baselines/reference/arrowFunctionInConstructorArgument1.js +++ b/tests/baselines/reference/arrowFunctionInConstructorArgument1.js @@ -11,6 +11,4 @@ var C = (function () { } return C; })(); -var c = new C(function () { - return asdf; -}); // should error +var c = new C(function () { return asdf; }); // should error diff --git a/tests/baselines/reference/arrowFunctionsMissingTokens.js b/tests/baselines/reference/arrowFunctionsMissingTokens.js index 3ea21232ac4..e0e22578ac6 100644 --- a/tests/baselines/reference/arrowFunctionsMissingTokens.js +++ b/tests/baselines/reference/arrowFunctionsMissingTokens.js @@ -79,24 +79,12 @@ var missingCurliesWithArrow; (function (missingCurliesWithArrow) { var withStatement; (function (withStatement) { - var a = function () { - var k = 10; - }; - var b = function () { - var k = 10; - }; - var c = function (x) { - var k = 10; - }; - var d = function (x, y) { - var k = 10; - }; - var e = function (x, y) { - var k = 10; - }; - var f = function () { - var k = 10; - }; + var a = function () { var k = 10; }; + var b = function () { var k = 10; }; + var c = function (x) { var k = 10; }; + var d = function (x, y) { var k = 10; }; + var e = function (x, y) { var k = 10; }; + var f = function () { var k = 10; }; })(withStatement || (withStatement = {})); var withoutStatement; (function (withoutStatement) { diff --git a/tests/baselines/reference/asiArith.js b/tests/baselines/reference/asiArith.js index 6d7b964c8d0..ac739bbd767 100644 --- a/tests/baselines/reference/asiArith.js +++ b/tests/baselines/reference/asiArith.js @@ -37,7 +37,9 @@ y //// [asiArith.js] var x = 1; var y = 1; -var z = x + + +y; +var z = x + ++ +y; var a = 1; var b = 1; -var c = x - - -y; +var c = x - +- -y; diff --git a/tests/baselines/reference/assignEveryTypeToAny.js b/tests/baselines/reference/assignEveryTypeToAny.js index c88fc2edc17..15aa6bcdd91 100644 --- a/tests/baselines/reference/assignEveryTypeToAny.js +++ b/tests/baselines/reference/assignEveryTypeToAny.js @@ -91,12 +91,8 @@ var h; x = h; var i; x = i; -x = { f: function () { - return 1; -} }; -x = { f: function (x) { - return x; -} }; +x = { f: function () { return 1; } }; +x = { f: function (x) { return x; } }; function j(a) { x = a; } diff --git a/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js b/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js index 513a2080dd4..fe6142cafe0 100644 --- a/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js +++ b/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js @@ -12,6 +12,4 @@ fn(function (a, b) { return true; }) //// [assignLambdaToNominalSubtypeOfFunction.js] function fn(cb) { } fn(function (a, b) { return true; }); -fn(function (a, b) { - return true; -}); +fn(function (a, b) { return true; }); diff --git a/tests/baselines/reference/assignToFn.js b/tests/baselines/reference/assignToFn.js index 620753e4941..2ff8ceedfa6 100644 --- a/tests/baselines/reference/assignToFn.js +++ b/tests/baselines/reference/assignToFn.js @@ -13,8 +13,6 @@ module M { //// [assignToFn.js] var M; (function (M) { - var x = { f: function (n) { - return true; - } }; + var x = { f: function (n) { return true; } }; x.f = "hello"; })(M || (M = {})); diff --git a/tests/baselines/reference/assignmentCompatBug2.js b/tests/baselines/reference/assignmentCompatBug2.js index 77d1e1b7d16..5545cc7d19c 100644 --- a/tests/baselines/reference/assignmentCompatBug2.js +++ b/tests/baselines/reference/assignmentCompatBug2.js @@ -44,50 +44,28 @@ b2 = { a: 0 }; // error b2 = { b: 0, a: 0 }; var b3; b3 = { - f: function (n) { - return 0; - }, - g: function (s) { - return 0; - }, + f: function (n) { return 0; }, + g: function (s) { return 0; }, m: 0 }; // ok b3 = { - f: function (n) { - return 0; - }, - g: function (s) { - return 0; - } + f: function (n) { return 0; }, + g: function (s) { return 0; } }; // error b3 = { - f: function (n) { - return 0; - }, + f: function (n) { return 0; }, m: 0 }; // error b3 = { - f: function (n) { - return 0; - }, - g: function (s) { - return 0; - }, + f: function (n) { return 0; }, + g: function (s) { return 0; }, m: 0, n: 0, - k: function (a) { - return null; - } + k: function (a) { return null; } }; // ok b3 = { - f: function (n) { - return 0; - }, - g: function (s) { - return 0; - }, + f: function (n) { return 0; }, + g: function (s) { return 0; }, n: 0, - k: function (a) { - return null; - } + k: function (a) { return null; } }; // error diff --git a/tests/baselines/reference/assignmentCompatBug3.js b/tests/baselines/reference/assignmentCompatBug3.js index da21ac17c9d..049e7090335 100644 --- a/tests/baselines/reference/assignmentCompatBug3.js +++ b/tests/baselines/reference/assignmentCompatBug3.js @@ -28,12 +28,8 @@ foo(x + y); //// [assignmentCompatBug3.js] function makePoint(x, y) { return { - get x() { - return x; - }, - get y() { - return y; - }, + get x() { return x; }, + get y() { return y; }, //x: "yo", //y: "boo", dist: function () { diff --git a/tests/baselines/reference/assignmentCompatBug5.js b/tests/baselines/reference/assignmentCompatBug5.js index d4f82584bec..ae444c3dad6 100644 --- a/tests/baselines/reference/assignmentCompatBug5.js +++ b/tests/baselines/reference/assignmentCompatBug5.js @@ -19,6 +19,4 @@ foo2(["s", "t"]); function foo3(x) { } ; foo3(function (s) { }); -foo3(function (n) { - return; -}); +foo3(function (n) { return; }); diff --git a/tests/baselines/reference/assignmentCompatForEnums.js b/tests/baselines/reference/assignmentCompatForEnums.js index 4bca6a514d2..8db85399fa8 100644 --- a/tests/baselines/reference/assignmentCompatForEnums.js +++ b/tests/baselines/reference/assignmentCompatForEnums.js @@ -22,9 +22,7 @@ var TokenType; })(TokenType || (TokenType = {})); ; var list = {}; -function returnType() { - return null; -} +function returnType() { return null; } function foo() { var x = returnType(); var x = list['one']; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures.js b/tests/baselines/reference/assignmentCompatWithCallSignatures.js index 0539463ddb1..12fc6159fac 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures.js @@ -57,26 +57,18 @@ a = s; a = a2; t = function (x) { return 1; }; t = function () { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = function (x) { return 1; }; a = function () { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; var s2; var a3; // these are errors t = s2; t = a3; t = function (x) { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = s2; a = a3; a = function (x) { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures2.js b/tests/baselines/reference/assignmentCompatWithCallSignatures2.js index 6fabe9b6af7..6bfc1b6c0d6 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures2.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures2.js @@ -64,38 +64,24 @@ a = s; a = a2; t = { f: function () { return 1; } }; t = { f: function (x) { return 1; } }; -t = { f: function f() { - return 1; -} }; -t = { f: function (x) { - return ''; -} }; +t = { f: function f() { return 1; } }; +t = { f: function (x) { return ''; } }; a = { f: function () { return 1; } }; a = { f: function (x) { return 1; } }; -a = { f: function (x) { - return ''; -} }; +a = { f: function (x) { return ''; } }; // errors t = function () { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = function () { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; var s2; var a3; // these are errors t = s2; t = a3; t = function (x) { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = s2; a = a3; a = function (x) { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures.js index 3dc7511fec0..c00aa121712 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures.js @@ -54,12 +54,8 @@ var a3; t = s2; t = a3; t = function (x) { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = s2; a = a3; a = function (x) { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js index 7f173224bc9..d00762aa1c5 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js @@ -56,25 +56,17 @@ a = s; a = a2; // errors t = function () { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = function () { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; var s2; var a3; // these are errors t = s2; t = a3; t = function (x) { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = s2; a = a3; a = function (x) { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; diff --git a/tests/baselines/reference/assignmentCompatWithOverloads.js b/tests/baselines/reference/assignmentCompatWithOverloads.js index 472ebec2967..ca3dc0e2294 100644 --- a/tests/baselines/reference/assignmentCompatWithOverloads.js +++ b/tests/baselines/reference/assignmentCompatWithOverloads.js @@ -31,18 +31,10 @@ var d: new(x: number) => void; d = C; // Error //// [assignmentCompatWithOverloads.js] -function f1(x) { - return null; -} -function f2(x) { - return null; -} -function f3(x) { - return null; -} -function f4(x) { - return undefined; -} +function f1(x) { return null; } +function f2(x) { return null; } +function f3(x) { return null; } +function f4(x) { return undefined; } var g; g = f1; // OK g = f2; // Error diff --git a/tests/baselines/reference/assignmentCompatability24.js b/tests/baselines/reference/assignmentCompatability24.js index 7eda1e61266..e6961264de8 100644 --- a/tests/baselines/reference/assignmentCompatability24.js +++ b/tests/baselines/reference/assignmentCompatability24.js @@ -19,9 +19,7 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - __test2__.obj = function f(a) { - return a; - }; + __test2__.obj = function f(a) { return a; }; ; __test2__.__val__obj = __test2__.obj; })(__test2__ || (__test2__ = {})); diff --git a/tests/baselines/reference/assignmentLHSIsValue.js b/tests/baselines/reference/assignmentLHSIsValue.js index 15bc7b9acfd..4b17f855171 100644 --- a/tests/baselines/reference/assignmentLHSIsValue.js +++ b/tests/baselines/reference/assignmentLHSIsValue.js @@ -84,17 +84,11 @@ var C = (function () { function C() { this = value; } - C.prototype.foo = function () { - this = value; - }; - C.sfoo = function () { - this = value; - }; + C.prototype.foo = function () { this = value; }; + C.sfoo = function () { this = value; }; return C; })(); -function foo() { - this = value; -} +function foo() { this = value; } this = value; // identifiers: module, class, enum, function var M; @@ -129,12 +123,8 @@ var Derived = (function (_super) { _super.call(this); _super.prototype. = value; } - Derived.prototype.foo = function () { - _super.prototype. = value; - }; - Derived.sfoo = function () { - _super. = value; - }; + Derived.prototype.foo = function () { _super.prototype. = value; }; + Derived.sfoo = function () { _super. = value; }; return Derived; })(C); // function expression diff --git a/tests/baselines/reference/baseTypePrivateMemberClash.errors.txt b/tests/baselines/reference/baseTypePrivateMemberClash.errors.txt index eca303ff72c..28e66844696 100644 --- a/tests/baselines/reference/baseTypePrivateMemberClash.errors.txt +++ b/tests/baselines/reference/baseTypePrivateMemberClash.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/baseTypePrivateMemberClash.ts(8,11): error TS2320: Interface 'Z' cannot simultaneously extend types 'X' and 'Y'. - Named properties 'm' of types 'X' and 'Y' are not identical. + Named property 'm' of types 'X' and 'Y' are not identical. ==== tests/cases/compiler/baseTypePrivateMemberClash.ts (1 errors) ==== @@ -13,4 +13,4 @@ tests/cases/compiler/baseTypePrivateMemberClash.ts(8,11): error TS2320: Interfac interface Z extends X, Y { } ~ !!! error TS2320: Interface 'Z' cannot simultaneously extend types 'X' and 'Y'. -!!! error TS2320: Named properties 'm' of types 'X' and 'Y' are not identical. \ No newline at end of file +!!! error TS2320: Named property 'm' of types 'X' and 'Y' are not identical. \ No newline at end of file diff --git a/tests/baselines/reference/bestCommonTypeOfTuple.js b/tests/baselines/reference/bestCommonTypeOfTuple.js index 752523317b5..f78f8990db0 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple.js +++ b/tests/baselines/reference/bestCommonTypeOfTuple.js @@ -26,15 +26,9 @@ var e3 = t3[2]; // any var e4 = t4[3]; // number //// [bestCommonTypeOfTuple.js] -function f1(x) { - return "foo"; -} -function f2(x) { - return 10; -} -function f3(x) { - return true; -} +function f1(x) { return "foo"; } +function f2(x) { return 10; } +function f3(x) { return true; } var E1; (function (E1) { E1[E1["one"] = 0] = "one"; diff --git a/tests/baselines/reference/bestCommonTypeReturnStatement.js b/tests/baselines/reference/bestCommonTypeReturnStatement.js index 232ffc07c54..f4ab98ed1c6 100644 --- a/tests/baselines/reference/bestCommonTypeReturnStatement.js +++ b/tests/baselines/reference/bestCommonTypeReturnStatement.js @@ -18,9 +18,5 @@ function f() { return b(); return d(); } -function b() { - return null; -} -function d() { - return null; -} +function b() { return null; } +function d() { return null; } diff --git a/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js b/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js index 9416e7b1a06..fb573a7523f 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js @@ -41,15 +41,11 @@ var ResultIsNumber8 = ~~BOOLEAN; //// [bitwiseNotOperatorWithBooleanType.js] // ~ operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js index 2f9703ae669..ac439f02903 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js @@ -48,15 +48,11 @@ var ResultIsNumber13 = ~~~(NUMBER + NUMBER); // ~ operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -70,9 +66,7 @@ var ResultIsNumber2 = ~NUMBER1; // number type literal var ResultIsNumber3 = ~1; var ResultIsNumber4 = ~{ x: 1, y: 2 }; -var ResultIsNumber5 = ~{ x: 1, y: function (n) { - return n; -} }; +var ResultIsNumber5 = ~{ x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsNumber6 = ~objA.a; var ResultIsNumber7 = ~M.n; diff --git a/tests/baselines/reference/bitwiseNotOperatorWithStringType.js b/tests/baselines/reference/bitwiseNotOperatorWithStringType.js index fbd77c6119a..a553712e16b 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithStringType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithStringType.js @@ -47,15 +47,11 @@ var ResultIsNumber14 = ~~~(STRING + STRING); // ~ operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -69,9 +65,7 @@ var ResultIsNumber2 = ~STRING1; // string type literal var ResultIsNumber3 = ~""; var ResultIsNumber4 = ~{ x: "", y: "" }; -var ResultIsNumber5 = ~{ x: "", y: function (s) { - return s; -} }; +var ResultIsNumber5 = ~{ x: "", y: function (s) { return s; } }; // string type expressions var ResultIsNumber6 = ~objA.a; var ResultIsNumber7 = ~M.n; diff --git a/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js b/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js index 59bfabd21d6..f1028956e16 100644 --- a/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js +++ b/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js @@ -47,14 +47,10 @@ var r7b = i2.f(1, ''); //// [callGenericFunctionWithIncorrectNumberOfTypeArguments.js] // type parameter lists must exactly match type argument lists // all of these invocations are errors -function f(x, y) { - return null; -} +function f(x, y) { return null; } var r1 = f(1, ''); var r1b = f(1, ''); -var f2 = function (x, y) { - return null; -}; +var f2 = function (x, y) { return null; }; var r2 = f2(1, ''); var r2b = f2(1, ''); var f3; diff --git a/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js b/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js index 04edc93f5d9..26b9d33a55d 100644 --- a/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js +++ b/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js @@ -38,13 +38,9 @@ var r7 = i2.f(1); //// [callGenericFunctionWithZeroTypeArguments.js] // valid invocations of generic functions with no explicit type arguments provided -function f(x) { - return null; -} +function f(x) { return null; } var r = f(1); -var f2 = function (x) { - return null; -}; +var f2 = function (x) { return null; }; var r2 = f2(1); var f3; var r3 = f3(1); diff --git a/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js b/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js index 306b4c70362..7b0355533e3 100644 --- a/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js +++ b/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js @@ -46,13 +46,9 @@ var r8 = a2(); //// [callNonGenericFunctionWithTypeArguments.js] // it is always illegal to provide type arguments to a non-generic function // all invocations here are illegal -function f(x) { - return null; -} +function f(x) { return null; } var r = f(1); -var f2 = function (x) { - return null; -}; +var f2 = function (x) { return null; }; var r2 = f2(1); var f3; var r3 = f3(1); diff --git a/tests/baselines/reference/callOverloads1.js b/tests/baselines/reference/callOverloads1.js index 94397c4ef8e..b1148c12420 100644 --- a/tests/baselines/reference/callOverloads1.js +++ b/tests/baselines/reference/callOverloads1.js @@ -25,9 +25,7 @@ var Foo = (function () { Foo.prototype.bar1 = function () { }; return Foo; })(); -function F1(a) { - return a; -} +function F1(a) { return a; } var f1 = new Foo("hey"); f1.bar1(); Foo(); diff --git a/tests/baselines/reference/callOverloads2.js b/tests/baselines/reference/callOverloads2.js index ed1b9cfcac3..b336911eeb0 100644 --- a/tests/baselines/reference/callOverloads2.js +++ b/tests/baselines/reference/callOverloads2.js @@ -33,12 +33,8 @@ var Foo = (function () { Foo.prototype.bar1 = function () { }; return Foo; })(); -function F1(s) { - return s; -} // error -function F1(a) { - return a; -} // error +function F1(s) { return s; } // error +function F1(a) { return a; } // error var f1 = new Foo("hey"); f1.bar1(); Foo(); diff --git a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js index c048c5c56de..0e78aac2b1b 100644 --- a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js +++ b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js @@ -202,9 +202,7 @@ function foo12() { return i2; } var r12 = foo12(); -function m1() { - return 1; -} +function m1() { return 1; } var m1; (function (m1) { m1.y = 2; diff --git a/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt index 5fabfd0b7ad..4ff65843eba 100644 --- a/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt +++ b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts(8,11): error TS2320: Interface 'A' cannot simultaneously extend types 'I' and 'I'. - Named properties 'foo' of types 'I' and 'I' are not identical. + Named property 'foo' of types 'I' and 'I' are not identical. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts(13,16): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. @@ -14,7 +14,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesTha interface A extends I, I { } ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'I' and 'I'. -!!! error TS2320: Named properties 'foo' of types 'I' and 'I' are not identical. +!!! error TS2320: Named property 'foo' of types 'I' and 'I' are not identical. var x: A; // BUG 822524 diff --git a/tests/baselines/reference/callWithSpread.errors.txt b/tests/baselines/reference/callWithSpread.errors.txt index 7ea026f4346..a28d4c8b1a1 100644 --- a/tests/baselines/reference/callWithSpread.errors.txt +++ b/tests/baselines/reference/callWithSpread.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/expressions/functionCalls/callWithSpread.ts(52,21): error TS2468: Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/expressions/functionCalls/callWithSpread.ts(52,21): error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher. ==== tests/cases/conformance/expressions/functionCalls/callWithSpread.ts (1 errors) ==== @@ -55,5 +55,5 @@ tests/cases/conformance/expressions/functionCalls/callWithSpread.ts(52,21): erro // Only supported in when target is ES6 var c = new C(1, 2, ...a); ~~~~ -!!! error TS2468: Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher. +!!! error TS2472: Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher. \ No newline at end of file diff --git a/tests/baselines/reference/callbacksDontShareTypes.js b/tests/baselines/reference/callbacksDontShareTypes.js index 649ed1cb6ca..e6483638058 100644 --- a/tests/baselines/reference/callbacksDontShareTypes.js +++ b/tests/baselines/reference/callbacksDontShareTypes.js @@ -21,14 +21,8 @@ var r5b = _.map(c2, rf1); //// [callbacksDontShareTypes.js] var _; var c2; -var rf1 = function (x) { - return x.toFixed(); -}; -var r1a = _.map(c2, function (x) { - return x.toFixed(); -}); +var rf1 = function (x) { return x.toFixed(); }; +var r1a = _.map(c2, function (x) { return x.toFixed(); }); var r1b = _.map(c2, rf1); // this line should not cause the following 2 to have errors -var r5a = _.map(c2, function (x) { - return x.toFixed(); -}); +var r5a = _.map(c2, function (x) { return x.toFixed(); }); var r5b = _.map(c2, rf1); diff --git a/tests/baselines/reference/castTest.js b/tests/baselines/reference/castTest.js index 5afa67026b9..ef9ef084d98 100644 --- a/tests/baselines/reference/castTest.js +++ b/tests/baselines/reference/castTest.js @@ -47,7 +47,5 @@ var p_cast = ({ add: function (dx, dy) { return new Point(this.x + dx, this.y + dy); }, - mult: function (p) { - return p; - } + mult: function (p) { return p; } }); diff --git a/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js b/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js index e6995a04aca..1884967aa9e 100644 --- a/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js +++ b/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js @@ -14,6 +14,4 @@ var s3 = s2.each(x => { x.key /* Type is K, should be number */ }); //// [chainedSpecializationToObjectTypeLiteral.js] var s; var s2 = s.groupBy(function (s) { return s.length; }); -var s3 = s2.each(function (x) { - x.key; /* Type is K, should be number */ -}); +var s3 = s2.each(function (x) { x.key; /* Type is K, should be number */ }); diff --git a/tests/baselines/reference/classExpression.js b/tests/baselines/reference/classExpression.js index 9d902abbf52..6bcf0f46f74 100644 --- a/tests/baselines/reference/classExpression.js +++ b/tests/baselines/reference/classExpression.js @@ -20,9 +20,7 @@ var C = (function () { return C; })(); var y = { - foo: , - class: C2 -}, _a = void 0; + foo: , class: C2 }, _a = void 0; var M; (function (M) { var z = ; diff --git a/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.js b/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.js index ed6e3138b07..907b6bd6fd2 100644 --- a/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.js +++ b/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.js @@ -19,20 +19,14 @@ var C = (function () { function C() { this.x = 1; } - C.prototype.foo = function (x) { - return x; - }; + C.prototype.foo = function (x) { return x; }; return C; })(); var D2 = (function () { function D2() { this.x = 3; } - D2.prototype.foo = function (x) { - return x; - }; - D2.prototype.other = function (x) { - return x; - }; + D2.prototype.foo = function (x) { return x; }; + D2.prototype.other = function (x) { return x; }; return D2; })(); diff --git a/tests/baselines/reference/classImplementsClass2.js b/tests/baselines/reference/classImplementsClass2.js index 98554944bc9..bc4f6b6748c 100644 --- a/tests/baselines/reference/classImplementsClass2.js +++ b/tests/baselines/reference/classImplementsClass2.js @@ -23,9 +23,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C = (function () { diff --git a/tests/baselines/reference/classImplementsClass3.js b/tests/baselines/reference/classImplementsClass3.js index 9dbfc4388e9..450263d00c9 100644 --- a/tests/baselines/reference/classImplementsClass3.js +++ b/tests/baselines/reference/classImplementsClass3.js @@ -24,9 +24,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C = (function () { diff --git a/tests/baselines/reference/classImplementsClass4.js b/tests/baselines/reference/classImplementsClass4.js index 0e08e508fb5..ac5c899bbbf 100644 --- a/tests/baselines/reference/classImplementsClass4.js +++ b/tests/baselines/reference/classImplementsClass4.js @@ -27,9 +27,7 @@ var A = (function () { function A() { this.x = 1; } - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C = (function () { diff --git a/tests/baselines/reference/classImplementsClass5.js b/tests/baselines/reference/classImplementsClass5.js index 46e826683e7..a0971904cc3 100644 --- a/tests/baselines/reference/classImplementsClass5.js +++ b/tests/baselines/reference/classImplementsClass5.js @@ -28,9 +28,7 @@ var A = (function () { function A() { this.x = 1; } - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C = (function () { diff --git a/tests/baselines/reference/classImplementsClass6.js b/tests/baselines/reference/classImplementsClass6.js index 386cd6685ae..931218e2bea 100644 --- a/tests/baselines/reference/classImplementsClass6.js +++ b/tests/baselines/reference/classImplementsClass6.js @@ -34,9 +34,7 @@ var A = (function () { A.bar = function () { return ""; }; - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C = (function () { diff --git a/tests/baselines/reference/classOrder2.js b/tests/baselines/reference/classOrder2.js index 0ba1e016bc8..4bc1c3f790c 100644 --- a/tests/baselines/reference/classOrder2.js +++ b/tests/baselines/reference/classOrder2.js @@ -31,9 +31,7 @@ var A = (function (_super) { function A() { _super.apply(this, arguments); } - A.prototype.foo = function () { - this.bar(); - }; + A.prototype.foo = function () { this.bar(); }; return A; })(B); var B = (function () { diff --git a/tests/baselines/reference/classPropertyAsPrivate.js b/tests/baselines/reference/classPropertyAsPrivate.js index fdb16620fac..51d08b48ec5 100644 --- a/tests/baselines/reference/classPropertyAsPrivate.js +++ b/tests/baselines/reference/classPropertyAsPrivate.js @@ -28,18 +28,14 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "y", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true }); C.prototype.foo = function () { }; Object.defineProperty(C, "b", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/classPropertyAsProtected.js b/tests/baselines/reference/classPropertyAsProtected.js index d036319fe8f..1cd74089816 100644 --- a/tests/baselines/reference/classPropertyAsProtected.js +++ b/tests/baselines/reference/classPropertyAsProtected.js @@ -28,18 +28,14 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "y", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true }); C.prototype.foo = function () { }; Object.defineProperty(C, "b", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/classPropertyIsPublicByDefault.js b/tests/baselines/reference/classPropertyIsPublicByDefault.js index fefa48be10a..a0b61a08922 100644 --- a/tests/baselines/reference/classPropertyIsPublicByDefault.js +++ b/tests/baselines/reference/classPropertyIsPublicByDefault.js @@ -27,18 +27,14 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "y", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true }); C.prototype.foo = function () { }; Object.defineProperty(C, "b", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/classSideInheritance1.js b/tests/baselines/reference/classSideInheritance1.js index 38b84b77bd3..74df624a78c 100644 --- a/tests/baselines/reference/classSideInheritance1.js +++ b/tests/baselines/reference/classSideInheritance1.js @@ -28,9 +28,7 @@ var A = (function () { A.bar = function () { return ""; }; - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C2 = (function (_super) { diff --git a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.js b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.js index e39391be68d..1c07449c994 100644 --- a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.js +++ b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.js @@ -30,13 +30,9 @@ i = c; var C = (function () { function C() { } - C.prototype.y = function (a) { - return null; - }; + C.prototype.y = function (a) { return null; }; Object.defineProperty(C.prototype, "z", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.js b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.js index b7aa9d52332..78e5cb05861 100644 --- a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.js +++ b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.js @@ -32,13 +32,9 @@ i = c; var C = (function () { function C() { } - C.prototype.y = function (a) { - return null; - }; + C.prototype.y = function (a) { return null; }; Object.defineProperty(C.prototype, "z", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/classWithPrivateProperty.js b/tests/baselines/reference/classWithPrivateProperty.js index 224fc432b64..0529fd8d694 100644 --- a/tests/baselines/reference/classWithPrivateProperty.js +++ b/tests/baselines/reference/classWithPrivateProperty.js @@ -30,12 +30,8 @@ var C = (function () { this.b = ''; this.d = function () { return ''; }; } - C.prototype.c = function () { - return ''; - }; - C.f = function () { - return ''; - }; + C.prototype.c = function () { return ''; }; + C.f = function () { return ''; }; C.g = function () { return ''; }; return C; })(); diff --git a/tests/baselines/reference/classWithProtectedProperty.js b/tests/baselines/reference/classWithProtectedProperty.js index c0dde0d3237..4de87229ad0 100644 --- a/tests/baselines/reference/classWithProtectedProperty.js +++ b/tests/baselines/reference/classWithProtectedProperty.js @@ -41,12 +41,8 @@ var C = (function () { this.b = ''; this.d = function () { return ''; }; } - C.prototype.c = function () { - return ''; - }; - C.f = function () { - return ''; - }; + C.prototype.c = function () { return ''; }; + C.f = function () { return ''; }; C.g = function () { return ''; }; return C; })(); diff --git a/tests/baselines/reference/classWithPublicProperty.js b/tests/baselines/reference/classWithPublicProperty.js index 97b3f46ab49..cc1b0aad64f 100644 --- a/tests/baselines/reference/classWithPublicProperty.js +++ b/tests/baselines/reference/classWithPublicProperty.js @@ -28,12 +28,8 @@ var C = (function () { this.b = ''; this.d = function () { return ''; }; } - C.prototype.c = function () { - return ''; - }; - C.f = function () { - return ''; - }; + C.prototype.c = function () { return ''; }; + C.f = function () { return ''; }; C.g = function () { return ''; }; return C; })(); diff --git a/tests/baselines/reference/classWithStaticMembers.js b/tests/baselines/reference/classWithStaticMembers.js index 0d3747dc313..36b8bd0af64 100644 --- a/tests/baselines/reference/classWithStaticMembers.js +++ b/tests/baselines/reference/classWithStaticMembers.js @@ -31,13 +31,9 @@ var C = (function () { this.a = a; this.b = b; } - C.fn = function () { - return this; - }; + C.fn = function () { return this; }; Object.defineProperty(C, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/cloduleWithDuplicateMember1.js b/tests/baselines/reference/cloduleWithDuplicateMember1.js index d64da830598..e3cb8f83fed 100644 --- a/tests/baselines/reference/cloduleWithDuplicateMember1.js +++ b/tests/baselines/reference/cloduleWithDuplicateMember1.js @@ -20,9 +20,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/clodulesDerivedClasses.js b/tests/baselines/reference/clodulesDerivedClasses.js index f249a7d5589..b4b31e59d3e 100644 --- a/tests/baselines/reference/clodulesDerivedClasses.js +++ b/tests/baselines/reference/clodulesDerivedClasses.js @@ -38,9 +38,7 @@ var Shape; (function (Shape) { var Utils; (function (Utils) { - function convert() { - return null; - } + function convert() { return null; } Utils.convert = convert; })(Utils = Shape.Utils || (Shape.Utils = {})); })(Shape || (Shape = {})); diff --git a/tests/baselines/reference/collisionThisExpressionAndLocalVarInFunction.js b/tests/baselines/reference/collisionThisExpressionAndLocalVarInFunction.js index 967d01819ec..879dd83d778 100644 --- a/tests/baselines/reference/collisionThisExpressionAndLocalVarInFunction.js +++ b/tests/baselines/reference/collisionThisExpressionAndLocalVarInFunction.js @@ -12,7 +12,5 @@ var console; function x() { var _this = this; var _this = 5; - (function (x) { - console.log(_this.x); - }); + (function (x) { console.log(_this.x); }); } diff --git a/tests/baselines/reference/collisionThisExpressionAndParameter.js b/tests/baselines/reference/collisionThisExpressionAndParameter.js index 7c11cab769f..3a19cf20d5a 100644 --- a/tests/baselines/reference/collisionThisExpressionAndParameter.js +++ b/tests/baselines/reference/collisionThisExpressionAndParameter.js @@ -144,9 +144,7 @@ var Foo1 = (function () { })(); function f1(_this) { var _this = this; - (function (x) { - console.log(_this.x); - }); + (function (x) { console.log(_this.x); }); } var Foo3 = (function () { function Foo3(_this) { @@ -167,7 +165,5 @@ var Foo3 = (function () { })(); function f3(_this) { var _this = this; - (function (x) { - console.log(_this.x); - }); + (function (x) { console.log(_this.x); }); } diff --git a/tests/baselines/reference/commentOnClassAccessor1.js b/tests/baselines/reference/commentOnClassAccessor1.js index cdd14a829fc..428e500da55 100644 --- a/tests/baselines/reference/commentOnClassAccessor1.js +++ b/tests/baselines/reference/commentOnClassAccessor1.js @@ -14,9 +14,7 @@ var C = (function () { /** * @type {number} */ - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/commentOnClassAccessor2.js b/tests/baselines/reference/commentOnClassAccessor2.js index e75431a7280..22a6b69f6c3 100644 --- a/tests/baselines/reference/commentOnClassAccessor2.js +++ b/tests/baselines/reference/commentOnClassAccessor2.js @@ -19,9 +19,7 @@ var C = (function () { /** * Getter. */ - get: function () { - return 1; - }, + get: function () { return 1; }, /** * Setter. */ diff --git a/tests/baselines/reference/commentOnSimpleArrowFunctionBody1.js b/tests/baselines/reference/commentOnSimpleArrowFunctionBody1.js index dc9bac84fa5..39f967555bf 100644 --- a/tests/baselines/reference/commentOnSimpleArrowFunctionBody1.js +++ b/tests/baselines/reference/commentOnSimpleArrowFunctionBody1.js @@ -11,4 +11,7 @@ Foo(() => //// [commentOnSimpleArrowFunctionBody1.js] function Foo(x) { } -Foo(function () { return 127; }); +Foo(function () { + // do something + return 127; +}); diff --git a/tests/baselines/reference/complexClassRelationships.js b/tests/baselines/reference/complexClassRelationships.js index a2a863cf54b..e8dc954e14c 100644 --- a/tests/baselines/reference/complexClassRelationships.js +++ b/tests/baselines/reference/complexClassRelationships.js @@ -68,9 +68,7 @@ var Derived = (function (_super) { })(Base); var BaseCollection = (function () { function BaseCollection(f) { - (function (item) { - return [item.Components]; - }); + (function (item) { return [item.Components]; }); } return BaseCollection; })(); @@ -83,9 +81,7 @@ var Thing = (function () { function Thing() { } Object.defineProperty(Thing.prototype, "Components", { - get: function () { - return null; - }, + get: function () { return null; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/compositeGenericFunction.js b/tests/baselines/reference/compositeGenericFunction.js index 0fe2e7d6f41..106c724ea24 100644 --- a/tests/baselines/reference/compositeGenericFunction.js +++ b/tests/baselines/reference/compositeGenericFunction.js @@ -7,12 +7,8 @@ var z: number = h(f); var z: number = h(f); //// [compositeGenericFunction.js] -function f(value) { - return value; -} +function f(value) { return value; } ; -function h(func) { - return null; -} +function h(func) { return null; } var z = h(f); var z = h(f); diff --git a/tests/baselines/reference/computedPropertyNames10_ES5.js b/tests/baselines/reference/computedPropertyNames10_ES5.js new file mode 100644 index 00000000000..ececb28b8cc --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames10_ES5.js @@ -0,0 +1,25 @@ +//// [computedPropertyNames10_ES5.ts] +var s: string; +var n: number; +var a: any; +var v = { + [s]() { }, + [n]() { }, + [s + s]() { }, + [s + n]() { }, + [+s]() { }, + [""]() { }, + [0]() { }, + [a]() { }, + [true]() { }, + [`hello bye`]() { }, + [`hello ${a} bye`]() { } +} + +//// [computedPropertyNames10_ES5.js] +var s; +var n; +var a; +var v = (_a = {}, _a[s] = function () { }, _a[n] = function () { }, _a[s + s] = function () { }, _a[s + n] = function () { }, _a[+s] = function () { }, _a[""] = function () { }, _a[0] = function () { }, _a[a] = function () { }, _a[true] = function () { }, _a["hello bye"] = function () { }, _a["hello " + a + " bye"] = function () { }, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames10.types b/tests/baselines/reference/computedPropertyNames10_ES5.types similarity index 91% rename from tests/baselines/reference/computedPropertyNames10.types rename to tests/baselines/reference/computedPropertyNames10_ES5.types index 29bf6c43bef..cb49d5c3384 100644 --- a/tests/baselines/reference/computedPropertyNames10.types +++ b/tests/baselines/reference/computedPropertyNames10_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames10.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts === var s: string; >s : string diff --git a/tests/baselines/reference/computedPropertyNames10.js b/tests/baselines/reference/computedPropertyNames10_ES6.js similarity index 83% rename from tests/baselines/reference/computedPropertyNames10.js rename to tests/baselines/reference/computedPropertyNames10_ES6.js index eb8db65dba5..0a55fabecd8 100644 --- a/tests/baselines/reference/computedPropertyNames10.js +++ b/tests/baselines/reference/computedPropertyNames10_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames10.ts] +//// [computedPropertyNames10_ES6.ts] var s: string; var n: number; var a: any; @@ -16,7 +16,7 @@ var v = { [`hello ${a} bye`]() { } } -//// [computedPropertyNames10.js] +//// [computedPropertyNames10_ES6.js] var s; var n; var a; diff --git a/tests/baselines/reference/computedPropertyNames10_ES6.types b/tests/baselines/reference/computedPropertyNames10_ES6.types new file mode 100644 index 00000000000..5dcc4783b5e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames10_ES6.types @@ -0,0 +1,46 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES6.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +var v = { +>v : {} +>{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : {} + + [s]() { }, +>s : string + + [n]() { }, +>n : number + + [s + s]() { }, +>s + s : string +>s : string +>s : string + + [s + n]() { }, +>s + n : string +>s : string +>n : number + + [+s]() { }, +>+s : number +>s : string + + [""]() { }, + [0]() { }, + [a]() { }, +>a : any + + [true]() { }, +>true : any + + [`hello bye`]() { }, + [`hello ${a} bye`]() { } +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.js b/tests/baselines/reference/computedPropertyNames11_ES5.js new file mode 100644 index 00000000000..d8450deb765 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames11_ES5.js @@ -0,0 +1,25 @@ +//// [computedPropertyNames11_ES5.ts] +var s: string; +var n: number; +var a: any; +var 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; } +} + +//// [computedPropertyNames11_ES5.js] +var s; +var n; +var a; +var v = (_a = {}, _a[s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[s + s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[s + n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[+s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[""] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[0] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[a] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[true] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a["hello bye"] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a["hello " + a + " bye"] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames11.types b/tests/baselines/reference/computedPropertyNames11_ES5.types similarity index 93% rename from tests/baselines/reference/computedPropertyNames11.types rename to tests/baselines/reference/computedPropertyNames11_ES5.types index ee0796320d6..ed3c51302b7 100644 --- a/tests/baselines/reference/computedPropertyNames11.types +++ b/tests/baselines/reference/computedPropertyNames11_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames11.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts === var s: string; >s : string diff --git a/tests/baselines/reference/computedPropertyNames11.js b/tests/baselines/reference/computedPropertyNames11_ES6.js similarity index 58% rename from tests/baselines/reference/computedPropertyNames11.js rename to tests/baselines/reference/computedPropertyNames11_ES6.js index 206fce0d76f..f1a774b88fe 100644 --- a/tests/baselines/reference/computedPropertyNames11.js +++ b/tests/baselines/reference/computedPropertyNames11_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames11.ts] +//// [computedPropertyNames11_ES6.ts] var s: string; var n: number; var a: any; @@ -16,32 +16,20 @@ var v = { get [`hello ${a} bye`]() { return 0; } } -//// [computedPropertyNames11.js] +//// [computedPropertyNames11_ES6.js] var s; var n; var a; var v = { - get [s]() { - return 0; - }, + get [s]() { return 0; }, set [n](v) { }, - get [s + s]() { - return 0; - }, + get [s + s]() { return 0; }, set [s + n](v) { }, - get [+s]() { - return 0; - }, + get [+s]() { return 0; }, set [""](v) { }, - get [0]() { - return 0; - }, + get [0]() { return 0; }, set [a](v) { }, - get [true]() { - return 0; - }, + get [true]() { return 0; }, set [`hello bye`](v) { }, - get [`hello ${a} bye`]() { - return 0; - } + get [`hello ${a} bye`]() { return 0; } }; diff --git a/tests/baselines/reference/computedPropertyNames11_ES6.types b/tests/baselines/reference/computedPropertyNames11_ES6.types new file mode 100644 index 00000000000..a0b9e6eb99e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames11_ES6.types @@ -0,0 +1,53 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES6.ts === +var s: string; +>s : string + +var n: number; +>n : number + +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; }} : {} + + get [s]() { return 0; }, +>s : string + + set [n](v) { }, +>n : number +>v : any + + get [s + s]() { return 0; }, +>s + s : string +>s : string +>s : string + + set [s + n](v) { }, +>s + n : string +>s : string +>n : number +>v : any + + get [+s]() { return 0; }, +>+s : number +>s : string + + set [""](v) { }, +>v : any + + get [0]() { return 0; }, + set [a](v) { }, +>a : any +>v : any + + get [true]() { return 0; }, +>true : any + + set [`hello bye`](v) { }, +>v : any + + get [`hello ${a} bye`]() { return 0; } +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames12.errors.txt b/tests/baselines/reference/computedPropertyNames12.errors.txt deleted file mode 100644 index 56774fe8dae..00000000000 --- a/tests/baselines/reference/computedPropertyNames12.errors.txt +++ /dev/null @@ -1,52 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(5,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(6,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(7,12): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(9,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(10,12): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(11,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(12,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(13,12): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(14,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(15,12): error TS1166: Computed property names are not allowed in class property declarations. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts (11 errors) ==== - var s: string; - var n: number; - var a: any; - class C { - [s]: number; - ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. - [n] = n; - ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. - static [s + s]: string; - ~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. - [s + n] = 2; - ~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. - [+s]: typeof s; - ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. - static [""]: number; - ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. - [0]: number; - ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. - [a]: number; - ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. - static [true]: number; - ~~~~~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. - [`hello bye`] = 0; - ~~~~~~~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. - static [`hello ${a} bye`] = 0 - ~~~~~~~~~~~~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames12_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames12_ES5.errors.txt new file mode 100644 index 00000000000..9d07f34f3c4 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames12_ES5.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(5,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(6,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(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) ==== + var s: string; + var n: number; + var a: any; + class C { + [s]: number; + ~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [n] = n; + ~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + static [s + s]: string; + ~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [s + n] = 2; + ~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [+s]: typeof s; + ~~~~ +!!! 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. + static [true]: number; + ~~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [`hello bye`] = 0; + ~~~~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + static [`hello ${a} bye`] = 0 + ~~~~~~~~~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames12_ES5.js b/tests/baselines/reference/computedPropertyNames12_ES5.js new file mode 100644 index 00000000000..c73ea11286f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames12_ES5.js @@ -0,0 +1,31 @@ +//// [computedPropertyNames12_ES5.ts] +var s: string; +var n: number; +var a: any; +class C { + [s]: number; + [n] = n; + static [s + s]: string; + [s + n] = 2; + [+s]: typeof s; + static [""]: number; + [0]: number; + [a]: number; + static [true]: number; + [`hello bye`] = 0; + static [`hello ${a} bye`] = 0 +} + +//// [computedPropertyNames12_ES5.js] +var s; +var n; +var a; +var C = (function () { + function C() { + this[n] = n; + this[s + n] = 2; + this["hello bye"] = 0; + } + C["hello " + a + " bye"] = 0; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames12_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames12_ES6.errors.txt new file mode 100644 index 00000000000..f0a2267f8b3 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames12_ES6.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(5,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(6,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(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) ==== + var s: string; + var n: number; + var a: any; + class C { + [s]: number; + ~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [n] = n; + ~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + static [s + s]: string; + ~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [s + n] = 2; + ~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [+s]: typeof s; + ~~~~ +!!! 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. + static [true]: number; + ~~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [`hello bye`] = 0; + ~~~~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + static [`hello ${a} bye`] = 0 + ~~~~~~~~~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames12.js b/tests/baselines/reference/computedPropertyNames12_ES6.js similarity index 84% rename from tests/baselines/reference/computedPropertyNames12.js rename to tests/baselines/reference/computedPropertyNames12_ES6.js index 5e5dec0c549..5ab6e4c09b3 100644 --- a/tests/baselines/reference/computedPropertyNames12.js +++ b/tests/baselines/reference/computedPropertyNames12_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames12.ts] +//// [computedPropertyNames12_ES6.ts] var s: string; var n: number; var a: any; @@ -16,7 +16,7 @@ class C { static [`hello ${a} bye`] = 0 } -//// [computedPropertyNames12.js] +//// [computedPropertyNames12_ES6.js] var s; var n; var a; diff --git a/tests/baselines/reference/computedPropertyNames13_ES5.js b/tests/baselines/reference/computedPropertyNames13_ES5.js new file mode 100644 index 00000000000..89562162911 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames13_ES5.js @@ -0,0 +1,38 @@ +//// [computedPropertyNames13_ES5.ts] +var s: string; +var n: number; +var a: any; +class C { + [s]() {} + [n]() { } + static [s + s]() { } + [s + n]() { } + [+s]() { } + static [""]() { } + [0]() { } + [a]() { } + static [true]() { } + [`hello bye`]() { } + static [`hello ${a} bye`]() { } +} + +//// [computedPropertyNames13_ES5.js] +var s; +var n; +var a; +var C = (function () { + function C() { + } + C.prototype[s] = function () { }; + C.prototype[n] = function () { }; + C[s + s] = function () { }; + C.prototype[s + n] = function () { }; + C.prototype[+s] = function () { }; + C[""] = function () { }; + C.prototype[0] = function () { }; + C.prototype[a] = function () { }; + C[true] = function () { }; + C.prototype["hello bye"] = function () { }; + C["hello " + a + " bye"] = function () { }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames13.types b/tests/baselines/reference/computedPropertyNames13_ES5.types similarity index 89% rename from tests/baselines/reference/computedPropertyNames13.types rename to tests/baselines/reference/computedPropertyNames13_ES5.types index 4f267f2e893..ff98a3189a7 100644 --- a/tests/baselines/reference/computedPropertyNames13.types +++ b/tests/baselines/reference/computedPropertyNames13_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames13.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts === var s: string; >s : string diff --git a/tests/baselines/reference/computedPropertyNames13.js b/tests/baselines/reference/computedPropertyNames13_ES6.js similarity index 88% rename from tests/baselines/reference/computedPropertyNames13.js rename to tests/baselines/reference/computedPropertyNames13_ES6.js index 0456e32602f..b18ef3fb3e2 100644 --- a/tests/baselines/reference/computedPropertyNames13.js +++ b/tests/baselines/reference/computedPropertyNames13_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames13.ts] +//// [computedPropertyNames13_ES6.ts] var s: string; var n: number; var a: any; @@ -16,7 +16,7 @@ class C { static [`hello ${a} bye`]() { } } -//// [computedPropertyNames13.js] +//// [computedPropertyNames13_ES6.js] var s; var n; var a; diff --git a/tests/baselines/reference/computedPropertyNames13_ES6.types b/tests/baselines/reference/computedPropertyNames13_ES6.types new file mode 100644 index 00000000000..78b2f3afc4a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames13_ES6.types @@ -0,0 +1,45 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES6.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +class C { +>C : C + + [s]() {} +>s : string + + [n]() { } +>n : number + + static [s + s]() { } +>s + s : string +>s : string +>s : string + + [s + n]() { } +>s + n : string +>s : string +>n : number + + [+s]() { } +>+s : number +>s : string + + static [""]() { } + [0]() { } + [a]() { } +>a : any + + static [true]() { } +>true : any + + [`hello bye`]() { } + static [`hello ${a} bye`]() { } +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames14.errors.txt b/tests/baselines/reference/computedPropertyNames14_ES5.errors.txt similarity index 53% rename from tests/baselines/reference/computedPropertyNames14.errors.txt rename to tests/baselines/reference/computedPropertyNames14_ES5.errors.txt index 1cf5b1445f2..0ca77380e41 100644 --- a/tests/baselines/reference/computedPropertyNames14.errors.txt +++ b/tests/baselines/reference/computedPropertyNames14_ES5.errors.txt @@ -1,30 +1,30 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts (6 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts (6 errors) ==== var b: boolean; class C { [b]() {} ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static [true]() { } ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [[]]() { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static [{}]() { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [undefined]() { } ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static [null]() { } ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames14.js b/tests/baselines/reference/computedPropertyNames14_ES5.js similarity index 82% rename from tests/baselines/reference/computedPropertyNames14.js rename to tests/baselines/reference/computedPropertyNames14_ES5.js index a0b39a5e143..5db5e842a2a 100644 --- a/tests/baselines/reference/computedPropertyNames14.js +++ b/tests/baselines/reference/computedPropertyNames14_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames14.ts] +//// [computedPropertyNames14_ES5.ts] var b: boolean; class C { [b]() {} @@ -9,7 +9,7 @@ class C { static [null]() { } } -//// [computedPropertyNames14.js] +//// [computedPropertyNames14_ES5.js] var b; var C = (function () { function C() { diff --git a/tests/baselines/reference/computedPropertyNames14_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames14_ES6.errors.txt new file mode 100644 index 00000000000..97525a783aa --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames14_ES6.errors.txt @@ -0,0 +1,30 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts (6 errors) ==== + var b: boolean; + class C { + [b]() {} + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + static [true]() { } + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [[]]() { } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + static [{}]() { } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [undefined]() { } + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + static [null]() { } + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames14_ES6.js b/tests/baselines/reference/computedPropertyNames14_ES6.js new file mode 100644 index 00000000000..94b4196a606 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames14_ES6.js @@ -0,0 +1,24 @@ +//// [computedPropertyNames14_ES6.ts] +var b: boolean; +class C { + [b]() {} + static [true]() { } + [[]]() { } + static [{}]() { } + [undefined]() { } + static [null]() { } +} + +//// [computedPropertyNames14_ES6.js] +var b; +var C = (function () { + function C() { + } + C.prototype[b] = function () { }; + C[true] = function () { }; + C.prototype[[]] = function () { }; + C[{}] = function () { }; + C.prototype[undefined] = function () { }; + C[null] = function () { }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames15.errors.txt b/tests/baselines/reference/computedPropertyNames15_ES5.errors.txt similarity index 59% rename from tests/baselines/reference/computedPropertyNames15.errors.txt rename to tests/baselines/reference/computedPropertyNames15_ES5.errors.txt index 0e759668a95..649c438e47e 100644 --- a/tests/baselines/reference/computedPropertyNames15.errors.txt +++ b/tests/baselines/reference/computedPropertyNames15_ES5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts (2 errors) ==== var p1: number | string; var p2: number | number[]; var p3: string | boolean; @@ -10,8 +10,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5): [p1]() { } [p2]() { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [p3]() { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames15.js b/tests/baselines/reference/computedPropertyNames15_ES5.js similarity index 79% rename from tests/baselines/reference/computedPropertyNames15.js rename to tests/baselines/reference/computedPropertyNames15_ES5.js index 429b23614ab..93258b64c75 100644 --- a/tests/baselines/reference/computedPropertyNames15.js +++ b/tests/baselines/reference/computedPropertyNames15_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames15.ts] +//// [computedPropertyNames15_ES5.ts] var p1: number | string; var p2: number | number[]; var p3: string | boolean; @@ -8,7 +8,7 @@ class C { [p3]() { } } -//// [computedPropertyNames15.js] +//// [computedPropertyNames15_ES5.js] var p1; var p2; var p3; diff --git a/tests/baselines/reference/computedPropertyNames15_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames15_ES6.errors.txt new file mode 100644 index 00000000000..e35e8f645c8 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames15_ES6.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES6.ts (2 errors) ==== + var p1: number | string; + var p2: number | number[]; + var p3: string | boolean; + class C { + [p1]() { } + [p2]() { } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [p3]() { } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames15_ES6.js b/tests/baselines/reference/computedPropertyNames15_ES6.js new file mode 100644 index 00000000000..ab7bf4552d6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames15_ES6.js @@ -0,0 +1,22 @@ +//// [computedPropertyNames15_ES6.ts] +var p1: number | string; +var p2: number | number[]; +var p3: string | boolean; +class C { + [p1]() { } + [p2]() { } + [p3]() { } +} + +//// [computedPropertyNames15_ES6.js] +var p1; +var p2; +var p3; +var C = (function () { + function C() { + } + C.prototype[p1] = function () { }; + C.prototype[p2] = function () { }; + C.prototype[p3] = function () { }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames16_ES5.js b/tests/baselines/reference/computedPropertyNames16_ES5.js new file mode 100644 index 00000000000..2c7316e1398 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames16_ES5.js @@ -0,0 +1,82 @@ +//// [computedPropertyNames16_ES5.ts] +var s: string; +var n: number; +var a: any; +class C { + get [s]() { return 0;} + set [n](v) { } + static get [s + s]() { return 0; } + set [s + n](v) { } + get [+s]() { return 0; } + static set [""](v) { } + get [0]() { return 0; } + set [a](v) { } + static get [true]() { return 0; } + set [`hello bye`](v) { } + get [`hello ${a} bye`]() { return 0; } +} + +//// [computedPropertyNames16_ES5.js] +var s; +var n; +var a; +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, s, { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, n, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, s + s, { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, s + n, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, +s, { + get: function () { return 0; }, + 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, + configurable: true + }); + Object.defineProperty(C, true, { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "hello bye", { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "hello " + a + " bye", { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames16.types b/tests/baselines/reference/computedPropertyNames16_ES5.types similarity index 90% rename from tests/baselines/reference/computedPropertyNames16.types rename to tests/baselines/reference/computedPropertyNames16_ES5.types index ccfa7996066..3914093c766 100644 --- a/tests/baselines/reference/computedPropertyNames16.types +++ b/tests/baselines/reference/computedPropertyNames16_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames16.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts === var s: string; >s : string diff --git a/tests/baselines/reference/computedPropertyNames16.js b/tests/baselines/reference/computedPropertyNames16_ES6.js similarity index 77% rename from tests/baselines/reference/computedPropertyNames16.js rename to tests/baselines/reference/computedPropertyNames16_ES6.js index 9a55c3f9ed5..369040e7e22 100644 --- a/tests/baselines/reference/computedPropertyNames16.js +++ b/tests/baselines/reference/computedPropertyNames16_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames16.ts] +//// [computedPropertyNames16_ES6.ts] var s: string; var n: number; var a: any; @@ -16,7 +16,7 @@ class C { get [`hello ${a} bye`]() { return 0; } } -//// [computedPropertyNames16.js] +//// [computedPropertyNames16_ES6.js] var s; var n; var a; @@ -24,9 +24,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, s, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -36,9 +34,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C, s + s, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -48,9 +44,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, +s, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -60,9 +54,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, 0, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -72,9 +64,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C, true, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -84,9 +74,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, `hello ${a} bye`, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames16_ES6.types b/tests/baselines/reference/computedPropertyNames16_ES6.types new file mode 100644 index 00000000000..6503c75037d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames16_ES6.types @@ -0,0 +1,52 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES6.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +class C { +>C : C + + get [s]() { return 0;} +>s : string + + set [n](v) { } +>n : number +>v : any + + static get [s + s]() { return 0; } +>s + s : string +>s : string +>s : string + + set [s + n](v) { } +>s + n : string +>s : string +>n : number +>v : any + + get [+s]() { return 0; } +>+s : number +>s : string + + static set [""](v) { } +>v : any + + get [0]() { return 0; } + set [a](v) { } +>a : any +>v : any + + static get [true]() { return 0; } +>true : any + + set [`hello bye`](v) { } +>v : any + + get [`hello ${a} bye`]() { return 0; } +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames17.errors.txt b/tests/baselines/reference/computedPropertyNames17_ES5.errors.txt similarity index 55% rename from tests/baselines/reference/computedPropertyNames17.errors.txt rename to tests/baselines/reference/computedPropertyNames17_ES5.errors.txt index b236ae3245e..31a9d341dc4 100644 --- a/tests/baselines/reference/computedPropertyNames17.errors.txt +++ b/tests/baselines/reference/computedPropertyNames17_ES5.errors.txt @@ -1,30 +1,30 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts (6 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts (6 errors) ==== var b: boolean; class C { get [b]() { return 0;} ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static set [true](v) { } ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. get [[]]() { return 0; } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. set [{}](v) { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static get [undefined]() { return 0; } ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. set [null](v) { } ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames17.js b/tests/baselines/reference/computedPropertyNames17_ES5.js similarity index 77% rename from tests/baselines/reference/computedPropertyNames17.js rename to tests/baselines/reference/computedPropertyNames17_ES5.js index 026671ed8a6..3b5c100694d 100644 --- a/tests/baselines/reference/computedPropertyNames17.js +++ b/tests/baselines/reference/computedPropertyNames17_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames17.ts] +//// [computedPropertyNames17_ES5.ts] var b: boolean; class C { get [b]() { return 0;} @@ -9,15 +9,13 @@ class C { set [null](v) { } } -//// [computedPropertyNames17.js] +//// [computedPropertyNames17_ES5.js] var b; var C = (function () { function C() { } Object.defineProperty(C.prototype, b, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -27,9 +25,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, [], { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -39,9 +35,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C, undefined, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames17_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames17_ES6.errors.txt new file mode 100644 index 00000000000..4c1566f032b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames17_ES6.errors.txt @@ -0,0 +1,30 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts (6 errors) ==== + var b: boolean; + class C { + get [b]() { return 0;} + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + static set [true](v) { } + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + get [[]]() { return 0; } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + set [{}](v) { } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + static get [undefined]() { return 0; } + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + set [null](v) { } + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames17_ES6.js b/tests/baselines/reference/computedPropertyNames17_ES6.js new file mode 100644 index 00000000000..38012efbb14 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames17_ES6.js @@ -0,0 +1,48 @@ +//// [computedPropertyNames17_ES6.ts] +var b: boolean; +class C { + get [b]() { return 0;} + static set [true](v) { } + get [[]]() { return 0; } + set [{}](v) { } + static get [undefined]() { return 0; } + set [null](v) { } +} + +//// [computedPropertyNames17_ES6.js] +var b; +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, b, { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, true, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, [], { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, {}, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, undefined, { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, null, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames18_ES5.js b/tests/baselines/reference/computedPropertyNames18_ES5.js new file mode 100644 index 00000000000..0ccc0fb4e00 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames18_ES5.js @@ -0,0 +1,14 @@ +//// [computedPropertyNames18_ES5.ts] +function foo() { + var obj = { + [this.bar]: 0 + } +} + +//// [computedPropertyNames18_ES5.js] +function foo() { + var obj = (_a = {}, _a[this.bar] = + 0, + _a); + var _a; +} diff --git a/tests/baselines/reference/computedPropertyNames18.types b/tests/baselines/reference/computedPropertyNames18_ES5.types similarity index 86% rename from tests/baselines/reference/computedPropertyNames18.types rename to tests/baselines/reference/computedPropertyNames18_ES5.types index 0976e5fc3ca..732de08e2d6 100644 --- a/tests/baselines/reference/computedPropertyNames18.types +++ b/tests/baselines/reference/computedPropertyNames18_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames18.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts === function foo() { >foo : () => void diff --git a/tests/baselines/reference/computedPropertyNames18.js b/tests/baselines/reference/computedPropertyNames18_ES6.js similarity index 60% rename from tests/baselines/reference/computedPropertyNames18.js rename to tests/baselines/reference/computedPropertyNames18_ES6.js index af2d68b3095..fbf840feb31 100644 --- a/tests/baselines/reference/computedPropertyNames18.js +++ b/tests/baselines/reference/computedPropertyNames18_ES6.js @@ -1,11 +1,11 @@ -//// [computedPropertyNames18.ts] +//// [computedPropertyNames18_ES6.ts] function foo() { var obj = { [this.bar]: 0 } } -//// [computedPropertyNames18.js] +//// [computedPropertyNames18_ES6.js] function foo() { var obj = { [this.bar]: 0 diff --git a/tests/baselines/reference/computedPropertyNames18_ES6.types b/tests/baselines/reference/computedPropertyNames18_ES6.types new file mode 100644 index 00000000000..af7081fa2ad --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames18_ES6.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES6.ts === +function foo() { +>foo : () => void + + var obj = { +>obj : {} +>{ [this.bar]: 0 } : {} + + [this.bar]: 0 +>this.bar : any +>this : any +>bar : any + } +} diff --git a/tests/baselines/reference/computedPropertyNames19.errors.txt b/tests/baselines/reference/computedPropertyNames19_ES5.errors.txt similarity index 69% rename from tests/baselines/reference/computedPropertyNames19.errors.txt rename to tests/baselines/reference/computedPropertyNames19_ES5.errors.txt index 2037008992f..49a1f008a05 100644 --- a/tests/baselines/reference/computedPropertyNames19.errors.txt +++ b/tests/baselines/reference/computedPropertyNames19_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts(3,10): error TS2331: 'this' cannot be referenced in a module body. +tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts(3,10): error TS2331: 'this' cannot be referenced in a module body. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts (1 errors) ==== module M { var obj = { [this.bar]: 0 diff --git a/tests/baselines/reference/computedPropertyNames19_ES5.js b/tests/baselines/reference/computedPropertyNames19_ES5.js new file mode 100644 index 00000000000..a18cb7b95c3 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames19_ES5.js @@ -0,0 +1,15 @@ +//// [computedPropertyNames19_ES5.ts] +module M { + var obj = { + [this.bar]: 0 + } +} + +//// [computedPropertyNames19_ES5.js] +var M; +(function (M) { + var obj = (_a = {}, _a[this.bar] = + 0, + _a); + var _a; +})(M || (M = {})); diff --git a/tests/baselines/reference/computedPropertyNames19_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames19_ES6.errors.txt new file mode 100644 index 00000000000..9e2d1afbe74 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames19_ES6.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES6.ts(3,10): error TS2331: 'this' cannot be referenced in a module body. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES6.ts (1 errors) ==== + module M { + var obj = { + [this.bar]: 0 + ~~~~ +!!! error TS2331: 'this' cannot be referenced in a module body. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames19.js b/tests/baselines/reference/computedPropertyNames19_ES6.js similarity index 62% rename from tests/baselines/reference/computedPropertyNames19.js rename to tests/baselines/reference/computedPropertyNames19_ES6.js index 3fd2f99eea6..99ebde491ec 100644 --- a/tests/baselines/reference/computedPropertyNames19.js +++ b/tests/baselines/reference/computedPropertyNames19_ES6.js @@ -1,11 +1,11 @@ -//// [computedPropertyNames19.ts] +//// [computedPropertyNames19_ES6.ts] module M { var obj = { [this.bar]: 0 } } -//// [computedPropertyNames19.js] +//// [computedPropertyNames19_ES6.js] var M; (function (M) { var obj = { diff --git a/tests/baselines/reference/computedPropertyNames1_ES5.js b/tests/baselines/reference/computedPropertyNames1_ES5.js new file mode 100644 index 00000000000..36a7fd6052d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames1_ES5.js @@ -0,0 +1,10 @@ +//// [computedPropertyNames1_ES5.ts] +var v = { + get [0 + 1]() { return 0 }, + set [0 + 1](v: string) { } //No error +} + +//// [computedPropertyNames1_ES5.js] +var v = (_a = {}, _a[0 + 1] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[0 + 1] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames1.types b/tests/baselines/reference/computedPropertyNames1_ES5.types similarity index 89% rename from tests/baselines/reference/computedPropertyNames1.types rename to tests/baselines/reference/computedPropertyNames1_ES5.types index b44aa3c69d0..6627d53d1da 100644 --- a/tests/baselines/reference/computedPropertyNames1.types +++ b/tests/baselines/reference/computedPropertyNames1_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts === var v = { >v : {} >{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : {} diff --git a/tests/baselines/reference/computedPropertyNames1.js b/tests/baselines/reference/computedPropertyNames1_ES6.js similarity index 52% rename from tests/baselines/reference/computedPropertyNames1.js rename to tests/baselines/reference/computedPropertyNames1_ES6.js index 4f0bcb3a8f4..80a7d2ecdd2 100644 --- a/tests/baselines/reference/computedPropertyNames1.js +++ b/tests/baselines/reference/computedPropertyNames1_ES6.js @@ -1,13 +1,11 @@ -//// [computedPropertyNames1.ts] +//// [computedPropertyNames1_ES6.ts] var v = { get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error } -//// [computedPropertyNames1.js] +//// [computedPropertyNames1_ES6.js] var v = { - get [0 + 1]() { - return 0; - }, + get [0 + 1]() { return 0; }, set [0 + 1](v) { } //No error }; diff --git a/tests/baselines/reference/computedPropertyNames1_ES6.types b/tests/baselines/reference/computedPropertyNames1_ES6.types new file mode 100644 index 00000000000..966cfef579d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames1_ES6.types @@ -0,0 +1,12 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES6.ts === +var v = { +>v : {} +>{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : {} + + get [0 + 1]() { return 0 }, +>0 + 1 : number + + set [0 + 1](v: string) { } //No error +>0 + 1 : number +>v : string +} diff --git a/tests/baselines/reference/computedPropertyNames20.js b/tests/baselines/reference/computedPropertyNames20.js deleted file mode 100644 index 2a1edf06142..00000000000 --- a/tests/baselines/reference/computedPropertyNames20.js +++ /dev/null @@ -1,9 +0,0 @@ -//// [computedPropertyNames20.ts] -var obj = { - [this.bar]: 0 -} - -//// [computedPropertyNames20.js] -var obj = { - [this.bar]: 0 -}; diff --git a/tests/baselines/reference/computedPropertyNames20_ES5.js b/tests/baselines/reference/computedPropertyNames20_ES5.js new file mode 100644 index 00000000000..21af64d7e41 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames20_ES5.js @@ -0,0 +1,10 @@ +//// [computedPropertyNames20_ES5.ts] +var obj = { + [this.bar]: 0 +} + +//// [computedPropertyNames20_ES5.js] +var obj = (_a = {}, _a[this.bar] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames20.types b/tests/baselines/reference/computedPropertyNames20_ES5.types similarity index 84% rename from tests/baselines/reference/computedPropertyNames20.types rename to tests/baselines/reference/computedPropertyNames20_ES5.types index abd1b203e87..eb2bbf34b7e 100644 --- a/tests/baselines/reference/computedPropertyNames20.types +++ b/tests/baselines/reference/computedPropertyNames20_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames20.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts === var obj = { >obj : {} >{ [this.bar]: 0} : {} diff --git a/tests/baselines/reference/computedPropertyNames20_ES6.js b/tests/baselines/reference/computedPropertyNames20_ES6.js new file mode 100644 index 00000000000..c128d8c0f85 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames20_ES6.js @@ -0,0 +1,9 @@ +//// [computedPropertyNames20_ES6.ts] +var obj = { + [this.bar]: 0 +} + +//// [computedPropertyNames20_ES6.js] +var obj = { + [this.bar]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames20_ES6.types b/tests/baselines/reference/computedPropertyNames20_ES6.types new file mode 100644 index 00000000000..2280c7c4820 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames20_ES6.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES6.ts === +var obj = { +>obj : {} +>{ [this.bar]: 0} : {} + + [this.bar]: 0 +>this.bar : any +>this : any +>bar : any +} diff --git a/tests/baselines/reference/computedPropertyNames21.errors.txt b/tests/baselines/reference/computedPropertyNames21_ES5.errors.txt similarity index 69% rename from tests/baselines/reference/computedPropertyNames21.errors.txt rename to tests/baselines/reference/computedPropertyNames21_ES5.errors.txt index a44c8d60ee8..cb794d3865a 100644 --- a/tests/baselines/reference/computedPropertyNames21.errors.txt +++ b/tests/baselines/reference/computedPropertyNames21_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts(5,6): error TS2465: 'this' cannot be referenced in a computed property name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts(5,6): error TS2465: 'this' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts (1 errors) ==== class C { bar() { return 0; diff --git a/tests/baselines/reference/computedPropertyNames21.js b/tests/baselines/reference/computedPropertyNames21_ES5.js similarity index 73% rename from tests/baselines/reference/computedPropertyNames21.js rename to tests/baselines/reference/computedPropertyNames21_ES5.js index d5ca1422a5e..81f95cd824d 100644 --- a/tests/baselines/reference/computedPropertyNames21.js +++ b/tests/baselines/reference/computedPropertyNames21_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames21.ts] +//// [computedPropertyNames21_ES5.ts] class C { bar() { return 0; @@ -6,7 +6,7 @@ class C { [this.bar()]() { } } -//// [computedPropertyNames21.js] +//// [computedPropertyNames21_ES5.js] var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames21_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames21_ES6.errors.txt new file mode 100644 index 00000000000..064e086cd5c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames21_ES6.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES6.ts(5,6): error TS2465: 'this' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES6.ts (1 errors) ==== + class C { + bar() { + return 0; + } + [this.bar()]() { } + ~~~~ +!!! error TS2465: 'this' cannot be referenced in a computed property name. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames21_ES6.js b/tests/baselines/reference/computedPropertyNames21_ES6.js new file mode 100644 index 00000000000..34a1878f689 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames21_ES6.js @@ -0,0 +1,18 @@ +//// [computedPropertyNames21_ES6.ts] +class C { + bar() { + return 0; + } + [this.bar()]() { } +} + +//// [computedPropertyNames21_ES6.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + return 0; + }; + C.prototype[this.bar()] = function () { }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames22_ES5.js b/tests/baselines/reference/computedPropertyNames22_ES5.js new file mode 100644 index 00000000000..e3e685aa54b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames22_ES5.js @@ -0,0 +1,22 @@ +//// [computedPropertyNames22_ES5.ts] +class C { + bar() { + var obj = { + [this.bar()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames22_ES5.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + var obj = (_a = {}, _a[this.bar()] = function () { }, + _a); + return 0; + var _a; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames22.types b/tests/baselines/reference/computedPropertyNames22_ES5.types similarity index 88% rename from tests/baselines/reference/computedPropertyNames22.types rename to tests/baselines/reference/computedPropertyNames22_ES5.types index d23546192c0..7afeeb75fa3 100644 --- a/tests/baselines/reference/computedPropertyNames22.types +++ b/tests/baselines/reference/computedPropertyNames22_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames22.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts === class C { >C : C diff --git a/tests/baselines/reference/computedPropertyNames22.js b/tests/baselines/reference/computedPropertyNames22_ES6.js similarity index 76% rename from tests/baselines/reference/computedPropertyNames22.js rename to tests/baselines/reference/computedPropertyNames22_ES6.js index dc6a53ff91a..c5d58939fc8 100644 --- a/tests/baselines/reference/computedPropertyNames22.js +++ b/tests/baselines/reference/computedPropertyNames22_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames22.ts] +//// [computedPropertyNames22_ES6.ts] class C { bar() { var obj = { @@ -8,7 +8,7 @@ class C { } } -//// [computedPropertyNames22.js] +//// [computedPropertyNames22_ES6.js] var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames22_ES6.types b/tests/baselines/reference/computedPropertyNames22_ES6.types new file mode 100644 index 00000000000..b65f276881f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames22_ES6.types @@ -0,0 +1,21 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES6.ts === +class C { +>C : C + + bar() { +>bar : () => number + + var obj = { +>obj : {} +>{ [this.bar()]() { } } : {} + + [this.bar()]() { } +>this.bar() : number +>this.bar : () => number +>this : C +>bar : () => number + + }; + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames23.errors.txt b/tests/baselines/reference/computedPropertyNames23_ES5.errors.txt similarity index 71% rename from tests/baselines/reference/computedPropertyNames23.errors.txt rename to tests/baselines/reference/computedPropertyNames23_ES5.errors.txt index 0846ba4d6c6..ba827b91375 100644 --- a/tests/baselines/reference/computedPropertyNames23.errors.txt +++ b/tests/baselines/reference/computedPropertyNames23_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts(6,12): error TS2465: 'this' cannot be referenced in a computed property name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts(6,12): error TS2465: 'this' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts (1 errors) ==== class C { bar() { return 0; diff --git a/tests/baselines/reference/computedPropertyNames23_ES5.js b/tests/baselines/reference/computedPropertyNames23_ES5.js new file mode 100644 index 00000000000..7b5a5a101a5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames23_ES5.js @@ -0,0 +1,23 @@ +//// [computedPropertyNames23_ES5.ts] +class C { + bar() { + return 0; + } + [ + { [this.bar()]: 1 }[0] + ]() { } +} + +//// [computedPropertyNames23_ES5.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + return 0; + }; + C.prototype[(_a = {}, _a[this.bar()] = + 1, + _a)[0]] = function () { }; + return C; +})(); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames23_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames23_ES6.errors.txt new file mode 100644 index 00000000000..0af5504f22a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames23_ES6.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES6.ts(6,12): error TS2465: 'this' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES6.ts (1 errors) ==== + class C { + bar() { + return 0; + } + [ + { [this.bar()]: 1 }[0] + ~~~~ +!!! error TS2465: 'this' cannot be referenced in a computed property name. + ]() { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames23.js b/tests/baselines/reference/computedPropertyNames23_ES6.js similarity index 76% rename from tests/baselines/reference/computedPropertyNames23.js rename to tests/baselines/reference/computedPropertyNames23_ES6.js index bd94501b577..ad3e35dbb25 100644 --- a/tests/baselines/reference/computedPropertyNames23.js +++ b/tests/baselines/reference/computedPropertyNames23_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames23.ts] +//// [computedPropertyNames23_ES6.ts] class C { bar() { return 0; @@ -8,7 +8,7 @@ class C { ]() { } } -//// [computedPropertyNames23.js] +//// [computedPropertyNames23_ES6.js] var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames24.errors.txt b/tests/baselines/reference/computedPropertyNames24_ES5.errors.txt similarity index 77% rename from tests/baselines/reference/computedPropertyNames24.errors.txt rename to tests/baselines/reference/computedPropertyNames24_ES5.errors.txt index 938fb64b82e..a1290e06956 100644 --- a/tests/baselines/reference/computedPropertyNames24.errors.txt +++ b/tests/baselines/reference/computedPropertyNames24_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts(9,6): error TS2466: 'super' cannot be referenced in a computed property name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts(9,6): error TS2466: 'super' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts (1 errors) ==== class Base { bar() { return 0; diff --git a/tests/baselines/reference/computedPropertyNames24.js b/tests/baselines/reference/computedPropertyNames24_ES5.js similarity index 89% rename from tests/baselines/reference/computedPropertyNames24.js rename to tests/baselines/reference/computedPropertyNames24_ES5.js index 389743497a9..5b9fcbca992 100644 --- a/tests/baselines/reference/computedPropertyNames24.js +++ b/tests/baselines/reference/computedPropertyNames24_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames24.ts] +//// [computedPropertyNames24_ES5.ts] class Base { bar() { return 0; @@ -10,7 +10,7 @@ class C extends Base { [super.bar()]() { } } -//// [computedPropertyNames24.js] +//// [computedPropertyNames24_ES5.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames24_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames24_ES6.errors.txt new file mode 100644 index 00000000000..cab0ba6a85c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames24_ES6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES6.ts(9,6): error TS2466: 'super' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES6.ts (1 errors) ==== + class Base { + bar() { + return 0; + } + } + class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [super.bar()]() { } + ~~~~~ +!!! error TS2466: 'super' cannot be referenced in a computed property name. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames24_ES6.js b/tests/baselines/reference/computedPropertyNames24_ES6.js new file mode 100644 index 00000000000..58eb07cfb8d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames24_ES6.js @@ -0,0 +1,37 @@ +//// [computedPropertyNames24_ES6.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [super.bar()]() { } +} + +//// [computedPropertyNames24_ES6.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + C.prototype[super.bar.call(this)] = function () { }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js new file mode 100644 index 00000000000..bd2212b72b3 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -0,0 +1,43 @@ +//// [computedPropertyNames25_ES5.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + foo() { + var obj = { + [super.bar()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames25_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + C.prototype.foo = function () { + var obj = (_a = {}, _a[_super.prototype.bar.call(this)] = function () { }, + _a); + return 0; + var _a; + }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames25.types b/tests/baselines/reference/computedPropertyNames25_ES5.types similarity index 89% rename from tests/baselines/reference/computedPropertyNames25.types rename to tests/baselines/reference/computedPropertyNames25_ES5.types index d8567dc86ad..6f34ce35b44 100644 --- a/tests/baselines/reference/computedPropertyNames25.types +++ b/tests/baselines/reference/computedPropertyNames25_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames25.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts === class Base { >Base : Base diff --git a/tests/baselines/reference/computedPropertyNames25.js b/tests/baselines/reference/computedPropertyNames25_ES6.js similarity index 88% rename from tests/baselines/reference/computedPropertyNames25.js rename to tests/baselines/reference/computedPropertyNames25_ES6.js index 8252fdce7f2..020582c9497 100644 --- a/tests/baselines/reference/computedPropertyNames25.js +++ b/tests/baselines/reference/computedPropertyNames25_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames25.ts] +//// [computedPropertyNames25_ES6.ts] class Base { bar() { return 0; @@ -13,7 +13,7 @@ class C extends Base { } } -//// [computedPropertyNames25.js] +//// [computedPropertyNames25_ES6.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames25_ES6.types b/tests/baselines/reference/computedPropertyNames25_ES6.types new file mode 100644 index 00000000000..c008a6173cf --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames25_ES6.types @@ -0,0 +1,31 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES6.ts === +class Base { +>Base : Base + + bar() { +>bar : () => number + + return 0; + } +} +class C extends Base { +>C : C +>Base : Base + + foo() { +>foo : () => number + + var obj = { +>obj : {} +>{ [super.bar()]() { } } : {} + + [super.bar()]() { } +>super.bar() : number +>super.bar : () => number +>super : Base +>bar : () => number + + }; + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames26.errors.txt b/tests/baselines/reference/computedPropertyNames26_ES5.errors.txt similarity index 78% rename from tests/baselines/reference/computedPropertyNames26.errors.txt rename to tests/baselines/reference/computedPropertyNames26_ES5.errors.txt index bbe51c6a0c8..77408f0a9f8 100644 --- a/tests/baselines/reference/computedPropertyNames26.errors.txt +++ b/tests/baselines/reference/computedPropertyNames26_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts(10,12): error TS2466: 'super' cannot be referenced in a computed property name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts(10,12): error TS2466: 'super' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts (1 errors) ==== class Base { bar() { return 0; diff --git a/tests/baselines/reference/computedPropertyNames26_ES5.js b/tests/baselines/reference/computedPropertyNames26_ES5.js new file mode 100644 index 00000000000..5df2f6dc1b6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames26_ES5.js @@ -0,0 +1,42 @@ +//// [computedPropertyNames26_ES5.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [ + { [super.bar()]: 1 }[0] + ]() { } +} + +//// [computedPropertyNames26_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + C.prototype[(_a = {}, _a[super.bar.call(this)] = + 1, + _a)[0]] = function () { }; + return C; +})(Base); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames26_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames26_ES6.errors.txt new file mode 100644 index 00000000000..d7e2b5ce7c5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames26_ES6.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES6.ts(10,12): error TS2466: 'super' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES6.ts (1 errors) ==== + class Base { + bar() { + return 0; + } + } + class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [ + { [super.bar()]: 1 }[0] + ~~~~~ +!!! error TS2466: 'super' cannot be referenced in a computed property name. + ]() { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames26.js b/tests/baselines/reference/computedPropertyNames26_ES6.js similarity index 90% rename from tests/baselines/reference/computedPropertyNames26.js rename to tests/baselines/reference/computedPropertyNames26_ES6.js index c19137ce32b..dadc6a29e80 100644 --- a/tests/baselines/reference/computedPropertyNames26.js +++ b/tests/baselines/reference/computedPropertyNames26_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames26.ts] +//// [computedPropertyNames26_ES6.ts] class Base { bar() { return 0; @@ -12,7 +12,7 @@ class C extends Base { ]() { } } -//// [computedPropertyNames26.js] +//// [computedPropertyNames26_ES6.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames27.errors.txt b/tests/baselines/reference/computedPropertyNames27_ES5.errors.txt similarity index 69% rename from tests/baselines/reference/computedPropertyNames27.errors.txt rename to tests/baselines/reference/computedPropertyNames27_ES5.errors.txt index c2872197363..1fbc7b37543 100644 --- a/tests/baselines/reference/computedPropertyNames27.errors.txt +++ b/tests/baselines/reference/computedPropertyNames27_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts(4,7): error TS2466: 'super' cannot be referenced in a computed property name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts(4,7): error TS2466: 'super' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts (1 errors) ==== class Base { } class C extends Base { diff --git a/tests/baselines/reference/computedPropertyNames27.js b/tests/baselines/reference/computedPropertyNames27_ES5.js similarity index 85% rename from tests/baselines/reference/computedPropertyNames27.js rename to tests/baselines/reference/computedPropertyNames27_ES5.js index 1cae552689b..df1fed09724 100644 --- a/tests/baselines/reference/computedPropertyNames27.js +++ b/tests/baselines/reference/computedPropertyNames27_ES5.js @@ -1,11 +1,11 @@ -//// [computedPropertyNames27.ts] +//// [computedPropertyNames27_ES5.ts] class Base { } class C extends Base { [(super(), "prop")]() { } } -//// [computedPropertyNames27.js] +//// [computedPropertyNames27_ES5.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames27_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames27_ES6.errors.txt new file mode 100644 index 00000000000..edf84201647 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames27_ES6.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES6.ts(4,7): error TS2466: 'super' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES6.ts (1 errors) ==== + class Base { + } + class C extends Base { + [(super(), "prop")]() { } + ~~~~~ +!!! error TS2466: 'super' cannot be referenced in a computed property name. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames27_ES6.js b/tests/baselines/reference/computedPropertyNames27_ES6.js new file mode 100644 index 00000000000..a78f13cda20 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames27_ES6.js @@ -0,0 +1,27 @@ +//// [computedPropertyNames27_ES6.ts] +class Base { +} +class C extends Base { + [(super(), "prop")]() { } +} + +//// [computedPropertyNames27_ES6.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + C.prototype[(_super.call(this), "prop")] = function () { }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.js b/tests/baselines/reference/computedPropertyNames28_ES5.js new file mode 100644 index 00000000000..7e548d4d6d3 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames28_ES5.js @@ -0,0 +1,34 @@ +//// [computedPropertyNames28_ES5.ts] +class Base { +} +class C extends Base { + constructor() { + super(); + var obj = { + [(super(), "prop")]() { } + }; + } +} + +//// [computedPropertyNames28_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.call(this); + var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { }, + _a); + var _a; + } + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames28.types b/tests/baselines/reference/computedPropertyNames28_ES5.types similarity index 90% rename from tests/baselines/reference/computedPropertyNames28.types rename to tests/baselines/reference/computedPropertyNames28_ES5.types index 2adf52f8c5f..278576ab1ca 100644 --- a/tests/baselines/reference/computedPropertyNames28.types +++ b/tests/baselines/reference/computedPropertyNames28_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames28.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts === class Base { >Base : Base } diff --git a/tests/baselines/reference/computedPropertyNames28.js b/tests/baselines/reference/computedPropertyNames28_ES6.js similarity index 86% rename from tests/baselines/reference/computedPropertyNames28.js rename to tests/baselines/reference/computedPropertyNames28_ES6.js index 0a3985a640c..5656d96de87 100644 --- a/tests/baselines/reference/computedPropertyNames28.js +++ b/tests/baselines/reference/computedPropertyNames28_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames28.ts] +//// [computedPropertyNames28_ES6.ts] class Base { } class C extends Base { @@ -10,7 +10,7 @@ class C extends Base { } } -//// [computedPropertyNames28.js] +//// [computedPropertyNames28_ES6.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames28_ES6.types b/tests/baselines/reference/computedPropertyNames28_ES6.types new file mode 100644 index 00000000000..842cdbd32e0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames28_ES6.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES6.ts === +class Base { +>Base : Base +} +class C extends Base { +>C : C +>Base : Base + + constructor() { + super(); +>super() : void +>super : typeof Base + + var obj = { +>obj : {} +>{ [(super(), "prop")]() { } } : {} + + [(super(), "prop")]() { } +>(super(), "prop") : string +>super(), "prop" : string +>super() : void +>super : typeof Base + + }; + } +} diff --git a/tests/baselines/reference/computedPropertyNames29_ES5.js b/tests/baselines/reference/computedPropertyNames29_ES5.js new file mode 100644 index 00000000000..27c7cd97988 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames29_ES5.js @@ -0,0 +1,27 @@ +//// [computedPropertyNames29_ES5.ts] +class C { + bar() { + () => { + var obj = { + [this.bar()]() { } // needs capture + }; + } + return 0; + } +} + +//// [computedPropertyNames29_ES5.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + var _this = this; + (function () { + var obj = (_a = {}, _a[_this.bar()] = function () { }, + _a); + var _a; + }); + return 0; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames29.types b/tests/baselines/reference/computedPropertyNames29_ES5.types similarity index 91% rename from tests/baselines/reference/computedPropertyNames29.types rename to tests/baselines/reference/computedPropertyNames29_ES5.types index ed4db5862e9..e0da4b10da8 100644 --- a/tests/baselines/reference/computedPropertyNames29.types +++ b/tests/baselines/reference/computedPropertyNames29_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames29.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts === class C { >C : C diff --git a/tests/baselines/reference/computedPropertyNames29.js b/tests/baselines/reference/computedPropertyNames29_ES6.js similarity index 81% rename from tests/baselines/reference/computedPropertyNames29.js rename to tests/baselines/reference/computedPropertyNames29_ES6.js index 50d050d888e..d01b6fd3b7f 100644 --- a/tests/baselines/reference/computedPropertyNames29.js +++ b/tests/baselines/reference/computedPropertyNames29_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames29.ts] +//// [computedPropertyNames29_ES6.ts] class C { bar() { () => { @@ -10,7 +10,7 @@ class C { } } -//// [computedPropertyNames29.js] +//// [computedPropertyNames29_ES6.js] var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames29_ES6.types b/tests/baselines/reference/computedPropertyNames29_ES6.types new file mode 100644 index 00000000000..d520418749e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames29_ES6.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES6.ts === +class C { +>C : C + + bar() { +>bar : () => number + + () => { +>() => { var obj = { [this.bar()]() { } // needs capture }; } : () => void + + var obj = { +>obj : {} +>{ [this.bar()]() { } // needs capture } : {} + + [this.bar()]() { } // needs capture +>this.bar() : number +>this.bar : () => number +>this : C +>bar : () => number + + }; + } + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames2.errors.txt b/tests/baselines/reference/computedPropertyNames2_ES5.errors.txt similarity index 72% rename from tests/baselines/reference/computedPropertyNames2.errors.txt rename to tests/baselines/reference/computedPropertyNames2_ES5.errors.txt index d0fd1de4576..2fbf68b4437 100644 --- a/tests/baselines/reference/computedPropertyNames2.errors.txt +++ b/tests/baselines/reference/computedPropertyNames2_ES5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts (2 errors) ==== var methodName = "method"; var accessorName = "accessor"; class C { diff --git a/tests/baselines/reference/computedPropertyNames2.js b/tests/baselines/reference/computedPropertyNames2_ES5.js similarity index 90% rename from tests/baselines/reference/computedPropertyNames2.js rename to tests/baselines/reference/computedPropertyNames2_ES5.js index 737ec08c207..581b581d87b 100644 --- a/tests/baselines/reference/computedPropertyNames2.js +++ b/tests/baselines/reference/computedPropertyNames2_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames2.ts] +//// [computedPropertyNames2_ES5.ts] var methodName = "method"; var accessorName = "accessor"; class C { @@ -10,7 +10,7 @@ class C { static set [accessorName](v) { } } -//// [computedPropertyNames2.js] +//// [computedPropertyNames2_ES5.js] var methodName = "method"; var accessorName = "accessor"; var C = (function () { diff --git a/tests/baselines/reference/computedPropertyNames2_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames2_ES6.errors.txt new file mode 100644 index 00000000000..3f18a8764b4 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames2_ES6.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts (2 errors) ==== + var methodName = "method"; + var accessorName = "accessor"; + class C { + [methodName]() { } + static [methodName]() { } + get [accessorName]() { } + ~~~~~~~~~~~~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + set [accessorName](v) { } + static get [accessorName]() { } + ~~~~~~~~~~~~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + static set [accessorName](v) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames2_ES6.js b/tests/baselines/reference/computedPropertyNames2_ES6.js new file mode 100644 index 00000000000..b58b1a6f077 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames2_ES6.js @@ -0,0 +1,42 @@ +//// [computedPropertyNames2_ES6.ts] +var methodName = "method"; +var accessorName = "accessor"; +class C { + [methodName]() { } + static [methodName]() { } + get [accessorName]() { } + set [accessorName](v) { } + static get [accessorName]() { } + static set [accessorName](v) { } +} + +//// [computedPropertyNames2_ES6.js] +var methodName = "method"; +var accessorName = "accessor"; +var C = (function () { + function C() { + } + C.prototype[methodName] = function () { }; + C[methodName] = function () { }; + Object.defineProperty(C.prototype, accessorName, { + get: function () { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, accessorName, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, accessorName, { + get: function () { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, accessorName, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames30.errors.txt b/tests/baselines/reference/computedPropertyNames30_ES5.errors.txt similarity index 79% rename from tests/baselines/reference/computedPropertyNames30.errors.txt rename to tests/baselines/reference/computedPropertyNames30_ES5.errors.txt index f7b6411f867..1dfb605db33 100644 --- a/tests/baselines/reference/computedPropertyNames30.errors.txt +++ b/tests/baselines/reference/computedPropertyNames30_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts(11,19): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts(11,19): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts (1 errors) ==== class Base { } class C extends Base { diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.js b/tests/baselines/reference/computedPropertyNames30_ES5.js new file mode 100644 index 00000000000..505b149f62d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames30_ES5.js @@ -0,0 +1,41 @@ +//// [computedPropertyNames30_ES5.ts] +class Base { +} +class C extends Base { + constructor() { + super(); + () => { + var obj = { + // Ideally, we would capture this. But the reference is + // illegal, and not capturing this is consistent with + //treatment of other similar violations. + [(super(), "prop")]() { } + }; + } + } +} + +//// [computedPropertyNames30_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.call(this); + (function () { + var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { }, + _a); + var _a; + }); + } + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames30_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames30_ES6.errors.txt new file mode 100644 index 00000000000..dc8892fd326 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames30_ES6.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES6.ts(11,19): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES6.ts (1 errors) ==== + class Base { + } + class C extends Base { + constructor() { + super(); + () => { + var obj = { + // Ideally, we would capture this. But the reference is + // illegal, and not capturing this is consistent with + //treatment of other similar violations. + [(super(), "prop")]() { } + ~~~~~ +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors + }; + } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames30.js b/tests/baselines/reference/computedPropertyNames30_ES6.js similarity index 91% rename from tests/baselines/reference/computedPropertyNames30.js rename to tests/baselines/reference/computedPropertyNames30_ES6.js index ae2b24385f4..0c4f259fe48 100644 --- a/tests/baselines/reference/computedPropertyNames30.js +++ b/tests/baselines/reference/computedPropertyNames30_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames30.ts] +//// [computedPropertyNames30_ES6.ts] class Base { } class C extends Base { @@ -15,7 +15,7 @@ class C extends Base { } } -//// [computedPropertyNames30.js] +//// [computedPropertyNames30_ES6.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.js b/tests/baselines/reference/computedPropertyNames31_ES5.js new file mode 100644 index 00000000000..0c8cbac455f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -0,0 +1,48 @@ +//// [computedPropertyNames31_ES5.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + foo() { + () => { + var obj = { + [super.bar()]() { } // needs capture + }; + } + return 0; + } +} + +//// [computedPropertyNames31_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + C.prototype.foo = function () { + var _this = this; + (function () { + var obj = (_a = {}, _a[_super.prototype.bar.call(_this)] = function () { }, + _a); + var _a; + }); + return 0; + }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames31.types b/tests/baselines/reference/computedPropertyNames31_ES5.types similarity index 92% rename from tests/baselines/reference/computedPropertyNames31.types rename to tests/baselines/reference/computedPropertyNames31_ES5.types index 90e73bc3dcb..eb14b223ed3 100644 --- a/tests/baselines/reference/computedPropertyNames31.types +++ b/tests/baselines/reference/computedPropertyNames31_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames31.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts === class Base { >Base : Base diff --git a/tests/baselines/reference/computedPropertyNames31.js b/tests/baselines/reference/computedPropertyNames31_ES6.js similarity index 89% rename from tests/baselines/reference/computedPropertyNames31.js rename to tests/baselines/reference/computedPropertyNames31_ES6.js index 227f10e3bd4..0f7d72818fe 100644 --- a/tests/baselines/reference/computedPropertyNames31.js +++ b/tests/baselines/reference/computedPropertyNames31_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames31.ts] +//// [computedPropertyNames31_ES6.ts] class Base { bar() { return 0; @@ -15,7 +15,7 @@ class C extends Base { } } -//// [computedPropertyNames31.js] +//// [computedPropertyNames31_ES6.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames31_ES6.types b/tests/baselines/reference/computedPropertyNames31_ES6.types new file mode 100644 index 00000000000..9d835a1fac1 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames31_ES6.types @@ -0,0 +1,35 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES6.ts === +class Base { +>Base : Base + + bar() { +>bar : () => number + + return 0; + } +} +class C extends Base { +>C : C +>Base : Base + + foo() { +>foo : () => number + + () => { +>() => { var obj = { [super.bar()]() { } // needs capture }; } : () => void + + var obj = { +>obj : {} +>{ [super.bar()]() { } // needs capture } : {} + + [super.bar()]() { } // needs capture +>super.bar() : number +>super.bar : () => number +>super : Base +>bar : () => number + + }; + } + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames32.errors.txt b/tests/baselines/reference/computedPropertyNames32_ES5.errors.txt similarity index 57% rename from tests/baselines/reference/computedPropertyNames32.errors.txt rename to tests/baselines/reference/computedPropertyNames32_ES5.errors.txt index e2f08c79fc9..8305a2c0758 100644 --- a/tests/baselines/reference/computedPropertyNames32.errors.txt +++ b/tests/baselines/reference/computedPropertyNames32_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts(6,10): error TS2466: A computed property name cannot reference a type parameter from its containing type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts(6,10): error TS2467: A computed property name cannot reference a type parameter from its containing type. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts (1 errors) ==== function foo() { return '' } class C { bar() { @@ -9,5 +9,5 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts(6,10): } [foo()]() { } ~ -!!! error TS2466: A computed property name cannot reference a type parameter from its containing type. +!!! error TS2467: A computed property name cannot reference a type parameter from its containing type. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames32.js b/tests/baselines/reference/computedPropertyNames32_ES5.js similarity index 69% rename from tests/baselines/reference/computedPropertyNames32.js rename to tests/baselines/reference/computedPropertyNames32_ES5.js index 9bc723581ef..a0d8b066b5c 100644 --- a/tests/baselines/reference/computedPropertyNames32.js +++ b/tests/baselines/reference/computedPropertyNames32_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames32.ts] +//// [computedPropertyNames32_ES5.ts] function foo() { return '' } class C { bar() { @@ -7,10 +7,8 @@ class C { [foo()]() { } } -//// [computedPropertyNames32.js] -function foo() { - return ''; -} +//// [computedPropertyNames32_ES5.js] +function foo() { return ''; } var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames32_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames32_ES6.errors.txt new file mode 100644 index 00000000000..36763fa6405 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames32_ES6.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES6.ts(6,10): error TS2467: A computed property name cannot reference a type parameter from its containing type. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES6.ts (1 errors) ==== + function foo() { return '' } + class C { + bar() { + return 0; + } + [foo()]() { } + ~ +!!! error TS2467: A computed property name cannot reference a type parameter from its containing type. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames32_ES6.js b/tests/baselines/reference/computedPropertyNames32_ES6.js new file mode 100644 index 00000000000..69d2a40edce --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames32_ES6.js @@ -0,0 +1,20 @@ +//// [computedPropertyNames32_ES6.ts] +function foo() { return '' } +class C { + bar() { + return 0; + } + [foo()]() { } +} + +//// [computedPropertyNames32_ES6.js] +function foo() { return ''; } +var C = (function () { + function C() { + } + C.prototype.bar = function () { + return 0; + }; + C.prototype[foo()] = function () { }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames33_ES5.js b/tests/baselines/reference/computedPropertyNames33_ES5.js new file mode 100644 index 00000000000..84df68fcc10 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames33_ES5.js @@ -0,0 +1,24 @@ +//// [computedPropertyNames33_ES5.ts] +function foo() { return '' } +class C { + bar() { + var obj = { + [foo()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames33_ES5.js] +function foo() { return ''; } +var C = (function () { + function C() { + } + C.prototype.bar = function () { + var obj = (_a = {}, _a[foo()] = function () { }, + _a); + return 0; + var _a; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames33.types b/tests/baselines/reference/computedPropertyNames33_ES5.types similarity index 89% rename from tests/baselines/reference/computedPropertyNames33.types rename to tests/baselines/reference/computedPropertyNames33_ES5.types index 8cbe8e93ef2..a0d99ec8615 100644 --- a/tests/baselines/reference/computedPropertyNames33.types +++ b/tests/baselines/reference/computedPropertyNames33_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames33.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts === function foo() { return '' } >foo : () => string >T : T diff --git a/tests/baselines/reference/computedPropertyNames33.js b/tests/baselines/reference/computedPropertyNames33_ES6.js similarity index 73% rename from tests/baselines/reference/computedPropertyNames33.js rename to tests/baselines/reference/computedPropertyNames33_ES6.js index 43ceeb2b2fb..768af6fd403 100644 --- a/tests/baselines/reference/computedPropertyNames33.js +++ b/tests/baselines/reference/computedPropertyNames33_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames33.ts] +//// [computedPropertyNames33_ES6.ts] function foo() { return '' } class C { bar() { @@ -9,10 +9,8 @@ class C { } } -//// [computedPropertyNames33.js] -function foo() { - return ''; -} +//// [computedPropertyNames33_ES6.js] +function foo() { return ''; } var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames33_ES6.types b/tests/baselines/reference/computedPropertyNames33_ES6.types new file mode 100644 index 00000000000..331bd2b3e09 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames33_ES6.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES6.ts === +function foo() { return '' } +>foo : () => string +>T : T + +class C { +>C : C +>T : T + + bar() { +>bar : () => number + + var obj = { +>obj : {} +>{ [foo()]() { } } : {} + + [foo()]() { } +>foo() : string +>foo : () => string +>T : T + + }; + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames34.errors.txt b/tests/baselines/reference/computedPropertyNames34_ES5.errors.txt similarity index 74% rename from tests/baselines/reference/computedPropertyNames34.errors.txt rename to tests/baselines/reference/computedPropertyNames34_ES5.errors.txt index c6d4a9aa4eb..30fa6642cbc 100644 --- a/tests/baselines/reference/computedPropertyNames34.errors.txt +++ b/tests/baselines/reference/computedPropertyNames34_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts(5,18): error TS2302: Static members cannot reference class type parameters. +tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts(5,18): error TS2302: Static members cannot reference class type parameters. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts (1 errors) ==== function foo() { return '' } class C { static bar() { diff --git a/tests/baselines/reference/computedPropertyNames34_ES5.js b/tests/baselines/reference/computedPropertyNames34_ES5.js new file mode 100644 index 00000000000..9e1de33be7c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames34_ES5.js @@ -0,0 +1,24 @@ +//// [computedPropertyNames34_ES5.ts] +function foo() { return '' } +class C { + static bar() { + var obj = { + [foo()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames34_ES5.js] +function foo() { return ''; } +var C = (function () { + function C() { + } + C.bar = function () { + var obj = (_a = {}, _a[foo()] = function () { }, + _a); + return 0; + var _a; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames34_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames34_ES6.errors.txt new file mode 100644 index 00000000000..b7f3e37b124 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames34_ES6.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES6.ts(5,18): error TS2302: Static members cannot reference class type parameters. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES6.ts (1 errors) ==== + function foo() { return '' } + class C { + static bar() { + var obj = { + [foo()]() { } + ~ +!!! error TS2302: Static members cannot reference class type parameters. + }; + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames34.js b/tests/baselines/reference/computedPropertyNames34_ES6.js similarity index 72% rename from tests/baselines/reference/computedPropertyNames34.js rename to tests/baselines/reference/computedPropertyNames34_ES6.js index 12892eefe4f..09cccb0e7f4 100644 --- a/tests/baselines/reference/computedPropertyNames34.js +++ b/tests/baselines/reference/computedPropertyNames34_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames34.ts] +//// [computedPropertyNames34_ES6.ts] function foo() { return '' } class C { static bar() { @@ -9,10 +9,8 @@ class C { } } -//// [computedPropertyNames34.js] -function foo() { - return ''; -} +//// [computedPropertyNames34_ES6.js] +function foo() { return ''; } var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames35.errors.txt b/tests/baselines/reference/computedPropertyNames35.errors.txt deleted file mode 100644 index 01c4614e84a..00000000000 --- a/tests/baselines/reference/computedPropertyNames35.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,5): error TS1169: Computed property names are not allowed in interfaces. -tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,10): error TS2466: A computed property name cannot reference a type parameter from its containing type. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts (2 errors) ==== - function foo() { return '' } - interface I { - bar(): string; - [foo()](): void; - ~~~~~~~~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. - ~ -!!! error TS2466: A computed property name cannot reference a type parameter from its containing type. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames35.js b/tests/baselines/reference/computedPropertyNames35.js deleted file mode 100644 index 5a731fd8bda..00000000000 --- a/tests/baselines/reference/computedPropertyNames35.js +++ /dev/null @@ -1,11 +0,0 @@ -//// [computedPropertyNames35.ts] -function foo() { return '' } -interface I { - bar(): string; - [foo()](): void; -} - -//// [computedPropertyNames35.js] -function foo() { - return ''; -} diff --git a/tests/baselines/reference/computedPropertyNames35_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames35_ES5.errors.txt new file mode 100644 index 00000000000..aaf56487028 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames35_ES5.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts(4,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts(4,10): error TS2467: A computed property name cannot reference a type parameter from its containing type. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts (2 errors) ==== + function foo() { return '' } + interface I { + bar(): string; + [foo()](): void; + ~~~~~~~~~~ +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. + ~ +!!! error TS2467: A computed property name cannot reference a type parameter from its containing type. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames35_ES5.js b/tests/baselines/reference/computedPropertyNames35_ES5.js new file mode 100644 index 00000000000..0804c946f1f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames35_ES5.js @@ -0,0 +1,9 @@ +//// [computedPropertyNames35_ES5.ts] +function foo() { return '' } +interface I { + bar(): string; + [foo()](): void; +} + +//// [computedPropertyNames35_ES5.js] +function foo() { return ''; } diff --git a/tests/baselines/reference/computedPropertyNames35_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames35_ES6.errors.txt new file mode 100644 index 00000000000..c8ef5efac31 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames35_ES6.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.ts(4,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.ts(4,10): error TS2467: A computed property name cannot reference a type parameter from its containing type. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.ts (2 errors) ==== + function foo() { return '' } + interface I { + bar(): string; + [foo()](): void; + ~~~~~~~~~~ +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. + ~ +!!! error TS2467: A computed property name cannot reference a type parameter from its containing type. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames35_ES6.js b/tests/baselines/reference/computedPropertyNames35_ES6.js new file mode 100644 index 00000000000..2d3f4088315 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames35_ES6.js @@ -0,0 +1,9 @@ +//// [computedPropertyNames35_ES6.ts] +function foo() { return '' } +interface I { + bar(): string; + [foo()](): void; +} + +//// [computedPropertyNames35_ES6.js] +function foo() { return ''; } diff --git a/tests/baselines/reference/computedPropertyNames36.errors.txt b/tests/baselines/reference/computedPropertyNames36_ES5.errors.txt similarity index 74% rename from tests/baselines/reference/computedPropertyNames36.errors.txt rename to tests/baselines/reference/computedPropertyNames36_ES5.errors.txt index a473ebfba8e..6c38043c8e0 100644 --- a/tests/baselines/reference/computedPropertyNames36.errors.txt +++ b/tests/baselines/reference/computedPropertyNames36_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames36.ts(8,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts(8,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames36.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames36.js b/tests/baselines/reference/computedPropertyNames36_ES5.js similarity index 80% rename from tests/baselines/reference/computedPropertyNames36.js rename to tests/baselines/reference/computedPropertyNames36_ES5.js index 5df5c503911..5519a6d284c 100644 --- a/tests/baselines/reference/computedPropertyNames36.js +++ b/tests/baselines/reference/computedPropertyNames36_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames36.ts] +//// [computedPropertyNames36_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -10,7 +10,7 @@ class C { set ["set1"](p: Foo2) { } } -//// [computedPropertyNames36.js] +//// [computedPropertyNames36_ES5.js] var Foo = (function () { function Foo() { } @@ -26,9 +26,7 @@ var C = (function () { } Object.defineProperty(C.prototype, "get1", { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames36_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames36_ES6.errors.txt new file mode 100644 index 00000000000..8127898fde4 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames36_ES6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts(8,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + set ["set1"](p: Foo2) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames36_ES6.js b/tests/baselines/reference/computedPropertyNames36_ES6.js new file mode 100644 index 00000000000..09bab9a2630 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames36_ES6.js @@ -0,0 +1,39 @@ +//// [computedPropertyNames36_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} + +//// [computedPropertyNames36_ES6.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + 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 + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames37.js b/tests/baselines/reference/computedPropertyNames37_ES5.js similarity index 80% rename from tests/baselines/reference/computedPropertyNames37.js rename to tests/baselines/reference/computedPropertyNames37_ES5.js index 540dfa27e1e..54a7243f3fa 100644 --- a/tests/baselines/reference/computedPropertyNames37.js +++ b/tests/baselines/reference/computedPropertyNames37_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames37.ts] +//// [computedPropertyNames37_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -10,7 +10,7 @@ class C { set ["set1"](p: Foo2) { } } -//// [computedPropertyNames37.js] +//// [computedPropertyNames37_ES5.js] var Foo = (function () { function Foo() { } @@ -26,9 +26,7 @@ var C = (function () { } Object.defineProperty(C.prototype, "get1", { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames37.types b/tests/baselines/reference/computedPropertyNames37_ES5.types similarity index 88% rename from tests/baselines/reference/computedPropertyNames37.types rename to tests/baselines/reference/computedPropertyNames37_ES5.types index b50e0590b79..a12324003bf 100644 --- a/tests/baselines/reference/computedPropertyNames37.types +++ b/tests/baselines/reference/computedPropertyNames37_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames37.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts === class Foo { x } >Foo : Foo >x : any diff --git a/tests/baselines/reference/computedPropertyNames37_ES6.js b/tests/baselines/reference/computedPropertyNames37_ES6.js new file mode 100644 index 00000000000..c824f15ef54 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames37_ES6.js @@ -0,0 +1,39 @@ +//// [computedPropertyNames37_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: number]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} + +//// [computedPropertyNames37_ES6.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + 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 + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames37_ES6.types b/tests/baselines/reference/computedPropertyNames37_ES6.types new file mode 100644 index 00000000000..288685f0e02 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames37_ES6.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES6.ts === +class Foo { x } +>Foo : Foo +>x : any + +class Foo2 { x; y } +>Foo2 : Foo2 +>x : any +>y : any + +class C { +>C : C + + [s: number]: Foo2; +>s : number +>Foo2 : Foo2 + + // Computed properties + get ["get1"]() { return new Foo } +>new Foo : Foo +>Foo : typeof Foo + + set ["set1"](p: Foo2) { } +>p : Foo2 +>Foo2 : Foo2 +} diff --git a/tests/baselines/reference/computedPropertyNames38.errors.txt b/tests/baselines/reference/computedPropertyNames38_ES5.errors.txt similarity index 74% rename from tests/baselines/reference/computedPropertyNames38.errors.txt rename to tests/baselines/reference/computedPropertyNames38_ES5.errors.txt index fc5f31f1329..acc08ee5527 100644 --- a/tests/baselines/reference/computedPropertyNames38.errors.txt +++ b/tests/baselines/reference/computedPropertyNames38_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames38.ts(8,5): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts(8,5): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames38.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames38.js b/tests/baselines/reference/computedPropertyNames38_ES5.js similarity index 80% rename from tests/baselines/reference/computedPropertyNames38.js rename to tests/baselines/reference/computedPropertyNames38_ES5.js index fbbbe83ddc6..49af4d00d51 100644 --- a/tests/baselines/reference/computedPropertyNames38.js +++ b/tests/baselines/reference/computedPropertyNames38_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames38.ts] +//// [computedPropertyNames38_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -10,7 +10,7 @@ class C { set [1 << 6](p: Foo2) { } } -//// [computedPropertyNames38.js] +//// [computedPropertyNames38_ES5.js] var Foo = (function () { function Foo() { } @@ -26,9 +26,7 @@ var C = (function () { } Object.defineProperty(C.prototype, 1 << 6, { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames38_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames38_ES6.errors.txt new file mode 100644 index 00000000000..0a95b37f9a9 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames38_ES6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts(8,5): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. + set [1 << 6](p: Foo2) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames38_ES6.js b/tests/baselines/reference/computedPropertyNames38_ES6.js new file mode 100644 index 00000000000..9dde7da09de --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames38_ES6.js @@ -0,0 +1,39 @@ +//// [computedPropertyNames38_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + set [1 << 6](p: Foo2) { } +} + +//// [computedPropertyNames38_ES6.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, 1 << 6, { + // Computed properties + get: function () { return new Foo; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, 1 << 6, { + set: function (p) { }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames39.errors.txt b/tests/baselines/reference/computedPropertyNames39_ES5.errors.txt similarity index 74% rename from tests/baselines/reference/computedPropertyNames39.errors.txt rename to tests/baselines/reference/computedPropertyNames39_ES5.errors.txt index 573ef726241..669314676f9 100644 --- a/tests/baselines/reference/computedPropertyNames39.errors.txt +++ b/tests/baselines/reference/computedPropertyNames39_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames39.ts(8,5): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts(8,5): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames39.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames39.js b/tests/baselines/reference/computedPropertyNames39_ES5.js similarity index 80% rename from tests/baselines/reference/computedPropertyNames39.js rename to tests/baselines/reference/computedPropertyNames39_ES5.js index 1d367c8d856..1b8d3aab2ff 100644 --- a/tests/baselines/reference/computedPropertyNames39.js +++ b/tests/baselines/reference/computedPropertyNames39_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames39.ts] +//// [computedPropertyNames39_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -10,7 +10,7 @@ class C { set [1 << 6](p: Foo2) { } } -//// [computedPropertyNames39.js] +//// [computedPropertyNames39_ES5.js] var Foo = (function () { function Foo() { } @@ -26,9 +26,7 @@ var C = (function () { } Object.defineProperty(C.prototype, 1 << 6, { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames39_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames39_ES6.errors.txt new file mode 100644 index 00000000000..38f432162d5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames39_ES6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts(8,5): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: number]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. + set [1 << 6](p: Foo2) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames39_ES6.js b/tests/baselines/reference/computedPropertyNames39_ES6.js new file mode 100644 index 00000000000..d0d21f201bb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames39_ES6.js @@ -0,0 +1,39 @@ +//// [computedPropertyNames39_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: number]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + set [1 << 6](p: Foo2) { } +} + +//// [computedPropertyNames39_ES6.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, 1 << 6, { + // Computed properties + get: function () { return new Foo; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, 1 << 6, { + set: function (p) { }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames3.errors.txt b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt similarity index 59% rename from tests/baselines/reference/computedPropertyNames3.errors.txt rename to tests/baselines/reference/computedPropertyNames3_ES5.errors.txt index 080bff1ab9a..82e4b71b33b 100644 --- a/tests/baselines/reference/computedPropertyNames3.errors.txt +++ b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt @@ -1,30 +1,30 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts (6 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts (6 errors) ==== var id; class C { [0 + 1]() { } static [() => { }]() { } ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. get [delete id]() { } ~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. set [[0, 1]](v) { } ~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static get [""]() { } ~~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ~~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static set [id.toString()](v) { } } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames3_ES5.js b/tests/baselines/reference/computedPropertyNames3_ES5.js new file mode 100644 index 00000000000..f5a063f91e6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames3_ES5.js @@ -0,0 +1,40 @@ +//// [computedPropertyNames3_ES5.ts] +var id; +class C { + [0 + 1]() { } + static [() => { }]() { } + get [delete id]() { } + set [[0, 1]](v) { } + static get [""]() { } + static set [id.toString()](v) { } +} + +//// [computedPropertyNames3_ES5.js] +var id; +var C = (function () { + function C() { + } + C.prototype[0 + 1] = function () { }; + C[function () { }] = function () { }; + Object.defineProperty(C.prototype, delete id, { + get: function () { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, [0, 1], { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "", { + get: function () { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, id.toString(), { + set: function (v) { }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt new file mode 100644 index 00000000000..3df6d6d9744 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt @@ -0,0 +1,30 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts (6 errors) ==== + var id; + class C { + [0 + 1]() { } + static [() => { }]() { } + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + get [delete id]() { } + ~~~~~~~~~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + set [[0, 1]](v) { } + ~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + static get [""]() { } + ~~~~~~~~~~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + static set [id.toString()](v) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames3.js b/tests/baselines/reference/computedPropertyNames3_ES6.js similarity index 89% rename from tests/baselines/reference/computedPropertyNames3.js rename to tests/baselines/reference/computedPropertyNames3_ES6.js index 19f938e32ad..672d90d7b45 100644 --- a/tests/baselines/reference/computedPropertyNames3.js +++ b/tests/baselines/reference/computedPropertyNames3_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames3.ts] +//// [computedPropertyNames3_ES6.ts] var id; class C { [0 + 1]() { } @@ -9,7 +9,7 @@ class C { static set [id.toString()](v) { } } -//// [computedPropertyNames3.js] +//// [computedPropertyNames3_ES6.js] var id; var C = (function () { function C() { diff --git a/tests/baselines/reference/computedPropertyNames40.errors.txt b/tests/baselines/reference/computedPropertyNames40_ES5.errors.txt similarity index 73% rename from tests/baselines/reference/computedPropertyNames40.errors.txt rename to tests/baselines/reference/computedPropertyNames40_ES5.errors.txt index c5bda4ed999..e8ceef0d581 100644 --- a/tests/baselines/reference/computedPropertyNames40.errors.txt +++ b/tests/baselines/reference/computedPropertyNames40_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames40.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(8,5): error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames40.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames40.js b/tests/baselines/reference/computedPropertyNames40_ES5.js similarity index 64% rename from tests/baselines/reference/computedPropertyNames40.js rename to tests/baselines/reference/computedPropertyNames40_ES5.js index 1c9b5d3bfa8..e8063762026 100644 --- a/tests/baselines/reference/computedPropertyNames40.js +++ b/tests/baselines/reference/computedPropertyNames40_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames40.ts] +//// [computedPropertyNames40_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -10,7 +10,7 @@ class C { [""]() { return new Foo2 } } -//// [computedPropertyNames40.js] +//// [computedPropertyNames40_ES5.js] var Foo = (function () { function Foo() { } @@ -25,11 +25,7 @@ var C = (function () { function C() { } // Computed properties - C.prototype[""] = function () { - return new Foo; - }; - C.prototype[""] = function () { - return new Foo2; - }; + C.prototype[""] = function () { return new Foo; }; + C.prototype[""] = function () { return new Foo2; }; return C; })(); diff --git a/tests/baselines/reference/computedPropertyNames40_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames40_ES6.errors.txt new file mode 100644 index 00000000000..1a032a87b2b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames40_ES6.errors.txt @@ -0,0 +1,16 @@ +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 (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: () => Foo2; + + // Computed properties + [""]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. + [""]() { return new Foo2 } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames40_ES6.js b/tests/baselines/reference/computedPropertyNames40_ES6.js new file mode 100644 index 00000000000..208be7760a9 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames40_ES6.js @@ -0,0 +1,31 @@ +//// [computedPropertyNames40_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: () => Foo2; + + // Computed properties + [""]() { return new Foo } + [""]() { return new Foo2 } +} + +//// [computedPropertyNames40_ES6.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + // Computed properties + C.prototype[""] = function () { return new Foo; }; + C.prototype[""] = function () { return new Foo2; }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames41.js b/tests/baselines/reference/computedPropertyNames41_ES5.js similarity index 72% rename from tests/baselines/reference/computedPropertyNames41.js rename to tests/baselines/reference/computedPropertyNames41_ES5.js index 34fe2d33df7..7d7c390bf3e 100644 --- a/tests/baselines/reference/computedPropertyNames41.js +++ b/tests/baselines/reference/computedPropertyNames41_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames41.ts] +//// [computedPropertyNames41_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -9,7 +9,7 @@ class C { static [""]() { return new Foo } } -//// [computedPropertyNames41.js] +//// [computedPropertyNames41_ES5.js] var Foo = (function () { function Foo() { } @@ -24,8 +24,6 @@ var C = (function () { function C() { } // Computed properties - C[""] = function () { - return new Foo; - }; + C[""] = function () { return new Foo; }; return C; })(); diff --git a/tests/baselines/reference/computedPropertyNames41.types b/tests/baselines/reference/computedPropertyNames41_ES5.types similarity index 88% rename from tests/baselines/reference/computedPropertyNames41.types rename to tests/baselines/reference/computedPropertyNames41_ES5.types index 1fb0af282ca..aac087ee958 100644 --- a/tests/baselines/reference/computedPropertyNames41.types +++ b/tests/baselines/reference/computedPropertyNames41_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames41.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts === class Foo { x } >Foo : Foo >x : any diff --git a/tests/baselines/reference/computedPropertyNames41_ES6.js b/tests/baselines/reference/computedPropertyNames41_ES6.js new file mode 100644 index 00000000000..050079017c0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames41_ES6.js @@ -0,0 +1,29 @@ +//// [computedPropertyNames41_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: () => Foo2; + + // Computed properties + static [""]() { return new Foo } +} + +//// [computedPropertyNames41_ES6.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + // Computed properties + C[""] = function () { return new Foo; }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames41_ES6.types b/tests/baselines/reference/computedPropertyNames41_ES6.types new file mode 100644 index 00000000000..ffb3387d161 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames41_ES6.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES6.ts === +class Foo { x } +>Foo : Foo +>x : any + +class Foo2 { x; y } +>Foo2 : Foo2 +>x : any +>y : any + +class C { +>C : C + + [s: string]: () => Foo2; +>s : string +>Foo2 : Foo2 + + // Computed properties + static [""]() { return new Foo } +>new Foo : Foo +>Foo : typeof Foo +} diff --git a/tests/baselines/reference/computedPropertyNames42.errors.txt b/tests/baselines/reference/computedPropertyNames42_ES5.errors.txt similarity index 53% rename from tests/baselines/reference/computedPropertyNames42.errors.txt rename to tests/baselines/reference/computedPropertyNames42_ES5.errors.txt index 059b3117a43..94153c47aa5 100644 --- a/tests/baselines/reference/computedPropertyNames42.errors.txt +++ b/tests/baselines/reference/computedPropertyNames42_ES5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames42.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(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.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts (2 errors) ==== class Foo { x } class Foo2 { x; y } @@ -12,7 +12,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): // Computed properties [""]: Foo; ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! 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.js b/tests/baselines/reference/computedPropertyNames42_ES5.js similarity index 77% rename from tests/baselines/reference/computedPropertyNames42.js rename to tests/baselines/reference/computedPropertyNames42_ES5.js index c9f24a1c708..f4fda8fc829 100644 --- a/tests/baselines/reference/computedPropertyNames42.js +++ b/tests/baselines/reference/computedPropertyNames42_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames42.ts] +//// [computedPropertyNames42_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -9,7 +9,7 @@ class C { [""]: Foo; } -//// [computedPropertyNames42.js] +//// [computedPropertyNames42_ES5.js] var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/computedPropertyNames42_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames42_ES6.errors.txt new file mode 100644 index 00000000000..1f4e27d6e81 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames42_ES6.errors.txt @@ -0,0 +1,18 @@ +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) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + + // 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.js b/tests/baselines/reference/computedPropertyNames42_ES6.js new file mode 100644 index 00000000000..8538088f450 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames42_ES6.js @@ -0,0 +1,27 @@ +//// [computedPropertyNames42_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + [""]: Foo; +} + +//// [computedPropertyNames42_ES6.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames43.errors.txt b/tests/baselines/reference/computedPropertyNames43_ES5.errors.txt similarity index 75% rename from tests/baselines/reference/computedPropertyNames43.errors.txt rename to tests/baselines/reference/computedPropertyNames43_ES5.errors.txt index d38dcca9216..62c239a5a54 100644 --- a/tests/baselines/reference/computedPropertyNames43.errors.txt +++ b/tests/baselines/reference/computedPropertyNames43_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames43.ts(10,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts(10,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames43.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames43.js b/tests/baselines/reference/computedPropertyNames43_ES5.js similarity index 85% rename from tests/baselines/reference/computedPropertyNames43.js rename to tests/baselines/reference/computedPropertyNames43_ES5.js index 0e7c3b5dac1..b689f02ee98 100644 --- a/tests/baselines/reference/computedPropertyNames43.js +++ b/tests/baselines/reference/computedPropertyNames43_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames43.ts] +//// [computedPropertyNames43_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -12,7 +12,7 @@ class D extends C { set ["set1"](p: Foo2) { } } -//// [computedPropertyNames43.js] +//// [computedPropertyNames43_ES5.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -41,9 +41,7 @@ var D = (function (_super) { } Object.defineProperty(D.prototype, "get1", { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames43_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames43_ES6.errors.txt new file mode 100644 index 00000000000..0efe0ba39ec --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames43_ES6.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts(10,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + } + + class D extends C { + // Computed properties + get ["get1"]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + set ["set1"](p: Foo2) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames43_ES6.js b/tests/baselines/reference/computedPropertyNames43_ES6.js new file mode 100644 index 00000000000..4b64a4c803b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames43_ES6.js @@ -0,0 +1,54 @@ +//// [computedPropertyNames43_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; +} + +class D extends C { + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} + +//// [computedPropertyNames43_ES6.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + 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 + }); + return D; +})(C); diff --git a/tests/baselines/reference/computedPropertyNames44.errors.txt b/tests/baselines/reference/computedPropertyNames44_ES5.errors.txt similarity index 70% rename from tests/baselines/reference/computedPropertyNames44.errors.txt rename to tests/baselines/reference/computedPropertyNames44_ES5.errors.txt index bf1de6687e1..35ab422e093 100644 --- a/tests/baselines/reference/computedPropertyNames44.errors.txt +++ b/tests/baselines/reference/computedPropertyNames44_ES5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts(6,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts(10,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(6,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(10,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts (2 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames44.js b/tests/baselines/reference/computedPropertyNames44_ES5.js similarity index 84% rename from tests/baselines/reference/computedPropertyNames44.js rename to tests/baselines/reference/computedPropertyNames44_ES5.js index 37466dad602..32d3505e252 100644 --- a/tests/baselines/reference/computedPropertyNames44.js +++ b/tests/baselines/reference/computedPropertyNames44_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames44.ts] +//// [computedPropertyNames44_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -11,7 +11,7 @@ class D extends C { set ["set1"](p: Foo) { } } -//// [computedPropertyNames44.js] +//// [computedPropertyNames44_ES5.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -32,9 +32,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "get1", { - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames44_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames44_ES6.errors.txt new file mode 100644 index 00000000000..5170746395c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames44_ES6.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts(6,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts(10,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts (2 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + get ["get1"]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + } + + class D extends C { + set ["set1"](p: Foo) { } + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames44_ES6.js b/tests/baselines/reference/computedPropertyNames44_ES6.js new file mode 100644 index 00000000000..9cf11f3b337 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames44_ES6.js @@ -0,0 +1,52 @@ +//// [computedPropertyNames44_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + get ["get1"]() { return new Foo } +} + +class D extends C { + set ["set1"](p: Foo) { } +} + +//// [computedPropertyNames44_ES6.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "get1", { + get: function () { return new Foo; }, + enumerable: true, + configurable: true + }); + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + Object.defineProperty(D.prototype, "set1", { + set: function (p) { }, + enumerable: true, + configurable: true + }); + return D; +})(C); diff --git a/tests/baselines/reference/computedPropertyNames45.errors.txt b/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt similarity index 76% rename from tests/baselines/reference/computedPropertyNames45.errors.txt rename to tests/baselines/reference/computedPropertyNames45_ES5.errors.txt index 7ad29340b25..83855c5f0b7 100644 --- a/tests/baselines/reference/computedPropertyNames45.errors.txt +++ b/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames45.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(11,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames45.js b/tests/baselines/reference/computedPropertyNames45_ES5.js similarity index 85% rename from tests/baselines/reference/computedPropertyNames45.js rename to tests/baselines/reference/computedPropertyNames45_ES5.js index 69e0df349ca..3d924b00b73 100644 --- a/tests/baselines/reference/computedPropertyNames45.js +++ b/tests/baselines/reference/computedPropertyNames45_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames45.ts] +//// [computedPropertyNames45_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -12,7 +12,7 @@ class D extends C { set ["set1"](p: Foo) { } } -//// [computedPropertyNames45.js] +//// [computedPropertyNames45_ES5.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -33,9 +33,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "get1", { - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames45_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames45_ES6.errors.txt new file mode 100644 index 00000000000..963e01ed86b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames45_ES6.errors.txt @@ -0,0 +1,18 @@ +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) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + get ["get1"]() { return new Foo } + } + + class D extends C { + // No error when the indexer is in a class more derived than the computed property + [s: string]: Foo2; + set ["set1"](p: Foo) { } + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames45_ES6.js b/tests/baselines/reference/computedPropertyNames45_ES6.js new file mode 100644 index 00000000000..2e7992fe260 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames45_ES6.js @@ -0,0 +1,53 @@ +//// [computedPropertyNames45_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + get ["get1"]() { return new Foo } +} + +class D extends C { + // No error when the indexer is in a class more derived than the computed property + [s: string]: Foo2; + set ["set1"](p: Foo) { } +} + +//// [computedPropertyNames45_ES6.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "get1", { + get: function () { return new Foo; }, + enumerable: true, + configurable: true + }); + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + Object.defineProperty(D.prototype, "set1", { + set: function (p) { }, + enumerable: true, + configurable: true + }); + return D; +})(C); diff --git a/tests/baselines/reference/computedPropertyNames46.js b/tests/baselines/reference/computedPropertyNames46.js deleted file mode 100644 index e2ef2b2e729..00000000000 --- a/tests/baselines/reference/computedPropertyNames46.js +++ /dev/null @@ -1,9 +0,0 @@ -//// [computedPropertyNames46.ts] -var o = { - ["" || 0]: 0 -}; - -//// [computedPropertyNames46.js] -var o = { - ["" || 0]: 0 -}; diff --git a/tests/baselines/reference/computedPropertyNames46_ES5.js b/tests/baselines/reference/computedPropertyNames46_ES5.js new file mode 100644 index 00000000000..3e4329b8a20 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames46_ES5.js @@ -0,0 +1,10 @@ +//// [computedPropertyNames46_ES5.ts] +var o = { + ["" || 0]: 0 +}; + +//// [computedPropertyNames46_ES5.js] +var o = (_a = {}, _a["" || 0] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames46.types b/tests/baselines/reference/computedPropertyNames46_ES5.types similarity index 83% rename from tests/baselines/reference/computedPropertyNames46.types rename to tests/baselines/reference/computedPropertyNames46_ES5.types index cf8585828f4..bdc2f2cf644 100644 --- a/tests/baselines/reference/computedPropertyNames46.types +++ b/tests/baselines/reference/computedPropertyNames46_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames46.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts === var o = { >o : {} >{ ["" || 0]: 0} : {} diff --git a/tests/baselines/reference/computedPropertyNames46_ES6.js b/tests/baselines/reference/computedPropertyNames46_ES6.js new file mode 100644 index 00000000000..421c301d67a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames46_ES6.js @@ -0,0 +1,9 @@ +//// [computedPropertyNames46_ES6.ts] +var o = { + ["" || 0]: 0 +}; + +//// [computedPropertyNames46_ES6.js] +var o = { + ["" || 0]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames46_ES6.types b/tests/baselines/reference/computedPropertyNames46_ES6.types new file mode 100644 index 00000000000..7abb10f1ba5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames46_ES6.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES6.ts === +var o = { +>o : {} +>{ ["" || 0]: 0} : {} + + ["" || 0]: 0 +>"" || 0 : string | number + +}; diff --git a/tests/baselines/reference/computedPropertyNames47_ES5.js b/tests/baselines/reference/computedPropertyNames47_ES5.js new file mode 100644 index 00000000000..7874a25976f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames47_ES5.js @@ -0,0 +1,20 @@ +//// [computedPropertyNames47_ES5.ts] +enum E1 { x } +enum E2 { x } +var o = { + [E1.x || E2.x]: 0 +}; + +//// [computedPropertyNames47_ES5.js] +var E1; +(function (E1) { + E1[E1["x"] = 0] = "x"; +})(E1 || (E1 = {})); +var E2; +(function (E2) { + E2[E2["x"] = 0] = "x"; +})(E2 || (E2 = {})); +var o = (_a = {}, _a[0 /* x */ || 0 /* x */] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames47.types b/tests/baselines/reference/computedPropertyNames47_ES5.types similarity index 86% rename from tests/baselines/reference/computedPropertyNames47.types rename to tests/baselines/reference/computedPropertyNames47_ES5.types index 20d7ab1d31e..c79f2b20946 100644 --- a/tests/baselines/reference/computedPropertyNames47.types +++ b/tests/baselines/reference/computedPropertyNames47_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames47.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts === enum E1 { x } >E1 : E1 >x : E1 diff --git a/tests/baselines/reference/computedPropertyNames47.js b/tests/baselines/reference/computedPropertyNames47_ES6.js similarity index 73% rename from tests/baselines/reference/computedPropertyNames47.js rename to tests/baselines/reference/computedPropertyNames47_ES6.js index 88e28e54239..e104d33e7d3 100644 --- a/tests/baselines/reference/computedPropertyNames47.js +++ b/tests/baselines/reference/computedPropertyNames47_ES6.js @@ -1,11 +1,11 @@ -//// [computedPropertyNames47.ts] +//// [computedPropertyNames47_ES6.ts] enum E1 { x } enum E2 { x } var o = { [E1.x || E2.x]: 0 }; -//// [computedPropertyNames47.js] +//// [computedPropertyNames47_ES6.js] var E1; (function (E1) { E1[E1["x"] = 0] = "x"; diff --git a/tests/baselines/reference/computedPropertyNames47_ES6.types b/tests/baselines/reference/computedPropertyNames47_ES6.types new file mode 100644 index 00000000000..840d77754cf --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames47_ES6.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES6.ts === +enum E1 { x } +>E1 : E1 +>x : E1 + +enum E2 { x } +>E2 : E2 +>x : E2 + +var o = { +>o : {} +>{ [E1.x || E2.x]: 0} : {} + + [E1.x || E2.x]: 0 +>E1.x || E2.x : E1 | E2 +>E1.x : E1 +>E1 : typeof E1 +>x : E1 +>E2.x : E2 +>E2 : typeof E2 +>x : E2 + +}; diff --git a/tests/baselines/reference/computedPropertyNames48_ES5.js b/tests/baselines/reference/computedPropertyNames48_ES5.js new file mode 100644 index 00000000000..f3f9941aeae --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames48_ES5.js @@ -0,0 +1,35 @@ +//// [computedPropertyNames48_ES5.ts] +declare function extractIndexer(p: { [n: number]: T }): T; + +enum E { x } + +var a: any; + +extractIndexer({ + [a]: "" +}); // Should return string + +extractIndexer({ + [E.x]: "" +}); // Should return string + +extractIndexer({ + ["" || 0]: "" +}); // Should return any (widened form of undefined) + +//// [computedPropertyNames48_ES5.js] +var E; +(function (E) { + E[E["x"] = 0] = "x"; +})(E || (E = {})); +var a; +extractIndexer((_a = {}, _a[a] = +"", +_a)); // Should return string +extractIndexer((_b = {}, _b[0 /* x */] = +"", +_b)); // Should return string +extractIndexer((_c = {}, _c["" || 0] = +"", +_c)); // Should return any (widened form of undefined) +var _a, _b, _c; diff --git a/tests/baselines/reference/computedPropertyNames48.types b/tests/baselines/reference/computedPropertyNames48_ES5.types similarity index 93% rename from tests/baselines/reference/computedPropertyNames48.types rename to tests/baselines/reference/computedPropertyNames48_ES5.types index 78755d5d5d7..3ff4c966e89 100644 --- a/tests/baselines/reference/computedPropertyNames48.types +++ b/tests/baselines/reference/computedPropertyNames48_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames48.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts === declare function extractIndexer(p: { [n: number]: T }): T; >extractIndexer : (p: { [n: number]: T; }) => T >T : T diff --git a/tests/baselines/reference/computedPropertyNames48.js b/tests/baselines/reference/computedPropertyNames48_ES6.js similarity index 86% rename from tests/baselines/reference/computedPropertyNames48.js rename to tests/baselines/reference/computedPropertyNames48_ES6.js index 9f8e0442ebe..27821647565 100644 --- a/tests/baselines/reference/computedPropertyNames48.js +++ b/tests/baselines/reference/computedPropertyNames48_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames48.ts] +//// [computedPropertyNames48_ES6.ts] declare function extractIndexer(p: { [n: number]: T }): T; enum E { x } @@ -17,7 +17,7 @@ extractIndexer({ ["" || 0]: "" }); // Should return any (widened form of undefined) -//// [computedPropertyNames48.js] +//// [computedPropertyNames48_ES6.js] var E; (function (E) { E[E["x"] = 0] = "x"; diff --git a/tests/baselines/reference/computedPropertyNames48_ES6.types b/tests/baselines/reference/computedPropertyNames48_ES6.types new file mode 100644 index 00000000000..e10f078d11f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames48_ES6.types @@ -0,0 +1,47 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES6.ts === +declare function extractIndexer(p: { [n: number]: T }): T; +>extractIndexer : (p: { [n: number]: T; }) => T +>T : T +>p : { [n: number]: T; } +>n : number +>T : T +>T : T + +enum E { x } +>E : E +>x : E + +var a: any; +>a : any + +extractIndexer({ +>extractIndexer({ [a]: ""}) : string +>extractIndexer : (p: { [n: number]: T; }) => T +>{ [a]: ""} : { [x: number]: string; } + + [a]: "" +>a : any + +}); // Should return string + +extractIndexer({ +>extractIndexer({ [E.x]: ""}) : string +>extractIndexer : (p: { [n: number]: T; }) => T +>{ [E.x]: ""} : { [x: number]: string; } + + [E.x]: "" +>E.x : E +>E : typeof E +>x : E + +}); // Should return string + +extractIndexer({ +>extractIndexer({ ["" || 0]: ""}) : any +>extractIndexer : (p: { [n: number]: T; }) => T +>{ ["" || 0]: ""} : { [x: number]: undefined; } + + ["" || 0]: "" +>"" || 0 : string | number + +}); // Should return any (widened form of undefined) diff --git a/tests/baselines/reference/computedPropertyNames49_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames49_ES5.errors.txt new file mode 100644 index 00000000000..cb4034d3bad --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames49_ES5.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(7,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(10,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(14,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(14,9): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(19,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(19,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(19,9): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts (8 errors) ==== + + var x = { + p1: 10, + get [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + throw 10; + }, + get [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + return 10; + }, + set [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + // just throw + throw 10; + }, + get foo() { + ~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (1 == 1) { + return 10; + } + }, + get foo() { + ~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS1118: An object literal cannot have multiple get/set accessors with the same name. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (2 == 2) { + return 20; + } + }, + p2: 20 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames49_ES5.js b/tests/baselines/reference/computedPropertyNames49_ES5.js new file mode 100644 index 00000000000..a64d9431a9a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames49_ES5.js @@ -0,0 +1,46 @@ +//// [computedPropertyNames49_ES5.ts] + +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} + +//// [computedPropertyNames49_ES5.js] +var x = (_a = { + p1: 10 +}, _a.p1 = +10, _a[1 + 1] = Object.defineProperty({ get: function () { + throw 10; + }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { + return 10; + }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ set: function () { + // just throw + throw 10; + }, enumerable: true, configurable: true }), _a.foo = Object.defineProperty({ get: function () { + if (1 == 1) { + return 10; + } + }, enumerable: true, configurable: true }), _a.p2 = +20, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames49_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames49_ES6.errors.txt new file mode 100644 index 00000000000..276f7fb17be --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames49_ES6.errors.txt @@ -0,0 +1,40 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts(10,9): error TS1049: A 'set' accessor must have exactly one parameter. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts(14,9): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts(19,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts(19,9): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts (4 errors) ==== + + var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + ~~~~~~~ +!!! error TS1049: A 'set' accessor must have exactly one parameter. + // just throw + throw 10; + }, + get foo() { + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (1 == 1) { + return 10; + } + }, + get foo() { + ~~~ +!!! error TS1118: An object literal cannot have multiple get/set accessors with the same name. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (2 == 2) { + return 20; + } + }, + p2: 20 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames49_ES6.js b/tests/baselines/reference/computedPropertyNames49_ES6.js new file mode 100644 index 00000000000..d1b5fe26e9d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames49_ES6.js @@ -0,0 +1,52 @@ +//// [computedPropertyNames49_ES6.ts] + +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} + +//// [computedPropertyNames49_ES6.js] +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +}; diff --git a/tests/baselines/reference/computedPropertyNames4_ES5.js b/tests/baselines/reference/computedPropertyNames4_ES5.js new file mode 100644 index 00000000000..255b14eb970 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames4_ES5.js @@ -0,0 +1,36 @@ +//// [computedPropertyNames4_ES5.ts] +var s: string; +var n: number; +var a: any; +var 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 +} + +//// [computedPropertyNames4_ES5.js] +var s; +var n; +var a; +var v = (_a = {}, _a[s] = +0, _a[n] = +n, _a[s + s] = +1, _a[s + n] = +2, _a[+s] = +s, _a[""] = +0, _a[0] = +0, _a[a] = +1, _a[true] = +0, _a["hello bye"] = +0, _a["hello " + a + " bye"] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames4.types b/tests/baselines/reference/computedPropertyNames4_ES5.types similarity index 91% rename from tests/baselines/reference/computedPropertyNames4.types rename to tests/baselines/reference/computedPropertyNames4_ES5.types index 968cc86b598..7c26cae6444 100644 --- a/tests/baselines/reference/computedPropertyNames4.types +++ b/tests/baselines/reference/computedPropertyNames4_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames4.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts === var s: string; >s : string diff --git a/tests/baselines/reference/computedPropertyNames4.js b/tests/baselines/reference/computedPropertyNames4_ES6.js similarity index 82% rename from tests/baselines/reference/computedPropertyNames4.js rename to tests/baselines/reference/computedPropertyNames4_ES6.js index 5acb6d957da..55143ca9e10 100644 --- a/tests/baselines/reference/computedPropertyNames4.js +++ b/tests/baselines/reference/computedPropertyNames4_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames4.ts] +//// [computedPropertyNames4_ES6.ts] var s: string; var n: number; var a: any; @@ -16,7 +16,7 @@ var v = { [`hello ${a} bye`]: 0 } -//// [computedPropertyNames4.js] +//// [computedPropertyNames4_ES6.js] var s; var n; var a; diff --git a/tests/baselines/reference/computedPropertyNames4_ES6.types b/tests/baselines/reference/computedPropertyNames4_ES6.types new file mode 100644 index 00000000000..973dfbec3a5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames4_ES6.types @@ -0,0 +1,48 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES6.ts === +var s: string; +>s : string + +var n: number; +>n : number + +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} : {} + + [s]: 0, +>s : string + + [n]: n, +>n : number +>n : number + + [s + s]: 1, +>s + s : string +>s : string +>s : string + + [s + n]: 2, +>s + n : string +>s : string +>n : number + + [+s]: s, +>+s : number +>s : string +>s : string + + [""]: 0, + [0]: 0, + [a]: 1, +>a : any + + [true]: 0, +>true : any + + [`hello bye`]: 0, + [`hello ${a} bye`]: 0 +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames50_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames50_ES5.errors.txt new file mode 100644 index 00000000000..63832dbed0c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames50_ES5.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(4,9): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(9,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(16,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(19,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(19,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(19,9): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts (8 errors) ==== + + var x = { + p1: 10, + get foo() { + ~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + throw 10; + }, + set [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + // just throw + throw 10; + }, + get [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + return 10; + }, + get foo() { + ~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS1118: An object literal cannot have multiple get/set accessors with the same name. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (2 == 2) { + return 20; + } + }, + p2: 20 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames50_ES5.js b/tests/baselines/reference/computedPropertyNames50_ES5.js new file mode 100644 index 00000000000..a0703eeac05 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames50_ES5.js @@ -0,0 +1,51 @@ +//// [computedPropertyNames50_ES5.ts] + +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} + +//// [computedPropertyNames50_ES5.js] +var x = (_a = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + } +}, _a.p1 = +10, _a.foo = Object.defineProperty({ get: function () { + if (1 == 1) { + return 10; + } + }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { + throw 10; + }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ set: function () { + // just throw + throw 10; + }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { + return 10; + }, enumerable: true, configurable: true }), _a.p2 = +20, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames50_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames50_ES6.errors.txt new file mode 100644 index 00000000000..db61444a697 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames50_ES6.errors.txt @@ -0,0 +1,40 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts(4,9): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts(12,9): error TS1049: A 'set' accessor must have exactly one parameter. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts(19,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts(19,9): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts (4 errors) ==== + + var x = { + p1: 10, + get foo() { + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + ~~~~~~~ +!!! error TS1049: A 'set' accessor must have exactly one parameter. + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + ~~~ +!!! error TS1118: An object literal cannot have multiple get/set accessors with the same name. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (2 == 2) { + return 20; + } + }, + p2: 20 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames50_ES6.js b/tests/baselines/reference/computedPropertyNames50_ES6.js new file mode 100644 index 00000000000..24b0c8af1f5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames50_ES6.js @@ -0,0 +1,52 @@ +//// [computedPropertyNames50_ES6.ts] + +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} + +//// [computedPropertyNames50_ES6.js] +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +}; diff --git a/tests/baselines/reference/computedPropertyNames5.errors.txt b/tests/baselines/reference/computedPropertyNames5_ES5.errors.txt similarity index 53% rename from tests/baselines/reference/computedPropertyNames5.errors.txt rename to tests/baselines/reference/computedPropertyNames5_ES5.errors.txt index 2b8cf5503b8..f6d06758f23 100644 --- a/tests/baselines/reference/computedPropertyNames5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames5_ES5.errors.txt @@ -1,30 +1,30 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts (6 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts (6 errors) ==== var b: boolean; var v = { [b]: 0, ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [true]: 1, ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [[]]: 0, ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [{}]: 0, ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [undefined]: undefined, ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [null]: null ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames5_ES5.js b/tests/baselines/reference/computedPropertyNames5_ES5.js new file mode 100644 index 00000000000..722c0f3a74d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames5_ES5.js @@ -0,0 +1,22 @@ +//// [computedPropertyNames5_ES5.ts] +var b: boolean; +var v = { + [b]: 0, + [true]: 1, + [[]]: 0, + [{}]: 0, + [undefined]: undefined, + [null]: null +} + +//// [computedPropertyNames5_ES5.js] +var b; +var v = (_a = {}, _a[b] = +0, _a[true] = +1, _a[[]] = +0, _a[{}] = +0, _a[undefined] = +undefined, _a[null] = +null, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames5_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames5_ES6.errors.txt new file mode 100644 index 00000000000..04675431c5c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames5_ES6.errors.txt @@ -0,0 +1,30 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts (6 errors) ==== + var b: boolean; + var v = { + [b]: 0, + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [true]: 1, + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [[]]: 0, + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [{}]: 0, + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [undefined]: undefined, + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [null]: null + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames5.js b/tests/baselines/reference/computedPropertyNames5_ES6.js similarity index 73% rename from tests/baselines/reference/computedPropertyNames5.js rename to tests/baselines/reference/computedPropertyNames5_ES6.js index d0158da6400..0ac309b8ed0 100644 --- a/tests/baselines/reference/computedPropertyNames5.js +++ b/tests/baselines/reference/computedPropertyNames5_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames5.ts] +//// [computedPropertyNames5_ES6.ts] var b: boolean; var v = { [b]: 0, @@ -9,7 +9,7 @@ var v = { [null]: null } -//// [computedPropertyNames5.js] +//// [computedPropertyNames5_ES6.js] var b; var v = { [b]: 0, diff --git a/tests/baselines/reference/computedPropertyNames6.errors.txt b/tests/baselines/reference/computedPropertyNames6_ES5.errors.txt similarity index 59% rename from tests/baselines/reference/computedPropertyNames6.errors.txt rename to tests/baselines/reference/computedPropertyNames6_ES5.errors.txt index 57798e9f6b6..1780af80d87 100644 --- a/tests/baselines/reference/computedPropertyNames6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames6_ES5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts (2 errors) ==== var p1: number | string; var p2: number | number[]; var p3: string | boolean; @@ -10,8 +10,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): e [p1]: 0, [p2]: 1, ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [p3]: 2 ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames6_ES5.js b/tests/baselines/reference/computedPropertyNames6_ES5.js new file mode 100644 index 00000000000..4e3ed1b2e9f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames6_ES5.js @@ -0,0 +1,20 @@ +//// [computedPropertyNames6_ES5.ts] +var p1: number | string; +var p2: number | number[]; +var p3: string | boolean; +var v = { + [p1]: 0, + [p2]: 1, + [p3]: 2 +} + +//// [computedPropertyNames6_ES5.js] +var p1; +var p2; +var p3; +var v = (_a = {}, _a[p1] = +0, _a[p2] = +1, _a[p3] = +2, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames6_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames6_ES6.errors.txt new file mode 100644 index 00000000000..7f73ea97fa7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames6_ES6.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES6.ts (2 errors) ==== + var p1: number | string; + var p2: number | number[]; + var p3: string | boolean; + var v = { + [p1]: 0, + [p2]: 1, + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [p3]: 2 + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames6.js b/tests/baselines/reference/computedPropertyNames6_ES6.js similarity index 70% rename from tests/baselines/reference/computedPropertyNames6.js rename to tests/baselines/reference/computedPropertyNames6_ES6.js index e131ef4417f..1efc6fe004c 100644 --- a/tests/baselines/reference/computedPropertyNames6.js +++ b/tests/baselines/reference/computedPropertyNames6_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames6.ts] +//// [computedPropertyNames6_ES6.ts] var p1: number | string; var p2: number | number[]; var p3: string | boolean; @@ -8,7 +8,7 @@ var v = { [p3]: 2 } -//// [computedPropertyNames6.js] +//// [computedPropertyNames6_ES6.js] var p1; var p2; var p3; diff --git a/tests/baselines/reference/computedPropertyNames7_ES5.js b/tests/baselines/reference/computedPropertyNames7_ES5.js new file mode 100644 index 00000000000..3e1bcc1151c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames7_ES5.js @@ -0,0 +1,17 @@ +//// [computedPropertyNames7_ES5.ts] +enum E { + member +} +var v = { + [E.member]: 0 +} + +//// [computedPropertyNames7_ES5.js] +var E; +(function (E) { + E[E["member"] = 0] = "member"; +})(E || (E = {})); +var v = (_a = {}, _a[0 /* member */] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames7.types b/tests/baselines/reference/computedPropertyNames7_ES5.types similarity index 85% rename from tests/baselines/reference/computedPropertyNames7.types rename to tests/baselines/reference/computedPropertyNames7_ES5.types index 0b5f26614fc..209e07769c0 100644 --- a/tests/baselines/reference/computedPropertyNames7.types +++ b/tests/baselines/reference/computedPropertyNames7_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames7.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts === enum E { >E : E diff --git a/tests/baselines/reference/computedPropertyNames7.js b/tests/baselines/reference/computedPropertyNames7_ES6.js similarity index 66% rename from tests/baselines/reference/computedPropertyNames7.js rename to tests/baselines/reference/computedPropertyNames7_ES6.js index 075b149522b..5714fb747a6 100644 --- a/tests/baselines/reference/computedPropertyNames7.js +++ b/tests/baselines/reference/computedPropertyNames7_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames7.ts] +//// [computedPropertyNames7_ES6.ts] enum E { member } @@ -6,7 +6,7 @@ var v = { [E.member]: 0 } -//// [computedPropertyNames7.js] +//// [computedPropertyNames7_ES6.js] var E; (function (E) { E[E["member"] = 0] = "member"; diff --git a/tests/baselines/reference/computedPropertyNames7_ES6.types b/tests/baselines/reference/computedPropertyNames7_ES6.types new file mode 100644 index 00000000000..371176acc16 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames7_ES6.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES6.ts === +enum E { +>E : E + + member +>member : E +} +var v = { +>v : {} +>{ [E.member]: 0} : {} + + [E.member]: 0 +>E.member : E +>E : typeof E +>member : E +} diff --git a/tests/baselines/reference/computedPropertyNames8.errors.txt b/tests/baselines/reference/computedPropertyNames8_ES5.errors.txt similarity index 59% rename from tests/baselines/reference/computedPropertyNames8.errors.txt rename to tests/baselines/reference/computedPropertyNames8_ES5.errors.txt index 515af1f4fc4..9fbd14a92fb 100644 --- a/tests/baselines/reference/computedPropertyNames8.errors.txt +++ b/tests/baselines/reference/computedPropertyNames8_ES5.errors.txt @@ -1,17 +1,17 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts (2 errors) ==== function f() { var t: T; var u: U; var v = { [t]: 0, ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [u]: 1 ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. }; } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames8_ES5.js b/tests/baselines/reference/computedPropertyNames8_ES5.js new file mode 100644 index 00000000000..4db9ed2ec13 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames8_ES5.js @@ -0,0 +1,20 @@ +//// [computedPropertyNames8_ES5.ts] +function f() { + var t: T; + var u: U; + var v = { + [t]: 0, + [u]: 1 + }; +} + +//// [computedPropertyNames8_ES5.js] +function f() { + var t; + var u; + var v = (_a = {}, _a[t] = + 0, _a[u] = + 1, + _a); + var _a; +} diff --git a/tests/baselines/reference/computedPropertyNames8_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames8_ES6.errors.txt new file mode 100644 index 00000000000..22674a3992c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames8_ES6.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES6.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES6.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES6.ts (2 errors) ==== + function f() { + var t: T; + var u: U; + var v = { + [t]: 0, + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [u]: 1 + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + }; + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames8.js b/tests/baselines/reference/computedPropertyNames8_ES6.js similarity index 70% rename from tests/baselines/reference/computedPropertyNames8.js rename to tests/baselines/reference/computedPropertyNames8_ES6.js index 44a21d79a1c..2290de66c71 100644 --- a/tests/baselines/reference/computedPropertyNames8.js +++ b/tests/baselines/reference/computedPropertyNames8_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames8.ts] +//// [computedPropertyNames8_ES6.ts] function f() { var t: T; var u: U; @@ -8,7 +8,7 @@ function f() { }; } -//// [computedPropertyNames8.js] +//// [computedPropertyNames8_ES6.js] function f() { var t; var u; diff --git a/tests/baselines/reference/computedPropertyNames9.errors.txt b/tests/baselines/reference/computedPropertyNames9_ES5.errors.txt similarity index 68% rename from tests/baselines/reference/computedPropertyNames9.errors.txt rename to tests/baselines/reference/computedPropertyNames9_ES5.errors.txt index d87576f1f77..f58dfbc3166 100644 --- a/tests/baselines/reference/computedPropertyNames9.errors.txt +++ b/tests/baselines/reference/computedPropertyNames9_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts (1 errors) ==== function f(s: string): string; function f(n: number): number; function f(x: T): T; @@ -12,5 +12,5 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): e [f(0)]: 0, [f(true)]: 0 ~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames9_ES5.js b/tests/baselines/reference/computedPropertyNames9_ES5.js new file mode 100644 index 00000000000..a7c4a74d5ec --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames9_ES5.js @@ -0,0 +1,20 @@ +//// [computedPropertyNames9_ES5.ts] +function f(s: string): string; +function f(n: number): number; +function f(x: T): T; +function f(x): any { } + +var v = { + [f("")]: 0, + [f(0)]: 0, + [f(true)]: 0 +} + +//// [computedPropertyNames9_ES5.js] +function f(x) { } +var v = (_a = {}, _a[f("")] = +0, _a[f(0)] = +0, _a[f(true)] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames9_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames9_ES6.errors.txt new file mode 100644 index 00000000000..70dd526b85a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames9_ES6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES6.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES6.ts (1 errors) ==== + function f(s: string): string; + function f(n: number): number; + function f(x: T): T; + function f(x): any { } + + var v = { + [f("")]: 0, + [f(0)]: 0, + [f(true)]: 0 + ~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames9.js b/tests/baselines/reference/computedPropertyNames9_ES6.js similarity index 74% rename from tests/baselines/reference/computedPropertyNames9.js rename to tests/baselines/reference/computedPropertyNames9_ES6.js index c2e89cd3133..b0e66c81cbd 100644 --- a/tests/baselines/reference/computedPropertyNames9.js +++ b/tests/baselines/reference/computedPropertyNames9_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames9.ts] +//// [computedPropertyNames9_ES6.ts] function f(s: string): string; function f(n: number): number; function f(x: T): T; @@ -10,7 +10,7 @@ var v = { [f(true)]: 0 } -//// [computedPropertyNames9.js] +//// [computedPropertyNames9_ES6.js] function f(x) { } var v = { [f("")]: 0, diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.errors.txt similarity index 79% rename from tests/baselines/reference/computedPropertyNamesContextualType10.errors.txt rename to tests/baselines/reference/computedPropertyNamesContextualType10_ES5.errors.txt index 5e9fbe7b45b..7fa95fe9426 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType10.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10.ts(5,5): error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts(5,5): error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. Index signatures are incompatible. Type 'string | number' is not assignable to type 'boolean'. Type 'string' is not assignable to type 'boolean'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts (1 errors) ==== interface I { [s: number]: boolean; } diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js new file mode 100644 index 00000000000..5ea05124674 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js @@ -0,0 +1,16 @@ +//// [computedPropertyNamesContextualType10_ES5.ts] +interface I { + [s: number]: boolean; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType10_ES5.js] +var o = (_a = {}, _a[+"foo"] = +"", _a[+"bar"] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType10_ES6.errors.txt new file mode 100644 index 00000000000..116cd1a2531 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES6.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES6.ts(5,5): error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. + Index signatures are incompatible. + Type 'string | number' is not assignable to type 'boolean'. + Type 'string' is not assignable to type 'boolean'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES6.ts (1 errors) ==== + interface I { + [s: number]: boolean; + } + + var o: I = { + ~ +!!! error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. +!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + [+"foo"]: "", + [+"bar"]: 0 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10.js b/tests/baselines/reference/computedPropertyNamesContextualType10_ES6.js similarity index 55% rename from tests/baselines/reference/computedPropertyNamesContextualType10.js rename to tests/baselines/reference/computedPropertyNamesContextualType10_ES6.js index 125a014852e..fa08b5db3d2 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType10.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType10.ts] +//// [computedPropertyNamesContextualType10_ES6.ts] interface I { [s: number]: boolean; } @@ -8,7 +8,7 @@ var o: I = { [+"bar"]: 0 } -//// [computedPropertyNamesContextualType10.js] +//// [computedPropertyNamesContextualType10_ES6.js] var o = { [+"foo"]: "", [+"bar"]: 0 diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js new file mode 100644 index 00000000000..a7994495411 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js @@ -0,0 +1,16 @@ +//// [computedPropertyNamesContextualType1_ES5.ts] +interface I { + [s: string]: (x: string) => number; + [s: number]: (x: any) => number; // Doesn't get hit +} + +var o: I = { + ["" + 0](y) { return y.length; }, + ["" + 1]: y => y.length +} + +//// [computedPropertyNamesContextualType1_ES5.js] +var o = (_a = {}, _a["" + 0] = function (y) { return y.length; }, _a["" + 1] = +function (y) { return y.length; }, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1.types b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.types similarity index 90% rename from tests/baselines/reference/computedPropertyNamesContextualType1.types rename to tests/baselines/reference/computedPropertyNamesContextualType1_ES5.types index 1697542fba6..ad7ddc30567 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts === interface I { >I : I diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1.js b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.js similarity index 61% rename from tests/baselines/reference/computedPropertyNamesContextualType1.js rename to tests/baselines/reference/computedPropertyNamesContextualType1_ES6.js index 82429be9c40..f23a1a19e60 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType1.ts] +//// [computedPropertyNamesContextualType1_ES6.ts] interface I { [s: string]: (x: string) => number; [s: number]: (x: any) => number; // Doesn't get hit @@ -9,10 +9,8 @@ var o: I = { ["" + 1]: y => y.length } -//// [computedPropertyNamesContextualType1.js] +//// [computedPropertyNamesContextualType1_ES6.js] var o = { - ["" + 0](y) { - return y.length; - }, + ["" + 0](y) { return y.length; }, ["" + 1]: y => { return y.length; } }; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.types new file mode 100644 index 00000000000..44bc8a51113 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.types @@ -0,0 +1,33 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES6.ts === +interface I { +>I : I + + [s: string]: (x: string) => number; +>s : string +>x : string + + [s: number]: (x: any) => number; // Doesn't get hit +>s : number +>x : any +} + +var o: I = { +>o : I +>I : I +>{ ["" + 0](y) { return y.length; }, ["" + 1]: y => y.length} : { [x: string]: (y: string) => number; [x: number]: undefined; } + + ["" + 0](y) { return y.length; }, +>"" + 0 : string +>y : string +>y.length : number +>y : string +>length : number + + ["" + 1]: y => y.length +>"" + 1 : string +>y => y.length : (y: string) => number +>y : string +>y.length : number +>y : string +>length : number +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js new file mode 100644 index 00000000000..0c6b80bbabb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js @@ -0,0 +1,16 @@ +//// [computedPropertyNamesContextualType2_ES5.ts] +interface I { + [s: string]: (x: any) => number; // Doesn't get hit + [s: number]: (x: string) => number; +} + +var o: I = { + [+"foo"](y) { return y.length; }, + [+"bar"]: y => y.length +} + +//// [computedPropertyNamesContextualType2_ES5.js] +var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; }, _a[+"bar"] = +function (y) { return y.length; }, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2.types b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.types similarity index 90% rename from tests/baselines/reference/computedPropertyNamesContextualType2.types rename to tests/baselines/reference/computedPropertyNamesContextualType2_ES5.types index 408fd6a5062..0c1b9490abe 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts === interface I { >I : I diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2.js b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.js similarity index 61% rename from tests/baselines/reference/computedPropertyNamesContextualType2.js rename to tests/baselines/reference/computedPropertyNamesContextualType2_ES6.js index 028e797be18..6a3fb653138 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType2.ts] +//// [computedPropertyNamesContextualType2_ES6.ts] interface I { [s: string]: (x: any) => number; // Doesn't get hit [s: number]: (x: string) => number; @@ -9,10 +9,8 @@ var o: I = { [+"bar"]: y => y.length } -//// [computedPropertyNamesContextualType2.js] +//// [computedPropertyNamesContextualType2_ES6.js] var o = { - [+"foo"](y) { - return y.length; - }, + [+"foo"](y) { return y.length; }, [+"bar"]: y => { return y.length; } }; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.types new file mode 100644 index 00000000000..222004cf8e3 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.types @@ -0,0 +1,33 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES6.ts === +interface I { +>I : I + + [s: string]: (x: any) => number; // Doesn't get hit +>s : string +>x : any + + [s: number]: (x: string) => number; +>s : number +>x : string +} + +var o: I = { +>o : I +>I : I +>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: string]: (y: string) => number; [x: number]: (y: string) => number; } + + [+"foo"](y) { return y.length; }, +>+"foo" : number +>y : string +>y.length : number +>y : string +>length : number + + [+"bar"]: y => y.length +>+"bar" : number +>y => y.length : (y: string) => number +>y : string +>y.length : number +>y : string +>length : number +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js new file mode 100644 index 00000000000..4336808c558 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js @@ -0,0 +1,15 @@ +//// [computedPropertyNamesContextualType3_ES5.ts] +interface I { + [s: string]: (x: string) => number; +} + +var o: I = { + [+"foo"](y) { return y.length; }, + [+"bar"]: y => y.length +} + +//// [computedPropertyNamesContextualType3_ES5.js] +var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; }, _a[+"bar"] = +function (y) { return y.length; }, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3.types b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.types similarity index 89% rename from tests/baselines/reference/computedPropertyNamesContextualType3.types rename to tests/baselines/reference/computedPropertyNamesContextualType3_ES5.types index a1a36c1b7e9..482d58c3ee0 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts === interface I { >I : I diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3.js b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.js similarity index 55% rename from tests/baselines/reference/computedPropertyNamesContextualType3.js rename to tests/baselines/reference/computedPropertyNamesContextualType3_ES6.js index 944bb3595d4..9bf7dec1dd0 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType3.ts] +//// [computedPropertyNamesContextualType3_ES6.ts] interface I { [s: string]: (x: string) => number; } @@ -8,10 +8,8 @@ var o: I = { [+"bar"]: y => y.length } -//// [computedPropertyNamesContextualType3.js] +//// [computedPropertyNamesContextualType3_ES6.js] var o = { - [+"foo"](y) { - return y.length; - }, + [+"foo"](y) { return y.length; }, [+"bar"]: y => { return y.length; } }; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.types new file mode 100644 index 00000000000..bc36ad8ae2c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.types @@ -0,0 +1,29 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES6.ts === +interface I { +>I : I + + [s: string]: (x: string) => number; +>s : string +>x : string +} + +var o: I = { +>o : I +>I : I +>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: string]: (y: string) => number; } + + [+"foo"](y) { return y.length; }, +>+"foo" : number +>y : string +>y.length : number +>y : string +>length : number + + [+"bar"]: y => y.length +>+"bar" : number +>y => y.length : (y: string) => number +>y : string +>y.length : number +>y : string +>length : number +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js new file mode 100644 index 00000000000..b813da30496 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesContextualType4_ES5.ts] +interface I { + [s: string]: any; + [s: number]: any; +} + +var o: I = { + [""+"foo"]: "", + [""+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType4_ES5.js] +var o = (_a = {}, _a["" + "foo"] = +"", _a["" + "bar"] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4.types b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.types similarity index 86% rename from tests/baselines/reference/computedPropertyNamesContextualType4.types rename to tests/baselines/reference/computedPropertyNamesContextualType4_ES5.types index d22f56f24fe..c1662397527 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType4.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts === interface I { >I : I diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4.js b/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.js similarity index 60% rename from tests/baselines/reference/computedPropertyNamesContextualType4.js rename to tests/baselines/reference/computedPropertyNamesContextualType4_ES6.js index 6ddd22baf6e..87cc54b4a59 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType4.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType4.ts] +//// [computedPropertyNamesContextualType4_ES6.ts] interface I { [s: string]: any; [s: number]: any; @@ -9,7 +9,7 @@ var o: I = { [""+"bar"]: 0 } -//// [computedPropertyNamesContextualType4.js] +//// [computedPropertyNamesContextualType4_ES6.js] var o = { ["" + "foo"]: "", ["" + "bar"]: 0 diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.types new file mode 100644 index 00000000000..82424f9410c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES6.ts === +interface I { +>I : I + + [s: string]: any; +>s : string + + [s: number]: any; +>s : number +} + +var o: I = { +>o : I +>I : I +>{ [""+"foo"]: "", [""+"bar"]: 0} : { [x: string]: string | number; [x: number]: undefined; } + + [""+"foo"]: "", +>""+"foo" : string + + [""+"bar"]: 0 +>""+"bar" : string +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js new file mode 100644 index 00000000000..f75389de3e9 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesContextualType5_ES5.ts] +interface I { + [s: string]: any; + [s: number]: any; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType5_ES5.js] +var o = (_a = {}, _a[+"foo"] = +"", _a[+"bar"] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5.types b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.types similarity index 86% rename from tests/baselines/reference/computedPropertyNamesContextualType5.types rename to tests/baselines/reference/computedPropertyNamesContextualType5_ES5.types index 12c3332acfa..bb382ca136e 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType5.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts === interface I { >I : I diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5.js b/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.js similarity index 58% rename from tests/baselines/reference/computedPropertyNamesContextualType5.js rename to tests/baselines/reference/computedPropertyNamesContextualType5_ES6.js index f2bd79644a0..775e8931efe 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType5.ts] +//// [computedPropertyNamesContextualType5_ES6.ts] interface I { [s: string]: any; [s: number]: any; @@ -9,7 +9,7 @@ var o: I = { [+"bar"]: 0 } -//// [computedPropertyNamesContextualType5.js] +//// [computedPropertyNamesContextualType5_ES6.js] var o = { [+"foo"]: "", [+"bar"]: 0 diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.types new file mode 100644 index 00000000000..6ab28f9583d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES6.ts === +interface I { +>I : I + + [s: string]: any; +>s : string + + [s: number]: any; +>s : number +} + +var o: I = { +>o : I +>I : I +>{ [+"foo"]: "", [+"bar"]: 0} : { [x: string]: string | number; [x: number]: string | number; } + + [+"foo"]: "", +>+"foo" : number + + [+"bar"]: 0 +>+"bar" : number +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js new file mode 100644 index 00000000000..bc724320d14 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js @@ -0,0 +1,27 @@ +//// [computedPropertyNamesContextualType6_ES5.ts] +interface I { + [s: string]: T; +} + +declare function foo(obj: I): T + +foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); + +//// [computedPropertyNamesContextualType6_ES5.js] +foo((_a = { + p: "", + 0: function () { } +}, _a.p = +"", _a[0] = +function () { }, _a["hi" + "bye"] = +true, _a[0 + 1] = +0, _a[+"hi"] = +[0], +_a)); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6.types b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types similarity index 91% rename from tests/baselines/reference/computedPropertyNamesContextualType6.types rename to tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types index acbae75ad4c..2e16c7cb140 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts === interface I { >I : I >T : T diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6.types.pull b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types.pull similarity index 91% rename from tests/baselines/reference/computedPropertyNamesContextualType6.types.pull rename to tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types.pull index a7a65d6618d..ce7a4c0d026 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6.types.pull +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types.pull @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts === interface I { >I : I >T : T diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6.js b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.js similarity index 70% rename from tests/baselines/reference/computedPropertyNamesContextualType6.js rename to tests/baselines/reference/computedPropertyNamesContextualType6_ES6.js index 20678a60658..1360cc20028 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType6.ts] +//// [computedPropertyNamesContextualType6_ES6.ts] interface I { [s: string]: T; } @@ -13,7 +13,7 @@ foo({ [+"hi"]: [0] }); -//// [computedPropertyNamesContextualType6.js] +//// [computedPropertyNamesContextualType6_ES6.js] foo({ p: "", 0: () => { }, diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types new file mode 100644 index 00000000000..1684bfc573f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types @@ -0,0 +1,40 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES6.ts === +interface I { +>I : I +>T : T + + [s: string]: T; +>s : string +>T : T +} + +declare function foo(obj: I): T +>foo : (obj: I) => T +>T : T +>obj : I +>I : I +>T : T +>T : T + +foo({ +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | number | boolean | number[] | (() => void) +>foo : (obj: I) => T +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | number | boolean | number[] | (() => void); 0: () => void; p: string; } + + p: "", +>p : string + + 0: () => { }, +>() => { } : () => void + + ["hi" + "bye"]: true, +>"hi" + "bye" : string + + [0 + 1]: 0, +>0 + 1 : number + + [+"hi"]: [0] +>+"hi" : number +>[0] : number[] + +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types.pull b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types.pull new file mode 100644 index 00000000000..6722edacd64 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types.pull @@ -0,0 +1,40 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES6.ts === +interface I { +>I : I +>T : T + + [s: string]: T; +>s : string +>T : T +} + +declare function foo(obj: I): T +>foo : (obj: I) => T +>T : T +>obj : I +>I : I +>T : T +>T : T + +foo({ +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | number | boolean | (() => void) | number[] +>foo : (obj: I) => T +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | number | boolean | (() => void) | number[]; 0: () => void; p: string; } + + p: "", +>p : string + + 0: () => { }, +>() => { } : () => void + + ["hi" + "bye"]: true, +>"hi" + "bye" : string + + [0 + 1]: 0, +>0 + 1 : number + + [+"hi"]: [0] +>+"hi" : number +>[0] : number[] + +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js new file mode 100644 index 00000000000..8d2386a1d14 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js @@ -0,0 +1,27 @@ +//// [computedPropertyNamesContextualType7_ES5.ts] +interface I { + [s: number]: T; +} + +declare function foo(obj: I): T + +foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); + +//// [computedPropertyNamesContextualType7_ES5.js] +foo((_a = { + p: "", + 0: function () { } +}, _a.p = +"", _a[0] = +function () { }, _a["hi" + "bye"] = +true, _a[0 + 1] = +0, _a[+"hi"] = +[0], +_a)); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7.types b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types similarity index 91% rename from tests/baselines/reference/computedPropertyNamesContextualType7.types rename to tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types index da059d490b0..80ba2b9224f 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts === interface I { >I : I >T : T diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7.types.pull b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types.pull similarity index 91% rename from tests/baselines/reference/computedPropertyNamesContextualType7.types.pull rename to tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types.pull index ff68ec8d0b0..3511e913585 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7.types.pull +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types.pull @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts === interface I { >I : I >T : T diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7.js b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.js similarity index 70% rename from tests/baselines/reference/computedPropertyNamesContextualType7.js rename to tests/baselines/reference/computedPropertyNamesContextualType7_ES6.js index a948c31d750..185ccd72ead 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType7.ts] +//// [computedPropertyNamesContextualType7_ES6.ts] interface I { [s: number]: T; } @@ -13,7 +13,7 @@ foo({ [+"hi"]: [0] }); -//// [computedPropertyNamesContextualType7.js] +//// [computedPropertyNamesContextualType7_ES6.js] foo({ p: "", 0: () => { }, diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types new file mode 100644 index 00000000000..c9ed4437760 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types @@ -0,0 +1,40 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES6.ts === +interface I { +>I : I +>T : T + + [s: number]: T; +>s : number +>T : T +} + +declare function foo(obj: I): T +>foo : (obj: I) => T +>T : T +>obj : I +>I : I +>T : T +>T : T + +foo({ +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : number | number[] | (() => void) +>foo : (obj: I) => T +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: number]: number | number[] | (() => void); 0: () => void; p: string; } + + p: "", +>p : string + + 0: () => { }, +>() => { } : () => void + + ["hi" + "bye"]: true, +>"hi" + "bye" : string + + [0 + 1]: 0, +>0 + 1 : number + + [+"hi"]: [0] +>+"hi" : number +>[0] : number[] + +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types.pull b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types.pull new file mode 100644 index 00000000000..c548aed2bae --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types.pull @@ -0,0 +1,40 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES6.ts === +interface I { +>I : I +>T : T + + [s: number]: T; +>s : number +>T : T +} + +declare function foo(obj: I): T +>foo : (obj: I) => T +>T : T +>obj : I +>I : I +>T : T +>T : T + +foo({ +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : number | (() => void) | number[] +>foo : (obj: I) => T +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: number]: number | (() => void) | number[]; 0: () => void; p: string; } + + p: "", +>p : string + + 0: () => { }, +>() => { } : () => void + + ["hi" + "bye"]: true, +>"hi" + "bye" : string + + [0 + 1]: 0, +>0 + 1 : number + + [+"hi"]: [0] +>+"hi" : number +>[0] : number[] + +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt similarity index 78% rename from tests/baselines/reference/computedPropertyNamesContextualType8.errors.txt rename to tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt index 07b55b799e4..3376243e370 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType8.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. Index signatures are incompatible. Type 'string | number' is not assignable to type 'boolean'. Type 'string' is not assignable to type 'boolean'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts (1 errors) ==== interface I { [s: string]: boolean; [s: number]: boolean; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js new file mode 100644 index 00000000000..626f3d1a8e2 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesContextualType8_ES5.ts] +interface I { + [s: string]: boolean; + [s: number]: boolean; +} + +var o: I = { + [""+"foo"]: "", + [""+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType8_ES5.js] +var o = (_a = {}, _a["" + "foo"] = +"", _a["" + "bar"] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.errors.txt new file mode 100644 index 00000000000..e4540337ed4 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. + Index signatures are incompatible. + Type 'string | number' is not assignable to type 'boolean'. + Type 'string' is not assignable to type 'boolean'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts (1 errors) ==== + interface I { + [s: string]: boolean; + [s: number]: boolean; + } + + var o: I = { + ~ +!!! error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. +!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + [""+"foo"]: "", + [""+"bar"]: 0 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8.js b/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.js similarity index 61% rename from tests/baselines/reference/computedPropertyNamesContextualType8.js rename to tests/baselines/reference/computedPropertyNamesContextualType8_ES6.js index d98538c40c1..6a18fa0b92b 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType8.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType8.ts] +//// [computedPropertyNamesContextualType8_ES6.ts] interface I { [s: string]: boolean; [s: number]: boolean; @@ -9,7 +9,7 @@ var o: I = { [""+"bar"]: 0 } -//// [computedPropertyNamesContextualType8.js] +//// [computedPropertyNamesContextualType8_ES6.js] var o = { ["" + "foo"]: "", ["" + "bar"]: 0 diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt similarity index 78% rename from tests/baselines/reference/computedPropertyNamesContextualType9.errors.txt rename to tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt index 6a1d9316fd7..d4085a37e60 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType9.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. Index signatures are incompatible. Type 'string | number' is not assignable to type 'boolean'. Type 'string' is not assignable to type 'boolean'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts (1 errors) ==== interface I { [s: string]: boolean; [s: number]: boolean; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js new file mode 100644 index 00000000000..c28db4ded97 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesContextualType9_ES5.ts] +interface I { + [s: string]: boolean; + [s: number]: boolean; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType9_ES5.js] +var o = (_a = {}, _a[+"foo"] = +"", _a[+"bar"] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.errors.txt new file mode 100644 index 00000000000..eca1360c26f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES6.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. + Index signatures are incompatible. + Type 'string | number' is not assignable to type 'boolean'. + Type 'string' is not assignable to type 'boolean'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES6.ts (1 errors) ==== + interface I { + [s: string]: boolean; + [s: number]: boolean; + } + + var o: I = { + ~ +!!! error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. +!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + [+"foo"]: "", + [+"bar"]: 0 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9.js b/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.js similarity index 60% rename from tests/baselines/reference/computedPropertyNamesContextualType9.js rename to tests/baselines/reference/computedPropertyNamesContextualType9_ES6.js index ed8791a51e0..e94ded1a47a 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType9.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType9.ts] +//// [computedPropertyNamesContextualType9_ES6.ts] interface I { [s: string]: boolean; [s: number]: boolean; @@ -9,7 +9,7 @@ var o: I = { [+"bar"]: 0 } -//// [computedPropertyNamesContextualType9.js] +//// [computedPropertyNamesContextualType9_ES6.js] var o = { [+"foo"]: "", [+"bar"]: 0 diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.js similarity index 67% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit1.js rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.js index bbdb6cd7baf..84b92f6c92d 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.js @@ -1,19 +1,17 @@ -//// [computedPropertyNamesDeclarationEmit1.ts] +//// [computedPropertyNamesDeclarationEmit1_ES5.ts] class C { ["" + ""]() { } get ["" + ""]() { return 0; } set ["" + ""](x) { } } -//// [computedPropertyNamesDeclarationEmit1.js] +//// [computedPropertyNamesDeclarationEmit1_ES5.js] var C = (function () { function C() { } C.prototype["" + ""] = function () { }; Object.defineProperty(C.prototype, "" + "", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -26,6 +24,6 @@ var C = (function () { })(); -//// [computedPropertyNamesDeclarationEmit1.d.ts] +//// [computedPropertyNamesDeclarationEmit1_ES5.d.ts] declare class C { } diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.types similarity index 82% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit1.types rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.types index e8e184a652e..a5fe3dc0fa1 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.types +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts === class C { >C : C diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.js new file mode 100644 index 00000000000..b7505212baf --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.js @@ -0,0 +1,29 @@ +//// [computedPropertyNamesDeclarationEmit1_ES6.ts] +class C { + ["" + ""]() { } + get ["" + ""]() { return 0; } + set ["" + ""](x) { } +} + +//// [computedPropertyNamesDeclarationEmit1_ES6.js] +var C = (function () { + function C() { + } + C.prototype["" + ""] = function () { }; + Object.defineProperty(C.prototype, "" + "", { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "" + "", { + set: function (x) { }, + enumerable: true, + configurable: true + }); + return C; +})(); + + +//// [computedPropertyNamesDeclarationEmit1_ES6.d.ts] +declare class C { +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.types new file mode 100644 index 00000000000..a48c85f8602 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES6.ts === +class C { +>C : C + + ["" + ""]() { } +>"" + "" : string + + get ["" + ""]() { return 0; } +>"" + "" : string + + set ["" + ""](x) { } +>"" + "" : string +>x : any +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.js similarity index 66% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit2.js rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.js index 10313841c4f..9847ea8b7ef 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.js @@ -1,19 +1,17 @@ -//// [computedPropertyNamesDeclarationEmit2.ts] +//// [computedPropertyNamesDeclarationEmit2_ES5.ts] class C { static ["" + ""]() { } static get ["" + ""]() { return 0; } static set ["" + ""](x) { } } -//// [computedPropertyNamesDeclarationEmit2.js] +//// [computedPropertyNamesDeclarationEmit2_ES5.js] var C = (function () { function C() { } C["" + ""] = function () { }; Object.defineProperty(C, "" + "", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -26,6 +24,6 @@ var C = (function () { })(); -//// [computedPropertyNamesDeclarationEmit2.d.ts] +//// [computedPropertyNamesDeclarationEmit2_ES5.d.ts] declare class C { } diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.types similarity index 83% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit2.types rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.types index df1da17abea..949d82596c7 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.types +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts === class C { >C : C diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.js new file mode 100644 index 00000000000..9cd90493ea6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.js @@ -0,0 +1,29 @@ +//// [computedPropertyNamesDeclarationEmit2_ES6.ts] +class C { + static ["" + ""]() { } + static get ["" + ""]() { return 0; } + static set ["" + ""](x) { } +} + +//// [computedPropertyNamesDeclarationEmit2_ES6.js] +var C = (function () { + function C() { + } + C["" + ""] = function () { }; + Object.defineProperty(C, "" + "", { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "" + "", { + set: function (x) { }, + enumerable: true, + configurable: true + }); + return C; +})(); + + +//// [computedPropertyNamesDeclarationEmit2_ES6.d.ts] +declare class C { +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.types new file mode 100644 index 00000000000..eec55608a08 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES6.ts === +class C { +>C : C + + static ["" + ""]() { } +>"" + "" : string + + static get ["" + ""]() { return 0; } +>"" + "" : string + + static set ["" + ""](x) { } +>"" + "" : string +>x : any +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt deleted file mode 100644 index 69ff2b9e452..00000000000 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts (1 errors) ==== - interface I { - ["" + ""](): void; - ~~~~~~~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.js deleted file mode 100644 index affe949797e..00000000000 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.js +++ /dev/null @@ -1,11 +0,0 @@ -//// [computedPropertyNamesDeclarationEmit3.ts] -interface I { - ["" + ""](): void; -} - -//// [computedPropertyNamesDeclarationEmit3.js] - - -//// [computedPropertyNamesDeclarationEmit3.d.ts] -interface I { -} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.errors.txt new file mode 100644 index 00000000000..b6effe98a91 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts (1 errors) ==== + interface I { + ["" + ""](): void; + ~~~~~~~~~ +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.js new file mode 100644 index 00000000000..c24eaf68a6f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.js @@ -0,0 +1,11 @@ +//// [computedPropertyNamesDeclarationEmit3_ES5.ts] +interface I { + ["" + ""](): void; +} + +//// [computedPropertyNamesDeclarationEmit3_ES5.js] + + +//// [computedPropertyNamesDeclarationEmit3_ES5.d.ts] +interface I { +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.errors.txt new file mode 100644 index 00000000000..99832a42e37 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES6.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES6.ts (1 errors) ==== + interface I { + ["" + ""](): void; + ~~~~~~~~~ +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.js new file mode 100644 index 00000000000..dc54ff2cbb2 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.js @@ -0,0 +1,11 @@ +//// [computedPropertyNamesDeclarationEmit3_ES6.ts] +interface I { + ["" + ""](): void; +} + +//// [computedPropertyNamesDeclarationEmit3_ES6.js] + + +//// [computedPropertyNamesDeclarationEmit3_ES6.d.ts] +interface I { +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt deleted file mode 100644 index 53eb057f8a1..00000000000 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts(2,5): error TS1170: Computed property names are not allowed in type literals. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts (1 errors) ==== - var v: { - ["" + ""](): void; - ~~~~~~~~~ -!!! error TS1170: Computed property names are not allowed in type literals. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.js deleted file mode 100644 index f68c1633ef9..00000000000 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.js +++ /dev/null @@ -1,12 +0,0 @@ -//// [computedPropertyNamesDeclarationEmit4.ts] -var v: { - ["" + ""](): void; -} - -//// [computedPropertyNamesDeclarationEmit4.js] -var v; - - -//// [computedPropertyNamesDeclarationEmit4.d.ts] -declare var v: { -}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.errors.txt new file mode 100644 index 00000000000..fd84ac72270 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts(2,5): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts (1 errors) ==== + var v: { + ["" + ""](): void; + ~~~~~~~~~ +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.js new file mode 100644 index 00000000000..c57c0384afc --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.js @@ -0,0 +1,12 @@ +//// [computedPropertyNamesDeclarationEmit4_ES5.ts] +var v: { + ["" + ""](): void; +} + +//// [computedPropertyNamesDeclarationEmit4_ES5.js] +var v; + + +//// [computedPropertyNamesDeclarationEmit4_ES5.d.ts] +declare var v: { +}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.errors.txt new file mode 100644 index 00000000000..7cdd26576cb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES6.ts(2,5): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES6.ts (1 errors) ==== + var v: { + ["" + ""](): void; + ~~~~~~~~~ +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.js new file mode 100644 index 00000000000..903687d0780 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.js @@ -0,0 +1,12 @@ +//// [computedPropertyNamesDeclarationEmit4_ES6.ts] +var v: { + ["" + ""](): void; +} + +//// [computedPropertyNamesDeclarationEmit4_ES6.js] +var v; + + +//// [computedPropertyNamesDeclarationEmit4_ES6.d.ts] +declare var v: { +}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js new file mode 100644 index 00000000000..a0666f166d4 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesDeclarationEmit5_ES5.ts] +var v = { + ["" + ""]: 0, + ["" + ""]() { }, + get ["" + ""]() { return 0; }, + set ["" + ""](x) { } +} + +//// [computedPropertyNamesDeclarationEmit5_ES5.js] +var v = (_a = {}, _a["" + ""] = +0, _a["" + ""] = function () { }, _a["" + ""] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a["" + ""] = Object.defineProperty({ set: function (x) { }, enumerable: true, configurable: true }), +_a); +var _a; + + +//// [computedPropertyNamesDeclarationEmit5_ES5.d.ts] +declare var v: {}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.types similarity index 87% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit5.types rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.types index c63d6d0d5c3..3f5a7355a20 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.types +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts === var v = { >v : {} >{ ["" + ""]: 0, ["" + ""]() { }, get ["" + ""]() { return 0; }, set ["" + ""](x) { }} : {} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.js similarity index 50% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit5.js rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.js index d59d84b9e72..e19ac43656e 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesDeclarationEmit5.ts] +//// [computedPropertyNamesDeclarationEmit5_ES6.ts] var v = { ["" + ""]: 0, ["" + ""]() { }, @@ -6,16 +6,14 @@ var v = { set ["" + ""](x) { } } -//// [computedPropertyNamesDeclarationEmit5.js] +//// [computedPropertyNamesDeclarationEmit5_ES6.js] var v = { ["" + ""]: 0, ["" + ""]() { }, - get ["" + ""]() { - return 0; - }, + get ["" + ""]() { return 0; }, set ["" + ""](x) { } }; -//// [computedPropertyNamesDeclarationEmit5.d.ts] +//// [computedPropertyNamesDeclarationEmit5_ES6.d.ts] declare var v: {}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.types new file mode 100644 index 00000000000..10b70587e32 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.types @@ -0,0 +1,18 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES6.ts === +var v = { +>v : {} +>{ ["" + ""]: 0, ["" + ""]() { }, get ["" + ""]() { return 0; }, set ["" + ""](x) { }} : {} + + ["" + ""]: 0, +>"" + "" : string + + ["" + ""]() { }, +>"" + "" : string + + get ["" + ""]() { return 0; }, +>"" + "" : string + + set ["" + ""](x) { } +>"" + "" : string +>x : any +} diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt b/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt deleted file mode 100644 index b3c2957a13f..00000000000 --- a/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(4,5): error TS1168: Computed property names are not allowed in method overloads. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(5,5): error TS1168: Computed property names are not allowed in method overloads. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts (2 errors) ==== - var methodName = "method"; - var accessorName = "accessor"; - class C { - [methodName](v: string); - ~~~~~~~~~~~~ -!!! error TS1168: Computed property names are not allowed in method overloads. - [methodName](); - ~~~~~~~~~~~~ -!!! error TS1168: Computed property names are not allowed in method overloads. - [methodName](v?: string) { } - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt new file mode 100644 index 00000000000..2a17d7da815 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts(4,5): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts(5,5): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts (2 errors) ==== + var methodName = "method"; + var accessorName = "accessor"; + class C { + [methodName](v: string); + ~~~~~~~~~~~~ +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. + [methodName](); + ~~~~~~~~~~~~ +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. + [methodName](v?: string) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads.js b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.js similarity index 75% rename from tests/baselines/reference/computedPropertyNamesOnOverloads.js rename to tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.js index 4312e533318..1470605413a 100644 --- a/tests/baselines/reference/computedPropertyNamesOnOverloads.js +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesOnOverloads.ts] +//// [computedPropertyNamesOnOverloads_ES5.ts] var methodName = "method"; var accessorName = "accessor"; class C { @@ -7,7 +7,7 @@ class C { [methodName](v?: string) { } } -//// [computedPropertyNamesOnOverloads.js] +//// [computedPropertyNamesOnOverloads_ES5.js] var methodName = "method"; var accessorName = "accessor"; var C = (function () { diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.errors.txt new file mode 100644 index 00000000000..381ee7c17ba --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.ts(4,5): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.ts(5,5): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.ts (2 errors) ==== + var methodName = "method"; + var accessorName = "accessor"; + class C { + [methodName](v: string); + ~~~~~~~~~~~~ +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. + [methodName](); + ~~~~~~~~~~~~ +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. + [methodName](v?: string) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.js b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.js new file mode 100644 index 00000000000..1cbddb58dc2 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.js @@ -0,0 +1,18 @@ +//// [computedPropertyNamesOnOverloads_ES6.ts] +var methodName = "method"; +var accessorName = "accessor"; +class C { + [methodName](v: string); + [methodName](); + [methodName](v?: string) { } +} + +//// [computedPropertyNamesOnOverloads_ES6.js] +var methodName = "method"; +var accessorName = "accessor"; +var C = (function () { + function C() { + } + C.prototype[methodName] = function (v) { }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap1.js.map deleted file mode 100644 index 5833df72f7f..00000000000 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [computedPropertyNamesSourceMap1.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap1.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1.ts"],"names":["C","C.constructor","C[\"hello\"]"],"mappings":"AAAA,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAIPC,CAACA;IAHGD,YAACA,OAAOA,CAACA,GAATA;QACIE,QAAQA,CAACA;IACbA,CAACA;IACLF,QAACA;AAADA,CAACA,AAJD,IAIC"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.js b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js similarity index 53% rename from tests/baselines/reference/computedPropertyNamesSourceMap1.js rename to tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js index b65e3f0ce5b..5b99f534002 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1.js +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js @@ -1,11 +1,11 @@ -//// [computedPropertyNamesSourceMap1.ts] +//// [computedPropertyNamesSourceMap1_ES5.ts] class C { ["hello"]() { debugger; } } -//// [computedPropertyNamesSourceMap1.js] +//// [computedPropertyNamesSourceMap1_ES5.js] var C = (function () { function C() { } @@ -14,4 +14,4 @@ var C = (function () { }; return C; })(); -//# sourceMappingURL=computedPropertyNamesSourceMap1.js.map \ No newline at end of file +//# sourceMappingURL=computedPropertyNamesSourceMap1_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js.map new file mode 100644 index 00000000000..f3881a54bd5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js.map @@ -0,0 +1,2 @@ +//// [computedPropertyNamesSourceMap1_ES5.js.map] +{"version":3,"file":"computedPropertyNamesSourceMap1_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1_ES5.ts"],"names":["C","C.constructor","C[\"hello\"]"],"mappings":"AAAA,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAIPC,CAACA;IAHGD,YAACA,OAAOA,CAACA,GAATA;QACIE,QAAQA,CAACA;IACbA,CAACA;IACLF,QAACA;AAADA,CAACA,AAJD,IAIC"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.sourcemap.txt similarity index 85% rename from tests/baselines/reference/computedPropertyNamesSourceMap1.sourcemap.txt rename to tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.sourcemap.txt index e806eee1aa7..607d51ca5dc 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.sourcemap.txt @@ -1,12 +1,12 @@ =================================================================== -JsFile: computedPropertyNamesSourceMap1.js -mapUrl: computedPropertyNamesSourceMap1.js.map +JsFile: computedPropertyNamesSourceMap1_ES5.js +mapUrl: computedPropertyNamesSourceMap1_ES5.js.map sourceRoot: -sources: computedPropertyNamesSourceMap1.ts +sources: computedPropertyNamesSourceMap1_ES5.ts =================================================================== ------------------------------------------------------------------- -emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1.js -sourceFile:computedPropertyNamesSourceMap1.ts +emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.js +sourceFile:computedPropertyNamesSourceMap1_ES5.ts ------------------------------------------------------------------- >>>var C = (function () { 1 > @@ -97,7 +97,7 @@ sourceFile:computedPropertyNamesSourceMap1.ts 2 >^ 3 > 4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 >} 3 > @@ -111,4 +111,4 @@ sourceFile:computedPropertyNamesSourceMap1.ts 3 >Emitted(8, 2) Source(1, 1) + SourceIndex(0) 4 >Emitted(8, 6) Source(5, 2) + SourceIndex(0) --- ->>>//# sourceMappingURL=computedPropertyNamesSourceMap1.js.map \ No newline at end of file +>>>//# sourceMappingURL=computedPropertyNamesSourceMap1_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.types b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.types similarity index 76% rename from tests/baselines/reference/computedPropertyNamesSourceMap1.types rename to tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.types index 54a2a9f19d0..1c57d97a7e8 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1.types +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts === class C { >C : C diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js new file mode 100644 index 00000000000..f7dc9e17836 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesSourceMap1_ES6.ts] +class C { + ["hello"]() { + debugger; + } +} + +//// [computedPropertyNamesSourceMap1_ES6.js] +var C = (function () { + function C() { + } + C.prototype["hello"] = function () { + debugger; + }; + return C; +})(); +//# sourceMappingURL=computedPropertyNamesSourceMap1_ES6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js.map new file mode 100644 index 00000000000..51154cc4676 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js.map @@ -0,0 +1,2 @@ +//// [computedPropertyNamesSourceMap1_ES6.js.map] +{"version":3,"file":"computedPropertyNamesSourceMap1_ES6.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1_ES6.ts"],"names":["C","C.constructor","C[\"hello\"]"],"mappings":"AAAA,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAIPC,CAACA;IAHGD,YAACA,OAAOA,CAACA,GAATA;QACIE,QAAQA,CAACA;IACbA,CAACA;IACLF,QAACA;AAADA,CAACA,AAJD,IAIC"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.sourcemap.txt new file mode 100644 index 00000000000..bb482f68cba --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.sourcemap.txt @@ -0,0 +1,114 @@ +=================================================================== +JsFile: computedPropertyNamesSourceMap1_ES6.js +mapUrl: computedPropertyNamesSourceMap1_ES6.js.map +sourceRoot: +sources: computedPropertyNamesSourceMap1_ES6.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES6.js +sourceFile:computedPropertyNamesSourceMap1_ES6.ts +------------------------------------------------------------------- +>>>var C = (function () { +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^-> +1 > +2 >class +3 > C +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 7) + SourceIndex(0) +3 >Emitted(1, 6) Source(1, 8) + SourceIndex(0) +--- +>>> function C() { +1->^^^^ +2 > ^^^^^^^^^ +3 > ^ +1-> +2 > class +3 > C +1->Emitted(2, 5) Source(1, 1) + SourceIndex(0) name (C) +2 >Emitted(2, 14) Source(1, 7) + SourceIndex(0) name (C) +3 >Emitted(2, 15) Source(1, 8) + SourceIndex(0) name (C) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > { + > ["hello"]() { + > debugger; + > } + > +2 > } +1 >Emitted(3, 5) Source(5, 1) + SourceIndex(0) name (C.constructor) +2 >Emitted(3, 6) Source(5, 2) + SourceIndex(0) name (C.constructor) +--- +>>> C.prototype["hello"] = function () { +1->^^^^ +2 > ^^^^^^^^^^^^ +3 > ^^^^^^^ +4 > ^ +5 > ^^^ +1-> +2 > [ +3 > "hello" +4 > ] +5 > +1->Emitted(4, 5) Source(2, 5) + SourceIndex(0) name (C) +2 >Emitted(4, 17) Source(2, 6) + SourceIndex(0) name (C) +3 >Emitted(4, 24) Source(2, 13) + SourceIndex(0) name (C) +4 >Emitted(4, 25) Source(2, 14) + SourceIndex(0) name (C) +5 >Emitted(4, 28) Source(2, 5) + SourceIndex(0) name (C) +--- +>>> debugger; +1 >^^^^^^^^ +2 > ^^^^^^^^ +3 > ^ +1 >["hello"]() { + > +2 > debugger +3 > ; +1 >Emitted(5, 9) Source(3, 9) + SourceIndex(0) name (C["hello"]) +2 >Emitted(5, 17) Source(3, 17) + SourceIndex(0) name (C["hello"]) +3 >Emitted(5, 18) Source(3, 18) + SourceIndex(0) name (C["hello"]) +--- +>>> }; +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(6, 5) Source(4, 5) + SourceIndex(0) name (C["hello"]) +2 >Emitted(6, 6) Source(4, 6) + SourceIndex(0) name (C["hello"]) +--- +>>> return C; +1->^^^^ +2 > ^^^^^^^^ +1-> + > +2 > } +1->Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (C) +2 >Emitted(7, 13) Source(5, 2) + SourceIndex(0) name (C) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class C { + > ["hello"]() { + > debugger; + > } + > } +1 >Emitted(8, 1) Source(5, 1) + SourceIndex(0) name (C) +2 >Emitted(8, 2) Source(5, 2) + SourceIndex(0) name (C) +3 >Emitted(8, 2) Source(1, 1) + SourceIndex(0) +4 >Emitted(8, 6) Source(5, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=computedPropertyNamesSourceMap1_ES6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.types b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.types new file mode 100644 index 00000000000..d5dc8a857a0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES6.ts === +class C { +>C : C + + ["hello"]() { + debugger; + } +} diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.js b/tests/baselines/reference/computedPropertyNamesSourceMap2.js deleted file mode 100644 index d967cb0d468..00000000000 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2.js +++ /dev/null @@ -1,14 +0,0 @@ -//// [computedPropertyNamesSourceMap2.ts] -var v = { - ["hello"]() { - debugger; - } -} - -//// [computedPropertyNamesSourceMap2.js] -var v = { - ["hello"]() { - debugger; - } -}; -//# sourceMappingURL=computedPropertyNamesSourceMap2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2.js.map deleted file mode 100644 index 6c485c24f6f..00000000000 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [computedPropertyNamesSourceMap2.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap2.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,CAAC,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;CACJ,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js new file mode 100644 index 00000000000..c5af22ef398 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js @@ -0,0 +1,14 @@ +//// [computedPropertyNamesSourceMap2_ES5.ts] +var v = { + ["hello"]() { + debugger; + } +} + +//// [computedPropertyNamesSourceMap2_ES5.js] +var v = (_a = {}, _a["hello"] = function () { + debugger; +}, +_a); +var _a; +//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map new file mode 100644 index 00000000000..82a729df957 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map @@ -0,0 +1,2 @@ +//// [computedPropertyNamesSourceMap2_ES5.js.map] +{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,AADA,CACA,EAAA,GADA,EAAA,EACA,EAAA,CACK,OAAO,CAFA,GAAA;IAGA,QAAQ,CAAC;AACb,CAAC,AAJA;AACA,EAAA,AADA,CAKA,CAAA;IAJD,EAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt new file mode 100644 index 00000000000..33a3a2b4c2c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt @@ -0,0 +1,160 @@ +=================================================================== +JsFile: computedPropertyNamesSourceMap2_ES5.js +mapUrl: computedPropertyNamesSourceMap2_ES5.js.map +sourceRoot: +sources: computedPropertyNamesSourceMap2_ES5.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.js +sourceFile:computedPropertyNamesSourceMap2_ES5.ts +------------------------------------------------------------------- +>>>var v = (_a = {}, _a["hello"] = function () { +1 > +2 >^^^^ +3 > ^ +4 > ^^^ +5 > +6 > ^ +7 > ^^ +8 > ^^^ +9 > ^^ +10> ^^ +11> ^^ +12> ^ +13> ^^^^^^^ +14> ^ +15> ^^^ +1 > +2 >var +3 > v +4 > = +5 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 9) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 9) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +5 > +6 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 9) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 10) Source(1, 1) + SourceIndex(0) nameIndex (-1) +6 > +7 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +7 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 10) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 12) Source(1, 1) + SourceIndex(0) nameIndex (-1) +7 > +8 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +8 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 12) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 15) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +8 > +9 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +9 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 17) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +9 > +10> !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +10> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 19) Source(1, 1) + SourceIndex(0) nameIndex (-1) +10> +11> !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +11> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 21) Source(1, 1) + SourceIndex(0) nameIndex (-1) +11> +12> !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +12> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 22) Source(2, 6) + SourceIndex(0) nameIndex (-1) +12> var v = { + > [ +13> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +13> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 19) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 29) Source(2, 13) + SourceIndex(0) nameIndex (-1) +13> "hello" +14> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +14> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 21) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 30) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +14> +15> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +15> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 22) Source(2, 14) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 33) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +15> +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) +5 >Emitted(1, 9) Source(0, NaN) + SourceIndex(0) +6 >Emitted(1, 10) Source(1, 1) + SourceIndex(0) +7 >Emitted(1, 12) Source(1, 1) + SourceIndex(0) +8 >Emitted(1, 15) Source(0, NaN) + SourceIndex(0) +9 >Emitted(1, 17) Source(0, NaN) + SourceIndex(0) +10>Emitted(1, 19) Source(1, 1) + SourceIndex(0) +11>Emitted(1, 21) Source(1, 1) + SourceIndex(0) +12>Emitted(1, 22) Source(2, 6) + SourceIndex(0) +13>Emitted(1, 29) Source(2, 13) + SourceIndex(0) +14>Emitted(1, 30) Source(0, NaN) + SourceIndex(0) +15>Emitted(1, 33) Source(0, NaN) + SourceIndex(0) +--- +>>> debugger; +1 >^^^^ +2 > ^^^^^^^^ +3 > ^ +1 >!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 29) Source(2, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 5) Source(3, 9) + SourceIndex(0) nameIndex (-1) +1 > +2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 30) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 13) Source(3, 17) + SourceIndex(0) nameIndex (-1) +2 > debugger +3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 30) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 14) Source(3, 18) + SourceIndex(0) nameIndex (-1) +3 > ; +1 >Emitted(2, 5) Source(3, 9) + SourceIndex(0) +2 >Emitted(2, 13) Source(3, 17) + SourceIndex(0) +3 >Emitted(2, 14) Source(3, 18) + SourceIndex(0) +--- +>>>}, +1 > +2 >^ +3 > +4 > ^^^^-> +1 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 33) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 1) Source(4, 5) + SourceIndex(0) nameIndex (-1) +1 > + > +2 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +2 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 33) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 2) Source(4, 6) + SourceIndex(0) nameIndex (-1) +2 >} +3 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 5) Source(3, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 2) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +3 > +1 >Emitted(3, 1) Source(4, 5) + SourceIndex(0) +2 >Emitted(3, 2) Source(4, 6) + SourceIndex(0) +3 >Emitted(3, 2) Source(0, NaN) + SourceIndex(0) +--- +>>>_a); +1-> +2 >^^ +3 > +4 > ^ +5 > ^ +6 > ^^^^-> +1->!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 13) Source(3, 29) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 1) Source(1, 1) + SourceIndex(0) nameIndex (-1) +1-> +2 >!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +2 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 14) Source(3, 30) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 3) Source(1, 1) + SourceIndex(0) nameIndex (-1) +2 > +3 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 1) Source(4, 17) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 3) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +3 > +4 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(4, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 4) Source(5, 2) + SourceIndex(0) nameIndex (-1) +4 > +5 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 5) Source(5, 2) + SourceIndex(0) nameIndex (-1) +5 > +1->Emitted(4, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(4, 3) Source(1, 1) + SourceIndex(0) +3 >Emitted(4, 3) Source(0, NaN) + SourceIndex(0) +4 >Emitted(4, 4) Source(5, 2) + SourceIndex(0) +5 >Emitted(4, 5) Source(5, 2) + SourceIndex(0) +--- +>>>var _a; +1->^^^^ +2 > ^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1->!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1) +1-> +2 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(4, 1) Source(1, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1) +2 > +1->Emitted(5, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(5, 7) Source(1, 1) + SourceIndex(0) +--- +!!!! **** There are more source map entries in the sourceMap's mapping than what was encoded +!!!! **** Remaining decoded string: ,EAAA,AADA,CAKA,CAAA;IAJD,EAAA +>>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.types b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.types similarity index 81% rename from tests/baselines/reference/computedPropertyNamesSourceMap2.types rename to tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.types index 972259eb3e2..1dcc49a8fae 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2.types +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts === var v = { >v : {} >{ ["hello"]() { debugger; }} : {} diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js new file mode 100644 index 00000000000..3d0274e65c7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js @@ -0,0 +1,14 @@ +//// [computedPropertyNamesSourceMap2_ES6.ts] +var v = { + ["hello"]() { + debugger; + } +} + +//// [computedPropertyNamesSourceMap2_ES6.js] +var v = { + ["hello"]() { + debugger; + } +}; +//# sourceMappingURL=computedPropertyNamesSourceMap2_ES6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js.map new file mode 100644 index 00000000000..251171232e0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js.map @@ -0,0 +1,2 @@ +//// [computedPropertyNamesSourceMap2_ES6.js.map] +{"version":3,"file":"computedPropertyNamesSourceMap2_ES6.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES6.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,CAAC,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;CACJ,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.sourcemap.txt similarity index 79% rename from tests/baselines/reference/computedPropertyNamesSourceMap2.sourcemap.txt rename to tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.sourcemap.txt index 29f11b95e1f..48149aee0b5 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.sourcemap.txt @@ -1,12 +1,12 @@ =================================================================== -JsFile: computedPropertyNamesSourceMap2.js -mapUrl: computedPropertyNamesSourceMap2.js.map +JsFile: computedPropertyNamesSourceMap2_ES6.js +mapUrl: computedPropertyNamesSourceMap2_ES6.js.map sourceRoot: -sources: computedPropertyNamesSourceMap2.ts +sources: computedPropertyNamesSourceMap2_ES6.ts =================================================================== ------------------------------------------------------------------- -emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2.js -sourceFile:computedPropertyNamesSourceMap2.ts +emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.js +sourceFile:computedPropertyNamesSourceMap2_ES6.ts ------------------------------------------------------------------- >>>var v = { 1 > @@ -63,11 +63,11 @@ sourceFile:computedPropertyNamesSourceMap2.ts >>>}; 1 >^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > >} 2 > 1 >Emitted(5, 2) Source(5, 2) + SourceIndex(0) 2 >Emitted(5, 3) Source(5, 2) + SourceIndex(0) --- ->>>//# sourceMappingURL=computedPropertyNamesSourceMap2.js.map \ No newline at end of file +>>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.types b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.types new file mode 100644 index 00000000000..9a1c71364a2 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.ts === +var v = { +>v : {} +>{ ["hello"]() { debugger; }} : {} + + ["hello"]() { + debugger; + } +} diff --git a/tests/baselines/reference/conditionalExpressions2.js b/tests/baselines/reference/conditionalExpressions2.js index b8870b564ec..6749a2c0ac0 100644 --- a/tests/baselines/reference/conditionalExpressions2.js +++ b/tests/baselines/reference/conditionalExpressions2.js @@ -18,11 +18,9 @@ var e = false ? "foo" : "bar"; var f = false ? null : undefined; var g = true ? { g: 5 } : null; var h = [{ h: 5 }, null]; -function i() { - if (true) { - return { x: 5 }; - } - else { - return null; - } +function i() { if (true) { + return { x: 5 }; } +else { + return null; +} } diff --git a/tests/baselines/reference/conditionalOperatorConditionIsNumberType.js b/tests/baselines/reference/conditionalOperatorConditionIsNumberType.js index 46a04169e93..f8fbe708e1a 100644 --- a/tests/baselines/reference/conditionalOperatorConditionIsNumberType.js +++ b/tests/baselines/reference/conditionalOperatorConditionIsNumberType.js @@ -91,9 +91,7 @@ condNumber ? exprString1 : exprBoolean1; // Union 1000000000000 ? exprIsObject1 : exprIsObject2; 10000 ? exprString1 : exprBoolean1; // Union //Cond is a number type expression -function foo() { - return 1; -} +function foo() { return 1; } ; var array = [1, 2, 3]; 1 * 0 ? exprAny1 : exprAny2; diff --git a/tests/baselines/reference/conditionalOperatorConditoinIsStringType.js b/tests/baselines/reference/conditionalOperatorConditoinIsStringType.js index 02c398e89e1..dbd68d9f009 100644 --- a/tests/baselines/reference/conditionalOperatorConditoinIsStringType.js +++ b/tests/baselines/reference/conditionalOperatorConditoinIsStringType.js @@ -92,9 +92,7 @@ condString ? exprString1 : exprBoolean1; // union " " ? exprIsObject1 : exprIsObject2; "hello " ? exprString1 : exprBoolean1; // union //Cond is a string type expression -function foo() { - return "string"; -} +function foo() { return "string"; } ; var array = ["1", "2", "3"]; typeof condString ? exprAny1 : exprAny2; diff --git a/tests/baselines/reference/conflictingMemberTypesInBases.errors.txt b/tests/baselines/reference/conflictingMemberTypesInBases.errors.txt index 58fdcb4c7ae..07e7a64ec1f 100644 --- a/tests/baselines/reference/conflictingMemberTypesInBases.errors.txt +++ b/tests/baselines/reference/conflictingMemberTypesInBases.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/conflictingMemberTypesInBases.ts(12,11): error TS2320: Interface 'E' cannot simultaneously extend types 'B' and 'D'. - Named properties 'm' of types 'B' and 'D' are not identical. + Named property 'm' of types 'B' and 'D' are not identical. ==== tests/cases/compiler/conflictingMemberTypesInBases.ts (1 errors) ==== @@ -17,6 +17,6 @@ tests/cases/compiler/conflictingMemberTypesInBases.ts(12,11): error TS2320: Inte interface E extends B { } // Error here for extending B and D ~ !!! error TS2320: Interface 'E' cannot simultaneously extend types 'B' and 'D'. -!!! error TS2320: Named properties 'm' of types 'B' and 'D' are not identical. +!!! error TS2320: Named property 'm' of types 'B' and 'D' are not identical. interface E extends D { } // No duplicate error here \ No newline at end of file diff --git a/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.errors.txt b/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.errors.txt index 629cf7f75af..24af601139f 100644 --- a/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.errors.txt +++ b/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(7,9): error TS2451: Cannot redeclare block-scoped variable 'x'. -tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(15,13): error TS2451: Cannot redeclare block-scoped variable 'y'. -tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS2451: Cannot redeclare block-scoped variable 'z'. +tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(7,9): error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. +tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(15,13): error TS2481: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'. +tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS2481: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'. ==== tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts (3 errors) ==== @@ -12,7 +12,7 @@ tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS var x = 0; ~ -!!! error TS2451: Cannot redeclare block-scoped variable 'x'. +!!! error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. } @@ -22,7 +22,7 @@ tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS { var y = 0; ~ -!!! error TS2451: Cannot redeclare block-scoped variable 'y'. +!!! error TS2481: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'. } } @@ -31,5 +31,5 @@ tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS const z = 0; var z = 0 ~ -!!! error TS2451: Cannot redeclare block-scoped variable 'z'. +!!! error TS2481: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'. } \ No newline at end of file diff --git a/tests/baselines/reference/constEnumBadPropertyNames.errors.txt b/tests/baselines/reference/constEnumBadPropertyNames.errors.txt index 7cccf86b1c8..f2330617dea 100644 --- a/tests/baselines/reference/constEnumBadPropertyNames.errors.txt +++ b/tests/baselines/reference/constEnumBadPropertyNames.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/constEnumBadPropertyNames.ts(2,11): error TS4088: Property 'B' does not exist on 'const' enum 'E'. +tests/cases/compiler/constEnumBadPropertyNames.ts(2,11): error TS2479: Property 'B' does not exist on 'const' enum 'E'. ==== tests/cases/compiler/constEnumBadPropertyNames.ts (1 errors) ==== const enum E { A } var x = E["B"] ~~~ -!!! error TS4088: Property 'B' does not exist on 'const' enum 'E'. \ No newline at end of file +!!! error TS2479: Property 'B' does not exist on 'const' enum 'E'. \ No newline at end of file diff --git a/tests/baselines/reference/constEnumErrors.errors.txt b/tests/baselines/reference/constEnumErrors.errors.txt index 53fed12f382..be7dad54eeb 100644 --- a/tests/baselines/reference/constEnumErrors.errors.txt +++ b/tests/baselines/reference/constEnumErrors.errors.txt @@ -1,16 +1,16 @@ tests/cases/compiler/constEnumErrors.ts(1,12): error TS2300: Duplicate identifier 'E'. tests/cases/compiler/constEnumErrors.ts(5,8): error TS2300: Duplicate identifier 'E'. -tests/cases/compiler/constEnumErrors.ts(12,9): error TS4083: In 'const' enum declarations member initializer must be constant expression. -tests/cases/compiler/constEnumErrors.ts(14,9): error TS4083: In 'const' enum declarations member initializer must be constant expression. -tests/cases/compiler/constEnumErrors.ts(15,10): error TS4083: In 'const' enum declarations member initializer must be constant expression. -tests/cases/compiler/constEnumErrors.ts(22,13): error TS4085: A const enum member can only be accessed using a string literal. -tests/cases/compiler/constEnumErrors.ts(24,13): error TS4085: A const enum member can only be accessed using a string literal. -tests/cases/compiler/constEnumErrors.ts(26,9): error TS4084: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. -tests/cases/compiler/constEnumErrors.ts(27,10): error TS4084: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. -tests/cases/compiler/constEnumErrors.ts(32,5): error TS4084: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. -tests/cases/compiler/constEnumErrors.ts(40,9): error TS4086: 'const' enum member initializer was evaluated to a non-finite value. -tests/cases/compiler/constEnumErrors.ts(41,9): error TS4086: 'const' enum member initializer was evaluated to a non-finite value. -tests/cases/compiler/constEnumErrors.ts(42,9): error TS4087: 'const' enum member initializer was evaluated to disallowed value 'NaN'. +tests/cases/compiler/constEnumErrors.ts(12,9): error TS2474: In 'const' enum declarations member initializer must be constant expression. +tests/cases/compiler/constEnumErrors.ts(14,9): error TS2474: In 'const' enum declarations member initializer must be constant expression. +tests/cases/compiler/constEnumErrors.ts(15,10): error TS2474: In 'const' enum declarations member initializer must be constant expression. +tests/cases/compiler/constEnumErrors.ts(22,13): error TS2476: A const enum member can only be accessed using a string literal. +tests/cases/compiler/constEnumErrors.ts(24,13): error TS2476: A const enum member can only be accessed using a string literal. +tests/cases/compiler/constEnumErrors.ts(26,9): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +tests/cases/compiler/constEnumErrors.ts(27,10): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +tests/cases/compiler/constEnumErrors.ts(32,5): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +tests/cases/compiler/constEnumErrors.ts(40,9): error TS2477: 'const' enum member initializer was evaluated to a non-finite value. +tests/cases/compiler/constEnumErrors.ts(41,9): error TS2477: 'const' enum member initializer was evaluated to a non-finite value. +tests/cases/compiler/constEnumErrors.ts(42,9): error TS2478: 'const' enum member initializer was evaluated to disallowed value 'NaN'. ==== tests/cases/compiler/constEnumErrors.ts (13 errors) ==== @@ -31,14 +31,14 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS4087: 'const' enum member // forward reference to the element of the same enum X = Y, ~ -!!! error TS4083: In 'const' enum declarations member initializer must be constant expression. +!!! error TS2474: In 'const' enum declarations member initializer must be constant expression. // forward reference to the element of the same enum Y = E1.Z, ~~~~ -!!! error TS4083: In 'const' enum declarations member initializer must be constant expression. +!!! error TS2474: In 'const' enum declarations member initializer must be constant expression. Y1 = E1["Z"] ~~~~~~~ -!!! error TS4083: In 'const' enum declarations member initializer must be constant expression. +!!! error TS2474: In 'const' enum declarations member initializer must be constant expression. } const enum E2 { @@ -47,25 +47,25 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS4087: 'const' enum member var y0 = E2[1] ~ -!!! error TS4085: A const enum member can only be accessed using a string literal. +!!! error TS2476: A const enum member can only be accessed using a string literal. var name = "A"; var y1 = E2[name]; ~~~~ -!!! error TS4085: A const enum member can only be accessed using a string literal. +!!! error TS2476: A const enum member can only be accessed using a string literal. var x = E2; ~~ -!!! error TS4084: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +!!! error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. var y = [E2]; ~~ -!!! error TS4084: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +!!! error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. function foo(t: any): void { } foo(E2); ~~ -!!! error TS4084: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +!!! error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. const enum NaNOrInfinity { A = 9007199254740992, @@ -75,11 +75,11 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS4087: 'const' enum member E = D * D, F = E * E, // overflow ~~~~~ -!!! error TS4086: 'const' enum member initializer was evaluated to a non-finite value. +!!! error TS2477: 'const' enum member initializer was evaluated to a non-finite value. G = 1 / 0, // overflow ~~~~~ -!!! error TS4086: 'const' enum member initializer was evaluated to a non-finite value. +!!! error TS2477: 'const' enum member initializer was evaluated to a non-finite value. H = 0 / 0 // NaN ~~~~~ -!!! error TS4087: 'const' enum member initializer was evaluated to disallowed value 'NaN'. +!!! error TS2478: 'const' enum member initializer was evaluated to disallowed value 'NaN'. } \ No newline at end of file diff --git a/tests/baselines/reference/constraintSatisfactionWithAny.js b/tests/baselines/reference/constraintSatisfactionWithAny.js index 924c2ab1700..06d8b17690a 100644 --- a/tests/baselines/reference/constraintSatisfactionWithAny.js +++ b/tests/baselines/reference/constraintSatisfactionWithAny.js @@ -54,16 +54,10 @@ var c8 = new C4(b); //// [constraintSatisfactionWithAny.js] // any is not a valid type argument unless there is no constraint, or the constraint is any -function foo(x) { - return null; -} -function foo2(x) { - return null; -} +function foo(x) { return null; } +function foo2(x) { return null; } //function foo3(x: T): T { return null; } -function foo4(x) { - return null; -} +function foo4(x) { return null; } var a; foo(a); foo2(a); diff --git a/tests/baselines/reference/constructorAsType.js b/tests/baselines/reference/constructorAsType.js index 1f48f214dd4..9f8c14ce743 100644 --- a/tests/baselines/reference/constructorAsType.js +++ b/tests/baselines/reference/constructorAsType.js @@ -6,8 +6,6 @@ var Person2:{new() : {name:string;};}; Person = Person2; //// [constructorAsType.js] -var Person = function () { - return { name: "joe" }; -}; +var Person = function () { return { name: "joe" }; }; var Person2; Person = Person2; diff --git a/tests/baselines/reference/constructorOverloads7.js b/tests/baselines/reference/constructorOverloads7.js index b7e152c66e1..5b7e407e806 100644 --- a/tests/baselines/reference/constructorOverloads7.js +++ b/tests/baselines/reference/constructorOverloads7.js @@ -34,6 +34,4 @@ function Point(x, y) { this.y = y; return this; } -function EF1(a, b) { - return a + b; -} +function EF1(a, b) { return a + b; } diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js index 86338c1d913..cd31308311b 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js @@ -314,10 +314,12 @@ var TypeScriptAllInOne; Program.prototype.if = function (retValue) { if (retValue === void 0) { retValue = != 0; } return 1; - ^ retValue; + ^ + retValue; bfs.TYPES(); if (retValue != 0) { - return 1 && ; + return 1 && + ; } retValue = bfs.OPERATOR; ' );; @@ -348,7 +350,8 @@ var BasicFeatures = (function () { BasicFeatures.prototype.VARIABLES = function () { var local = Number.MAX_VALUE; var min = Number.MIN_VALUE; - var inf = Number.NEGATIVE_INFINITY - ; + var inf = Number.NEGATIVE_INFINITY - + ; var nan = Number.NaN; var undef = undefined; var _\uD4A5\u7204\uC316, uE59F = local; @@ -357,16 +360,16 @@ var BasicFeatures = (function () { var local6 = local5 instanceof fs.File; var hex = 0xBADC0DE, Hex = 0XDEADBEEF; var float = 6.02e23, float2 = 6.02E-23; - var char = 'c', \u0066 = '\u0066', hexchar = '\x42' != ; + var char = 'c', \u0066 = '\u0066', hexchar = '\x42' != + ; var quoted = '"', quoted2 = "'"; var reg = /\w*/; - var objLit = { "var": number = 42, equals: function (x) { - return x["var"] === 42; - }, instanceof: function () { return 'objLit{42}'; } }; + var objLit = { "var": number = 42, equals: function (x) { return x["var"] === 42; }, instanceof: function () { return 'objLit{42}'; } }; var weekday = 0 /* Monday */; var con = char + f + hexchar + float.toString() + float2.toString() + reg.toString() + objLit + weekday; // - var any = 0 ^= ; + var any = 0 ^= + ; var bool = 0; var declare = 0; var constructor = 0; @@ -382,7 +385,8 @@ var BasicFeatures = (function () { var public = 0; var set = 0; var static = 0; - var string = 0 / > ; + var string = 0 / > + ; var yield = 0; var sum3 = any + bool + declare + constructor + get + implements + interface + let + module + number + package + private + protected + public + set + static + string + yield; return 0; @@ -483,15 +487,10 @@ var BasicFeatures = (function () { })(); var CLASS = (function () { function CLASS() { - this.d = function () { - yield; - 0; - }; + this.d = function () { yield; 0; }; } Object.defineProperty(CLASS.prototype, "Property", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -499,9 +498,7 @@ var CLASS = (function () { return 0; }; CLASS.prototype.Foo = function () { - var myEvent = function () { - return 1; - }; + var myEvent = function () { return 1; }; if (myEvent() == 1) return true ? : ; else @@ -545,7 +542,8 @@ while () : string, ; rest: string[]; { - & public; + & + public; DefaultValue(value ? : string = "Hello"); { } } diff --git a/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.js b/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.js index bd76a746ac9..726d45bffe5 100644 --- a/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.js +++ b/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.js @@ -8,9 +8,7 @@ var x = h("", f()); // Call should succeed and x should be string. All t //// [contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.js] function f() { - function g(u) { - return null; - } + function g(u) { return null; } return g; } var h; diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js b/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js index b04c804ad7e..10672d86796 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js +++ b/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js @@ -150,26 +150,27 @@ var i1Ori2 = { propertyOnlyInI2: "Hello" }; var arrayI1OrI2 = [i1, i2, { - commonPropertyType: "hello", - commonMethodType: function (a) { return a; }, - commonMethodWithTypeParameter: function (a) { return a; }, - methodOnlyInI1: function (a) { return a; }, - propertyOnlyInI1: "Hello" -}, { - commonPropertyType: "hello", - commonMethodType: function (a) { return a; }, - commonMethodWithTypeParameter: function (a) { return a; }, - methodOnlyInI2: function (a) { return a; }, - propertyOnlyInI2: "Hello" -}, { - commonPropertyType: "hello", - commonMethodType: function (a) { return a; }, - commonMethodWithTypeParameter: function (a) { return a; }, - methodOnlyInI1: function (a) { return a; }, - propertyOnlyInI1: "Hello", - methodOnlyInI2: function (a) { return a; }, - propertyOnlyInI2: "Hello" -}]; + commonPropertyType: "hello", + commonMethodType: function (a) { return a; }, + commonMethodWithTypeParameter: function (a) { return a; }, + methodOnlyInI1: function (a) { return a; }, + propertyOnlyInI1: "Hello" + }, + { + commonPropertyType: "hello", + commonMethodType: function (a) { return a; }, + commonMethodWithTypeParameter: function (a) { return a; }, + methodOnlyInI2: function (a) { return a; }, + propertyOnlyInI2: "Hello" + }, { + commonPropertyType: "hello", + commonMethodType: function (a) { return a; }, + commonMethodWithTypeParameter: function (a) { return a; }, + methodOnlyInI1: function (a) { return a; }, + propertyOnlyInI1: "Hello", + methodOnlyInI2: function (a) { return a; }, + propertyOnlyInI2: "Hello" + }]; var i11; var i21; var i11Ori21 = i11; @@ -191,17 +192,17 @@ var i11Ori21 = { commonPropertyDifferentType: 10 }; var arrayOrI11OrI21 = [i11, i21, i11 || i21, { - // Like i1 - commonMethodDifferentReturnType: function (a, b) { - var z = a.charAt(b); - return z; - }, - commonPropertyDifferentType: "hello" -}, { - // Like i2 - commonMethodDifferentReturnType: function (a, b) { - var z = a.charCodeAt(b); - return z; - }, - commonPropertyDifferentType: 10 -}]; + // Like i1 + commonMethodDifferentReturnType: function (a, b) { + var z = a.charAt(b); + return z; + }, + commonPropertyDifferentType: "hello" + }, { + // Like i2 + commonMethodDifferentReturnType: function (a, b) { + var z = a.charCodeAt(b); + return z; + }, + commonPropertyDifferentType: 10 + }]; diff --git a/tests/baselines/reference/contextualTyping.js b/tests/baselines/reference/contextualTyping.js index 46e09d7f9e5..75b98b16c33 100644 --- a/tests/baselines/reference/contextualTyping.js +++ b/tests/baselines/reference/contextualTyping.js @@ -249,40 +249,24 @@ var C2T5; }; })(C2T5 || (C2T5 = {})); // CONTEXT: Variable declaration -var c3t1 = (function (s) { - return s; -}); +var c3t1 = (function (s) { return s; }); var c3t2 = ({ n: 1 }); var c3t3 = []; -var c3t4 = function () { - return ({}); -}; -var c3t5 = function (n) { - return ({}); -}; -var c3t6 = function (n, s) { - return ({}); -}; -var c3t7 = function (n) { - return n; -}; -var c3t8 = function (n) { - return n; -}; +var c3t4 = function () { return ({}); }; +var c3t5 = function (n) { return ({}); }; +var c3t6 = function (n, s) { return ({}); }; +var c3t7 = function (n) { return n; }; +var c3t8 = function (n) { return n; }; var c3t9 = [[], []]; var c3t10 = [({}), ({})]; -var c3t11 = [function (n, s) { - return s; -}]; +var c3t11 = [function (n, s) { return s; }]; var c3t12 = { foo: ({}) }; var c3t13 = ({ - f: function (i, s) { - return s; - } + f: function (i, s) { return s; } }); var c3t14 = ({ a: [] @@ -306,47 +290,29 @@ var C5T5; })(C5T5 || (C5T5 = {})); // CONTEXT: Variable assignment var c6t5; -c6t5 = function (n) { - return ({}); -}; +c6t5 = function (n) { return ({}); }; // CONTEXT: Array index assignment var c7t2; c7t2[0] = ({ n: 1 }); var objc8 = ({}); -objc8.t1 = (function (s) { - return s; -}); +objc8.t1 = (function (s) { return s; }); objc8.t2 = ({ n: 1 }); objc8.t3 = []; -objc8.t4 = function () { - return ({}); -}; -objc8.t5 = function (n) { - return ({}); -}; -objc8.t6 = function (n, s) { - return ({}); -}; -objc8.t7 = function (n) { - return n; -}; -objc8.t8 = function (n) { - return n; -}; +objc8.t4 = function () { return ({}); }; +objc8.t5 = function (n) { return ({}); }; +objc8.t6 = function (n, s) { return ({}); }; +objc8.t7 = function (n) { return n; }; +objc8.t8 = function (n) { return n; }; objc8.t9 = [[], []]; objc8.t10 = [({}), ({})]; -objc8.t11 = [function (n, s) { - return s; -}]; +objc8.t11 = [function (n, s) { return s; }]; objc8.t12 = { foo: ({}) }; objc8.t13 = ({ - f: function (i, s) { - return s; - } + f: function (i, s) { return s; } }); objc8.t14 = ({ a: [] @@ -358,11 +324,7 @@ c9t5(function (n) { return ({}); }); // CONTEXT: Return statement -var c10t5 = function () { - return function (n) { - return ({}); - }; -}; +var c10t5 = function () { return function (n) { return ({}); }; }; // CONTEXT: Newing a class var C11t5 = (function () { function C11t5(f) { @@ -370,51 +332,31 @@ var C11t5 = (function () { return C11t5; })(); ; -var i = new C11t5(function (n) { - return ({}); -}); +var i = new C11t5(function (n) { return ({}); }); // CONTEXT: Type annotated expression -var c12t1 = (function (s) { - return s; -}); +var c12t1 = (function (s) { return s; }); var c12t2 = ({ n: 1 }); var c12t3 = []; -var c12t4 = function () { - return ({}); -}; -var c12t5 = function (n) { - return ({}); -}; -var c12t6 = function (n, s) { - return ({}); -}; -var c12t7 = function (n) { - return n; -}; -var c12t8 = function (n) { - return n; -}; +var c12t4 = function () { return ({}); }; +var c12t5 = function (n) { return ({}); }; +var c12t6 = function (n, s) { return ({}); }; +var c12t7 = function (n) { return n; }; +var c12t8 = function (n) { return n; }; var c12t9 = [[], []]; var c12t10 = [({}), ({})]; -var c12t11 = [function (n, s) { - return s; -}]; +var c12t11 = [function (n, s) { return s; }]; var c12t12 = { foo: ({}) }; var c12t13 = ({ - f: function (i, s) { - return s; - } + f: function (i, s) { return s; } }); var c12t14 = ({ a: [] }); -function EF1(a, b) { - return a + b; -} +function EF1(a, b) { return a + b; } var efv = EF1(1, 2); function Point(x, y) { this.x = x; diff --git a/tests/baselines/reference/contextualTyping.js.map b/tests/baselines/reference/contextualTyping.js.map index 98c41439762..ba71b082ada 100644 --- a/tests/baselines/reference/contextualTyping.js.map +++ b/tests/baselines/reference/contextualTyping.js.map @@ -1,2 +1,2 @@ //// [contextualTyping.js.map] -{"version":3,"file":"contextualTyping.js","sourceRoot":"","sources":["contextualTyping.ts"],"names":["C1T5","C1T5.constructor","C2T5","C4T5","C4T5.constructor","C5T5","C11t5","C11t5.constructor","EF1","Point"],"mappings":"AAaA,AADA,sCAAsC;IAChC,IAAI;IAAVA,SAAMA,IAAIA;QACNC,QAAGA,GAAqCA,UAASA,CAACA;YAC9C,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IAADD,WAACA;AAADA,CAACA,AAJD,IAIC;AAGD,AADA,uCAAuC;AACvC,IAAO,IAAI,CAIV;AAJD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAGA,GAAqCA,UAASA,CAACA;QACzD,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EAJM,IAAI,KAAJ,IAAI,QAIV;AAGD,AADA,gCAAgC;IAC5B,IAAI,GAA0B,CAAC,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAA;AAAC,CAAC,CAAC,CAAC;AAC7D,IAAI,IAAI,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAA;AACF,IAAI,IAAI,GAAa,EAAE,CAAC;AACxB,IAAI,IAAI,GAAe;IAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AACxD,IAAI,IAAI,GAAwB,UAAS,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAClE,IAAI,IAAI,GAAmC,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAChF,IAAI,IAAI,GAGJ,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC;AAE9B,IAAI,IAAI,GAAqC,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC;AACvE,IAAI,IAAI,GAAe,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AAC/B,IAAI,KAAK,GAAW,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5C,IAAI,KAAK,GAAwC,CAAC,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC,CAAC;AAChF,IAAI,KAAK,GAAS;IACd,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC;QAAI,MAAM,CAAC,CAAC,CAAC;IAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAGF,AADA,qCAAqC;IAC/B,IAAI;IAENC,SAFEA,IAAIA;QAGFC,IAAIA,CAACA,GAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;YACpB,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IACLD,WAACA;AAADA,CAACA,AAPD,IAOC;AAGD,AADA,sCAAsC;AACtC,IAAO,IAAI,CAKV;AALD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAqCA,CAACA;IACjDA,QAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;QACf,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EALM,IAAI,KAAJ,IAAI,QAKV;AAGD,AADA,+BAA+B;IAC3B,IAAyB,CAAC;AAC9B,IAAI,GAAwB,UAAS,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAG9D,AADA,kCAAkC;IAC9B,IAAY,CAAC;AACjB,IAAI,CAAC,CAAC,CAAC,GAAS,CAAC,EAAC,CAAC,EAAE,CAAC,EAAC,CAAC,CAAC;AAuBzB,IAAI,KAAK,GAkBS,CAAC,EAAE,CAAC,CAAC;AAEvB,KAAK,CAAC,EAAE,GAAG,CAAC,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAA;AAAC,CAAC,CAAC,CAAC;AACtC,KAAK,CAAC,EAAE,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;AACd,KAAK,CAAC,EAAE,GAAG;IAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAC5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAC7C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAChD,KAAK,CAAC,EAAE,GAAG,UAAS,CAAS;IAAI,MAAM,CAAC,CAAC,CAAA;AAAC,CAAC,CAAC;AAE5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC;AACrC,KAAK,CAAC,EAAE,GAAG,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACnB,KAAK,CAAC,GAAG,GAAG,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,KAAK,CAAC,GAAG,GAAG,CAAC,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC,CAAC;AAC3C,KAAK,CAAC,GAAG,GAAG;IACR,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC;QAAI,MAAM,CAAC,CAAC,CAAC;IAAC,CAAC;CAClC,CAAC,CAAA;AACF,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAEF,AADA,yBAAyB;SAChB,IAAI,CAAC,CAAsB,KAAI;AAAA,CAAC;AACzC,IAAI,CAAC,UAAS,CAAC;IACX,MAAM,CAAO,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC,CAAC,CAAC;AAGH,AADA,4BAA4B;IACxB,KAAK,GAA8B;IAAa,MAAM,CAAC,UAAS,CAAC;QAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;IAAC,CAAC,CAAA;AAAC,CAAC,CAAC;AAG/F,AADA,0BAA0B;IACpB,KAAK;IAAGC,SAARA,KAAKA,CAAeA,CAAsBA;IAAIC,CAACA;IAACD,YAACA;AAADA,CAACA,AAAvD,IAAuD;AAAA,CAAC;AACxD,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,UAAS,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC,CAAC;AAGrD,AADA,qCAAqC;IACjC,KAAK,GAA2B,CAAC,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAA;AAAC,CAAC,CAAC,CAAC;AAC/D,IAAI,KAAK,GAAU,CAAC;IAChB,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,IAAI,KAAK,GAAc,EAAE,CAAC;AAC1B,IAAI,KAAK,GAAgB;IAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAC1D,IAAI,KAAK,GAAyB,UAAS,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AACpE,IAAI,KAAK,GAAoC,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAClF,IAAI,KAAK,GAGN,UAAS,CAAQ;IAAI,MAAM,CAAC,CAAC,CAAA;AAAC,CAAC,CAAC;AAEnC,IAAI,KAAK,GAAsC,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC;AACzE,IAAI,KAAK,GAAgB,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACjC,IAAI,MAAM,GAAY,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9C,IAAI,MAAM,GAAyC,CAAC,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC,CAAC;AAClF,IAAI,MAAM,GAAU;IAChB,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC;QAAI,MAAM,CAAC,CAAC,CAAC;IAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAOF,SAAS,GAAG,CAAC,CAAC,EAAC,CAAC;IAAIE,MAAMA,CAACA,CAACA,GAACA,CAACA,CAACA;AAACA,CAACA;AAEjC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;AAcnB,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC;IACfC,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IACXA,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IAEXA,MAAMA,CAACA,IAAIA,CAACA;AAChBA,CAACA;AAED,KAAK,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE/B,KAAK,CAAC,SAAS,CAAC,GAAG,GAAG,UAAS,EAAE,EAAE,EAAE;IACjC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,KAAK,CAAC,SAAS,GAAG;IACd,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,GAAG,EAAE,UAAS,EAAE,EAAE,EAAE;QAChB,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAC;AAIF,IAAI,CAAC,GAAM,EAAG,CAAC"} \ No newline at end of file +{"version":3,"file":"contextualTyping.js","sourceRoot":"","sources":["contextualTyping.ts"],"names":["C1T5","C1T5.constructor","C2T5","C4T5","C4T5.constructor","C5T5","C11t5","C11t5.constructor","EF1","Point"],"mappings":"AAaA,AADA,sCAAsC;IAChC,IAAI;IAAVA,SAAMA,IAAIA;QACNC,QAAGA,GAAqCA,UAASA,CAACA;YAC9C,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IAADD,WAACA;AAADA,CAACA,AAJD,IAIC;AAGD,AADA,uCAAuC;AACvC,IAAO,IAAI,CAIV;AAJD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAGA,GAAqCA,UAASA,CAACA;QACzD,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EAJM,IAAI,KAAJ,IAAI,QAIV;AAGD,AADA,gCAAgC;IAC5B,IAAI,GAA0B,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAC7D,IAAI,IAAI,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAA;AACF,IAAI,IAAI,GAAa,EAAE,CAAC;AACxB,IAAI,IAAI,GAAe,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AACxD,IAAI,IAAI,GAAwB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAClE,IAAI,IAAI,GAAmC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAChF,IAAI,IAAI,GAGJ,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9B,IAAI,IAAI,GAAqC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,IAAI,IAAI,GAAe,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AAC/B,IAAI,KAAK,GAAW,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5C,IAAI,KAAK,GAAwC,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,IAAI,KAAK,GAAS;IACd,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAGF,AADA,qCAAqC;IAC/B,IAAI;IAENC,SAFEA,IAAIA;QAGFC,IAAIA,CAACA,GAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;YACpB,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IACLD,WAACA;AAADA,CAACA,AAPD,IAOC;AAGD,AADA,sCAAsC;AACtC,IAAO,IAAI,CAKV;AALD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAqCA,CAACA;IACjDA,QAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;QACf,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EALM,IAAI,KAAJ,IAAI,QAKV;AAGD,AADA,+BAA+B;IAC3B,IAAyB,CAAC;AAC9B,IAAI,GAAwB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAG9D,AADA,kCAAkC;IAC9B,IAAY,CAAC;AACjB,IAAI,CAAC,CAAC,CAAC,GAAS,CAAC,EAAC,CAAC,EAAE,CAAC,EAAC,CAAC,CAAC;AAuBzB,IAAI,KAAK,GAkBS,CAAC,EAAE,CAAC,CAAC;AAEvB,KAAK,CAAC,EAAE,GAAG,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AACtC,KAAK,CAAC,EAAE,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;AACd,KAAK,CAAC,EAAE,GAAG,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC7C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAChD,KAAK,CAAC,EAAE,GAAG,UAAS,CAAS,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAE5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,KAAK,CAAC,EAAE,GAAG,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACnB,KAAK,CAAC,GAAG,GAAG,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,KAAK,CAAC,GAAG,GAAG,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3C,KAAK,CAAC,GAAG,GAAG;IACR,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAEF,AADA,yBAAyB;SAChB,IAAI,CAAC,CAAsB,KAAI;AAAA,CAAC;AACzC,IAAI,CAAC,UAAS,CAAC;IACX,MAAM,CAAO,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC,CAAC,CAAC;AAGH,AADA,4BAA4B;IACxB,KAAK,GAA8B,cAAa,MAAM,CAAC,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAG/F,AADA,0BAA0B;IACpB,KAAK;IAAGC,SAARA,KAAKA,CAAeA,CAAsBA;IAAIC,CAACA;IAACD,YAACA;AAADA,CAACA,AAAvD,IAAuD;AAAA,CAAC;AACxD,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAGrD,AADA,qCAAqC;IACjC,KAAK,GAA2B,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAC/D,IAAI,KAAK,GAAU,CAAC;IAChB,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,IAAI,KAAK,GAAc,EAAE,CAAC;AAC1B,IAAI,KAAK,GAAgB,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC1D,IAAI,KAAK,GAAyB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AACpE,IAAI,KAAK,GAAoC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAClF,IAAI,KAAK,GAGN,UAAS,CAAQ,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAEnC,IAAI,KAAK,GAAsC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzE,IAAI,KAAK,GAAgB,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACjC,IAAI,MAAM,GAAY,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9C,IAAI,MAAM,GAAyC,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClF,IAAI,MAAM,GAAU;IAChB,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAOF,SAAS,GAAG,CAAC,CAAC,EAAC,CAAC,IAAIE,MAAMA,CAACA,CAACA,GAACA,CAACA,CAACA,CAACA,CAACA;AAEjC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;AAcnB,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC;IACfC,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IACXA,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IAEXA,MAAMA,CAACA,IAAIA,CAACA;AAChBA,CAACA;AAED,KAAK,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE/B,KAAK,CAAC,SAAS,CAAC,GAAG,GAAG,UAAS,EAAE,EAAE,EAAE;IACjC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,KAAK,CAAC,SAAS,GAAG;IACd,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,GAAG,EAAE,UAAS,EAAE,EAAE,EAAE;QAChB,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAC;AAIF,IAAI,CAAC,GAAM,EAAG,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping.sourcemap.txt b/tests/baselines/reference/contextualTyping.sourcemap.txt index 6f9c9d2c1ec..5843e0f3f24 100644 --- a/tests/baselines/reference/contextualTyping.sourcemap.txt +++ b/tests/baselines/reference/contextualTyping.sourcemap.txt @@ -273,6 +273,7 @@ sourceFile:contextualTyping.ts 1-> 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^-> 1-> > >// CONTEXT: Variable declaration @@ -283,76 +284,71 @@ sourceFile:contextualTyping.ts 2 >Emitted(17, 1) Source(27, 1) + SourceIndex(0) 3 >Emitted(17, 33) Source(27, 33) + SourceIndex(0) --- ->>>var c3t1 = (function (s) { -1 >^^^^ +>>>var c3t1 = (function (s) { return s; }); +1->^^^^ 2 > ^^^^ 3 > ^^^ 4 > ^ 5 > ^^^^^^^^^^ 6 > ^ -1 > +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ +1-> >var 2 > c3t1 3 > : (s: string) => string = 4 > ( 5 > function( 6 > s -1 >Emitted(18, 5) Source(28, 5) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> s +11> +12> +13> } +14> ) +15> ; +1->Emitted(18, 5) Source(28, 5) + SourceIndex(0) 2 >Emitted(18, 9) Source(28, 9) + SourceIndex(0) 3 >Emitted(18, 12) Source(28, 35) + SourceIndex(0) 4 >Emitted(18, 13) Source(28, 36) + SourceIndex(0) 5 >Emitted(18, 23) Source(28, 45) + SourceIndex(0) 6 >Emitted(18, 24) Source(28, 46) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > -1 >Emitted(19, 5) Source(28, 50) + SourceIndex(0) -2 >Emitted(19, 11) Source(28, 56) + SourceIndex(0) -3 >Emitted(19, 12) Source(28, 57) + SourceIndex(0) -4 >Emitted(19, 13) Source(28, 58) + SourceIndex(0) -5 >Emitted(19, 14) Source(28, 58) + SourceIndex(0) ---- ->>>}); -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^-> -1 > -2 >} -3 > ) -4 > ; -1 >Emitted(20, 1) Source(28, 59) + SourceIndex(0) -2 >Emitted(20, 2) Source(28, 60) + SourceIndex(0) -3 >Emitted(20, 3) Source(28, 61) + SourceIndex(0) -4 >Emitted(20, 4) Source(28, 62) + SourceIndex(0) +7 >Emitted(18, 28) Source(28, 50) + SourceIndex(0) +8 >Emitted(18, 34) Source(28, 56) + SourceIndex(0) +9 >Emitted(18, 35) Source(28, 57) + SourceIndex(0) +10>Emitted(18, 36) Source(28, 58) + SourceIndex(0) +11>Emitted(18, 37) Source(28, 58) + SourceIndex(0) +12>Emitted(18, 38) Source(28, 59) + SourceIndex(0) +13>Emitted(18, 39) Source(28, 60) + SourceIndex(0) +14>Emitted(18, 40) Source(28, 61) + SourceIndex(0) +15>Emitted(18, 41) Source(28, 62) + SourceIndex(0) --- >>>var c3t2 = ({ -1-> +1 > 2 >^^^^ 3 > ^^^^ 4 > ^^^ 5 > ^ -1-> +1 > > 2 >var 3 > c3t2 4 > = 5 > ( -1->Emitted(21, 1) Source(29, 1) + SourceIndex(0) -2 >Emitted(21, 5) Source(29, 5) + SourceIndex(0) -3 >Emitted(21, 9) Source(29, 9) + SourceIndex(0) -4 >Emitted(21, 12) Source(29, 18) + SourceIndex(0) -5 >Emitted(21, 13) Source(29, 19) + SourceIndex(0) +1 >Emitted(19, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(19, 5) Source(29, 5) + SourceIndex(0) +3 >Emitted(19, 9) Source(29, 9) + SourceIndex(0) +4 >Emitted(19, 12) Source(29, 18) + SourceIndex(0) +5 >Emitted(19, 13) Source(29, 19) + SourceIndex(0) --- >>> n: 1 1 >^^^^ @@ -364,10 +360,10 @@ sourceFile:contextualTyping.ts 2 > n 3 > : 4 > 1 -1 >Emitted(22, 5) Source(30, 5) + SourceIndex(0) -2 >Emitted(22, 6) Source(30, 6) + SourceIndex(0) -3 >Emitted(22, 8) Source(30, 8) + SourceIndex(0) -4 >Emitted(22, 9) Source(30, 9) + SourceIndex(0) +1 >Emitted(20, 5) Source(30, 5) + SourceIndex(0) +2 >Emitted(20, 6) Source(30, 6) + SourceIndex(0) +3 >Emitted(20, 8) Source(30, 8) + SourceIndex(0) +4 >Emitted(20, 9) Source(30, 9) + SourceIndex(0) --- >>>}); 1 >^ @@ -378,9 +374,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(23, 2) Source(31, 2) + SourceIndex(0) -2 >Emitted(23, 3) Source(31, 3) + SourceIndex(0) -3 >Emitted(23, 4) Source(31, 3) + SourceIndex(0) +1 >Emitted(21, 2) Source(31, 2) + SourceIndex(0) +2 >Emitted(21, 3) Source(31, 3) + SourceIndex(0) +3 >Emitted(21, 4) Source(31, 3) + SourceIndex(0) --- >>>var c3t3 = []; 1-> @@ -389,7 +385,7 @@ sourceFile:contextualTyping.ts 4 > ^^^ 5 > ^^ 6 > ^ -7 > ^^^^^^^^^^^-> +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -397,71 +393,77 @@ sourceFile:contextualTyping.ts 4 > : number[] = 5 > [] 6 > ; -1->Emitted(24, 1) Source(32, 1) + SourceIndex(0) -2 >Emitted(24, 5) Source(32, 5) + SourceIndex(0) -3 >Emitted(24, 9) Source(32, 9) + SourceIndex(0) -4 >Emitted(24, 12) Source(32, 22) + SourceIndex(0) -5 >Emitted(24, 14) Source(32, 24) + SourceIndex(0) -6 >Emitted(24, 15) Source(32, 25) + SourceIndex(0) +1->Emitted(22, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(22, 5) Source(32, 5) + SourceIndex(0) +3 >Emitted(22, 9) Source(32, 9) + SourceIndex(0) +4 >Emitted(22, 12) Source(32, 22) + SourceIndex(0) +5 >Emitted(22, 14) Source(32, 24) + SourceIndex(0) +6 >Emitted(22, 15) Source(32, 25) + SourceIndex(0) --- ->>>var c3t4 = function () { +>>>var c3t4 = function () { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ -5 > ^^^^^^-> +5 > ^^^^^^^^^^^^^^ +6 > ^^^^^^ +7 > ^ +8 > ^ +9 > ^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^^-> 1-> > 2 >var 3 > c3t4 4 > : () => IFoo = -1->Emitted(25, 1) Source(33, 1) + SourceIndex(0) -2 >Emitted(25, 5) Source(33, 5) + SourceIndex(0) -3 >Emitted(25, 9) Source(33, 9) + SourceIndex(0) -4 >Emitted(25, 12) Source(33, 24) + SourceIndex(0) +5 > function() { +6 > return +7 > +8 > ( +9 > {} +10> ) +11> +12> +13> } +14> ; +1->Emitted(23, 1) Source(33, 1) + SourceIndex(0) +2 >Emitted(23, 5) Source(33, 5) + SourceIndex(0) +3 >Emitted(23, 9) Source(33, 9) + SourceIndex(0) +4 >Emitted(23, 12) Source(33, 24) + SourceIndex(0) +5 >Emitted(23, 26) Source(33, 37) + SourceIndex(0) +6 >Emitted(23, 32) Source(33, 43) + SourceIndex(0) +7 >Emitted(23, 33) Source(33, 50) + SourceIndex(0) +8 >Emitted(23, 34) Source(33, 51) + SourceIndex(0) +9 >Emitted(23, 36) Source(33, 53) + SourceIndex(0) +10>Emitted(23, 37) Source(33, 54) + SourceIndex(0) +11>Emitted(23, 38) Source(33, 54) + SourceIndex(0) +12>Emitted(23, 39) Source(33, 55) + SourceIndex(0) +13>Emitted(23, 40) Source(33, 56) + SourceIndex(0) +14>Emitted(23, 41) Source(33, 57) + SourceIndex(0) --- ->>> return ({}); -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1->function() { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1->Emitted(26, 5) Source(33, 37) + SourceIndex(0) -2 >Emitted(26, 11) Source(33, 43) + SourceIndex(0) -3 >Emitted(26, 12) Source(33, 50) + SourceIndex(0) -4 >Emitted(26, 13) Source(33, 51) + SourceIndex(0) -5 >Emitted(26, 15) Source(33, 53) + SourceIndex(0) -6 >Emitted(26, 16) Source(33, 54) + SourceIndex(0) -7 >Emitted(26, 17) Source(33, 54) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(27, 1) Source(33, 55) + SourceIndex(0) -2 >Emitted(27, 2) Source(33, 56) + SourceIndex(0) -3 >Emitted(27, 3) Source(33, 57) + SourceIndex(0) ---- ->>>var c3t5 = function (n) { +>>>var c3t5 = function (n) { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^^^^-> 1-> > 2 >var @@ -469,49 +471,34 @@ sourceFile:contextualTyping.ts 4 > : (n: number) => IFoo = 5 > function( 6 > n -1->Emitted(28, 1) Source(34, 1) + SourceIndex(0) -2 >Emitted(28, 5) Source(34, 5) + SourceIndex(0) -3 >Emitted(28, 9) Source(34, 9) + SourceIndex(0) -4 >Emitted(28, 12) Source(34, 33) + SourceIndex(0) -5 >Emitted(28, 22) Source(34, 42) + SourceIndex(0) -6 >Emitted(28, 23) Source(34, 43) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> ( +11> {} +12> ) +13> +14> +15> } +16> ; +1->Emitted(24, 1) Source(34, 1) + SourceIndex(0) +2 >Emitted(24, 5) Source(34, 5) + SourceIndex(0) +3 >Emitted(24, 9) Source(34, 9) + SourceIndex(0) +4 >Emitted(24, 12) Source(34, 33) + SourceIndex(0) +5 >Emitted(24, 22) Source(34, 42) + SourceIndex(0) +6 >Emitted(24, 23) Source(34, 43) + SourceIndex(0) +7 >Emitted(24, 27) Source(34, 47) + SourceIndex(0) +8 >Emitted(24, 33) Source(34, 53) + SourceIndex(0) +9 >Emitted(24, 34) Source(34, 60) + SourceIndex(0) +10>Emitted(24, 35) Source(34, 61) + SourceIndex(0) +11>Emitted(24, 37) Source(34, 63) + SourceIndex(0) +12>Emitted(24, 38) Source(34, 64) + SourceIndex(0) +13>Emitted(24, 39) Source(34, 64) + SourceIndex(0) +14>Emitted(24, 40) Source(34, 65) + SourceIndex(0) +15>Emitted(24, 41) Source(34, 66) + SourceIndex(0) +16>Emitted(24, 42) Source(34, 67) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(29, 5) Source(34, 47) + SourceIndex(0) -2 >Emitted(29, 11) Source(34, 53) + SourceIndex(0) -3 >Emitted(29, 12) Source(34, 60) + SourceIndex(0) -4 >Emitted(29, 13) Source(34, 61) + SourceIndex(0) -5 >Emitted(29, 15) Source(34, 63) + SourceIndex(0) -6 >Emitted(29, 16) Source(34, 64) + SourceIndex(0) -7 >Emitted(29, 17) Source(34, 64) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(30, 1) Source(34, 65) + SourceIndex(0) -2 >Emitted(30, 2) Source(34, 66) + SourceIndex(0) -3 >Emitted(30, 3) Source(34, 67) + SourceIndex(0) ---- ->>>var c3t6 = function (n, s) { +>>>var c3t6 = function (n, s) { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^ @@ -520,6 +507,16 @@ sourceFile:contextualTyping.ts 6 > ^ 7 > ^^ 8 > ^ +9 > ^^^^ +10> ^^^^^^ +11> ^ +12> ^ +13> ^^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ 1-> > 2 >var @@ -529,58 +526,52 @@ sourceFile:contextualTyping.ts 6 > n 7 > , 8 > s -1->Emitted(31, 1) Source(35, 1) + SourceIndex(0) -2 >Emitted(31, 5) Source(35, 5) + SourceIndex(0) -3 >Emitted(31, 9) Source(35, 9) + SourceIndex(0) -4 >Emitted(31, 12) Source(35, 44) + SourceIndex(0) -5 >Emitted(31, 22) Source(35, 53) + SourceIndex(0) -6 >Emitted(31, 23) Source(35, 54) + SourceIndex(0) -7 >Emitted(31, 25) Source(35, 56) + SourceIndex(0) -8 >Emitted(31, 26) Source(35, 57) + SourceIndex(0) +9 > ) { +10> return +11> +12> ( +13> {} +14> ) +15> +16> +17> } +18> ; +1->Emitted(25, 1) Source(35, 1) + SourceIndex(0) +2 >Emitted(25, 5) Source(35, 5) + SourceIndex(0) +3 >Emitted(25, 9) Source(35, 9) + SourceIndex(0) +4 >Emitted(25, 12) Source(35, 44) + SourceIndex(0) +5 >Emitted(25, 22) Source(35, 53) + SourceIndex(0) +6 >Emitted(25, 23) Source(35, 54) + SourceIndex(0) +7 >Emitted(25, 25) Source(35, 56) + SourceIndex(0) +8 >Emitted(25, 26) Source(35, 57) + SourceIndex(0) +9 >Emitted(25, 30) Source(35, 61) + SourceIndex(0) +10>Emitted(25, 36) Source(35, 67) + SourceIndex(0) +11>Emitted(25, 37) Source(35, 74) + SourceIndex(0) +12>Emitted(25, 38) Source(35, 75) + SourceIndex(0) +13>Emitted(25, 40) Source(35, 77) + SourceIndex(0) +14>Emitted(25, 41) Source(35, 78) + SourceIndex(0) +15>Emitted(25, 42) Source(35, 78) + SourceIndex(0) +16>Emitted(25, 43) Source(35, 79) + SourceIndex(0) +17>Emitted(25, 44) Source(35, 80) + SourceIndex(0) +18>Emitted(25, 45) Source(35, 81) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(32, 5) Source(35, 61) + SourceIndex(0) -2 >Emitted(32, 11) Source(35, 67) + SourceIndex(0) -3 >Emitted(32, 12) Source(35, 74) + SourceIndex(0) -4 >Emitted(32, 13) Source(35, 75) + SourceIndex(0) -5 >Emitted(32, 15) Source(35, 77) + SourceIndex(0) -6 >Emitted(32, 16) Source(35, 78) + SourceIndex(0) -7 >Emitted(32, 17) Source(35, 78) + SourceIndex(0) ---- ->>>}; +>>>var c3t7 = function (n) { return n; }; 1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(33, 1) Source(35, 79) + SourceIndex(0) -2 >Emitted(33, 2) Source(35, 80) + SourceIndex(0) -3 >Emitted(33, 3) Source(35, 81) + SourceIndex(0) ---- ->>>var c3t7 = function (n) { -1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ -1-> +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^-> +1 > > 2 >var 3 > c3t7 @@ -590,49 +581,44 @@ sourceFile:contextualTyping.ts > } = 5 > function( 6 > n -1->Emitted(34, 1) Source(36, 1) + SourceIndex(0) -2 >Emitted(34, 5) Source(36, 5) + SourceIndex(0) -3 >Emitted(34, 9) Source(36, 9) + SourceIndex(0) -4 >Emitted(34, 12) Source(39, 5) + SourceIndex(0) -5 >Emitted(34, 22) Source(39, 14) + SourceIndex(0) -6 >Emitted(34, 23) Source(39, 15) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> n +11> ; +12> +13> } +14> ; +1 >Emitted(26, 1) Source(36, 1) + SourceIndex(0) +2 >Emitted(26, 5) Source(36, 5) + SourceIndex(0) +3 >Emitted(26, 9) Source(36, 9) + SourceIndex(0) +4 >Emitted(26, 12) Source(39, 5) + SourceIndex(0) +5 >Emitted(26, 22) Source(39, 14) + SourceIndex(0) +6 >Emitted(26, 23) Source(39, 15) + SourceIndex(0) +7 >Emitted(26, 27) Source(39, 19) + SourceIndex(0) +8 >Emitted(26, 33) Source(39, 25) + SourceIndex(0) +9 >Emitted(26, 34) Source(39, 26) + SourceIndex(0) +10>Emitted(26, 35) Source(39, 27) + SourceIndex(0) +11>Emitted(26, 36) Source(39, 28) + SourceIndex(0) +12>Emitted(26, 37) Source(39, 29) + SourceIndex(0) +13>Emitted(26, 38) Source(39, 30) + SourceIndex(0) +14>Emitted(26, 39) Source(39, 31) + SourceIndex(0) --- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > ; -1 >Emitted(35, 5) Source(39, 19) + SourceIndex(0) -2 >Emitted(35, 11) Source(39, 25) + SourceIndex(0) -3 >Emitted(35, 12) Source(39, 26) + SourceIndex(0) -4 >Emitted(35, 13) Source(39, 27) + SourceIndex(0) -5 >Emitted(35, 14) Source(39, 28) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(36, 1) Source(39, 29) + SourceIndex(0) -2 >Emitted(36, 2) Source(39, 30) + SourceIndex(0) -3 >Emitted(36, 3) Source(39, 31) + SourceIndex(0) ---- ->>>var c3t8 = function (n) { +>>>var c3t8 = function (n) { return n; }; 1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ 1-> > > @@ -641,44 +627,31 @@ sourceFile:contextualTyping.ts 4 > : (n: number, s: string) => number = 5 > function( 6 > n -1->Emitted(37, 1) Source(41, 1) + SourceIndex(0) -2 >Emitted(37, 5) Source(41, 5) + SourceIndex(0) -3 >Emitted(37, 9) Source(41, 9) + SourceIndex(0) -4 >Emitted(37, 12) Source(41, 46) + SourceIndex(0) -5 >Emitted(37, 22) Source(41, 55) + SourceIndex(0) -6 >Emitted(37, 23) Source(41, 56) + SourceIndex(0) ---- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > ; -1 >Emitted(38, 5) Source(41, 60) + SourceIndex(0) -2 >Emitted(38, 11) Source(41, 66) + SourceIndex(0) -3 >Emitted(38, 12) Source(41, 67) + SourceIndex(0) -4 >Emitted(38, 13) Source(41, 68) + SourceIndex(0) -5 >Emitted(38, 14) Source(41, 69) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(39, 1) Source(41, 70) + SourceIndex(0) -2 >Emitted(39, 2) Source(41, 71) + SourceIndex(0) -3 >Emitted(39, 3) Source(41, 72) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> n +11> ; +12> +13> } +14> ; +1->Emitted(27, 1) Source(41, 1) + SourceIndex(0) +2 >Emitted(27, 5) Source(41, 5) + SourceIndex(0) +3 >Emitted(27, 9) Source(41, 9) + SourceIndex(0) +4 >Emitted(27, 12) Source(41, 46) + SourceIndex(0) +5 >Emitted(27, 22) Source(41, 55) + SourceIndex(0) +6 >Emitted(27, 23) Source(41, 56) + SourceIndex(0) +7 >Emitted(27, 27) Source(41, 60) + SourceIndex(0) +8 >Emitted(27, 33) Source(41, 66) + SourceIndex(0) +9 >Emitted(27, 34) Source(41, 67) + SourceIndex(0) +10>Emitted(27, 35) Source(41, 68) + SourceIndex(0) +11>Emitted(27, 36) Source(41, 69) + SourceIndex(0) +12>Emitted(27, 37) Source(41, 70) + SourceIndex(0) +13>Emitted(27, 38) Source(41, 71) + SourceIndex(0) +14>Emitted(27, 39) Source(41, 72) + SourceIndex(0) --- >>>var c3t9 = [[], []]; -1-> +1 > 2 >^^^^ 3 > ^^^^ 4 > ^^^ @@ -689,7 +662,7 @@ sourceFile:contextualTyping.ts 9 > ^ 10> ^ 11> ^^^^^^-> -1-> +1 > > 2 >var 3 > c3t9 @@ -700,16 +673,16 @@ sourceFile:contextualTyping.ts 8 > [] 9 > ] 10> ; -1->Emitted(40, 1) Source(42, 1) + SourceIndex(0) -2 >Emitted(40, 5) Source(42, 5) + SourceIndex(0) -3 >Emitted(40, 9) Source(42, 9) + SourceIndex(0) -4 >Emitted(40, 12) Source(42, 24) + SourceIndex(0) -5 >Emitted(40, 13) Source(42, 25) + SourceIndex(0) -6 >Emitted(40, 15) Source(42, 27) + SourceIndex(0) -7 >Emitted(40, 17) Source(42, 28) + SourceIndex(0) -8 >Emitted(40, 19) Source(42, 30) + SourceIndex(0) -9 >Emitted(40, 20) Source(42, 31) + SourceIndex(0) -10>Emitted(40, 21) Source(42, 32) + SourceIndex(0) +1 >Emitted(28, 1) Source(42, 1) + SourceIndex(0) +2 >Emitted(28, 5) Source(42, 5) + SourceIndex(0) +3 >Emitted(28, 9) Source(42, 9) + SourceIndex(0) +4 >Emitted(28, 12) Source(42, 24) + SourceIndex(0) +5 >Emitted(28, 13) Source(42, 25) + SourceIndex(0) +6 >Emitted(28, 15) Source(42, 27) + SourceIndex(0) +7 >Emitted(28, 17) Source(42, 28) + SourceIndex(0) +8 >Emitted(28, 19) Source(42, 30) + SourceIndex(0) +9 >Emitted(28, 20) Source(42, 31) + SourceIndex(0) +10>Emitted(28, 21) Source(42, 32) + SourceIndex(0) --- >>>var c3t10 = [({}), ({})]; 1-> @@ -726,7 +699,7 @@ sourceFile:contextualTyping.ts 12> ^ 13> ^ 14> ^ -15> ^^^^^^-> +15> ^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -742,22 +715,22 @@ sourceFile:contextualTyping.ts 12> ) 13> ] 14> ; -1->Emitted(41, 1) Source(43, 1) + SourceIndex(0) -2 >Emitted(41, 5) Source(43, 5) + SourceIndex(0) -3 >Emitted(41, 10) Source(43, 10) + SourceIndex(0) -4 >Emitted(41, 13) Source(43, 21) + SourceIndex(0) -5 >Emitted(41, 14) Source(43, 28) + SourceIndex(0) -6 >Emitted(41, 15) Source(43, 29) + SourceIndex(0) -7 >Emitted(41, 17) Source(43, 31) + SourceIndex(0) -8 >Emitted(41, 18) Source(43, 32) + SourceIndex(0) -9 >Emitted(41, 20) Source(43, 39) + SourceIndex(0) -10>Emitted(41, 21) Source(43, 40) + SourceIndex(0) -11>Emitted(41, 23) Source(43, 42) + SourceIndex(0) -12>Emitted(41, 24) Source(43, 43) + SourceIndex(0) -13>Emitted(41, 25) Source(43, 44) + SourceIndex(0) -14>Emitted(41, 26) Source(43, 45) + SourceIndex(0) +1->Emitted(29, 1) Source(43, 1) + SourceIndex(0) +2 >Emitted(29, 5) Source(43, 5) + SourceIndex(0) +3 >Emitted(29, 10) Source(43, 10) + SourceIndex(0) +4 >Emitted(29, 13) Source(43, 21) + SourceIndex(0) +5 >Emitted(29, 14) Source(43, 28) + SourceIndex(0) +6 >Emitted(29, 15) Source(43, 29) + SourceIndex(0) +7 >Emitted(29, 17) Source(43, 31) + SourceIndex(0) +8 >Emitted(29, 18) Source(43, 32) + SourceIndex(0) +9 >Emitted(29, 20) Source(43, 39) + SourceIndex(0) +10>Emitted(29, 21) Source(43, 40) + SourceIndex(0) +11>Emitted(29, 23) Source(43, 42) + SourceIndex(0) +12>Emitted(29, 24) Source(43, 43) + SourceIndex(0) +13>Emitted(29, 25) Source(43, 44) + SourceIndex(0) +14>Emitted(29, 26) Source(43, 45) + SourceIndex(0) --- ->>>var c3t11 = [function (n, s) { +>>>var c3t11 = [function (n, s) { return s; }]; 1-> 2 >^^^^ 3 > ^^^^^ @@ -767,6 +740,15 @@ sourceFile:contextualTyping.ts 7 > ^ 8 > ^^ 9 > ^ +10> ^^^^ +11> ^^^^^^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ 1-> > 2 >var @@ -777,63 +759,49 @@ sourceFile:contextualTyping.ts 7 > n 8 > , 9 > s -1->Emitted(42, 1) Source(44, 1) + SourceIndex(0) -2 >Emitted(42, 5) Source(44, 5) + SourceIndex(0) -3 >Emitted(42, 10) Source(44, 10) + SourceIndex(0) -4 >Emitted(42, 13) Source(44, 50) + SourceIndex(0) -5 >Emitted(42, 14) Source(44, 51) + SourceIndex(0) -6 >Emitted(42, 24) Source(44, 60) + SourceIndex(0) -7 >Emitted(42, 25) Source(44, 61) + SourceIndex(0) -8 >Emitted(42, 27) Source(44, 63) + SourceIndex(0) -9 >Emitted(42, 28) Source(44, 64) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(43, 5) Source(44, 68) + SourceIndex(0) -2 >Emitted(43, 11) Source(44, 74) + SourceIndex(0) -3 >Emitted(43, 12) Source(44, 75) + SourceIndex(0) -4 >Emitted(43, 13) Source(44, 76) + SourceIndex(0) -5 >Emitted(43, 14) Source(44, 77) + SourceIndex(0) ---- ->>>}]; -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^-> -1 > -2 >} -3 > ] -4 > ; -1 >Emitted(44, 1) Source(44, 78) + SourceIndex(0) -2 >Emitted(44, 2) Source(44, 79) + SourceIndex(0) -3 >Emitted(44, 3) Source(44, 80) + SourceIndex(0) -4 >Emitted(44, 4) Source(44, 81) + SourceIndex(0) +10> ) { +11> return +12> +13> s +14> ; +15> +16> } +17> ] +18> ; +1->Emitted(30, 1) Source(44, 1) + SourceIndex(0) +2 >Emitted(30, 5) Source(44, 5) + SourceIndex(0) +3 >Emitted(30, 10) Source(44, 10) + SourceIndex(0) +4 >Emitted(30, 13) Source(44, 50) + SourceIndex(0) +5 >Emitted(30, 14) Source(44, 51) + SourceIndex(0) +6 >Emitted(30, 24) Source(44, 60) + SourceIndex(0) +7 >Emitted(30, 25) Source(44, 61) + SourceIndex(0) +8 >Emitted(30, 27) Source(44, 63) + SourceIndex(0) +9 >Emitted(30, 28) Source(44, 64) + SourceIndex(0) +10>Emitted(30, 32) Source(44, 68) + SourceIndex(0) +11>Emitted(30, 38) Source(44, 74) + SourceIndex(0) +12>Emitted(30, 39) Source(44, 75) + SourceIndex(0) +13>Emitted(30, 40) Source(44, 76) + SourceIndex(0) +14>Emitted(30, 41) Source(44, 77) + SourceIndex(0) +15>Emitted(30, 42) Source(44, 78) + SourceIndex(0) +16>Emitted(30, 43) Source(44, 79) + SourceIndex(0) +17>Emitted(30, 44) Source(44, 80) + SourceIndex(0) +18>Emitted(30, 45) Source(44, 81) + SourceIndex(0) --- >>>var c3t12 = { -1-> +1 > 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^^-> -1-> +1 > > 2 >var 3 > c3t12 4 > : IBar = -1->Emitted(45, 1) Source(45, 1) + SourceIndex(0) -2 >Emitted(45, 5) Source(45, 5) + SourceIndex(0) -3 >Emitted(45, 10) Source(45, 10) + SourceIndex(0) -4 >Emitted(45, 13) Source(45, 19) + SourceIndex(0) +1 >Emitted(31, 1) Source(45, 1) + SourceIndex(0) +2 >Emitted(31, 5) Source(45, 5) + SourceIndex(0) +3 >Emitted(31, 10) Source(45, 10) + SourceIndex(0) +4 >Emitted(31, 13) Source(45, 19) + SourceIndex(0) --- >>> foo: ({}) 1->^^^^ @@ -849,12 +817,12 @@ sourceFile:contextualTyping.ts 4 > ( 5 > {} 6 > ) -1->Emitted(46, 5) Source(46, 5) + SourceIndex(0) -2 >Emitted(46, 8) Source(46, 8) + SourceIndex(0) -3 >Emitted(46, 10) Source(46, 16) + SourceIndex(0) -4 >Emitted(46, 11) Source(46, 17) + SourceIndex(0) -5 >Emitted(46, 13) Source(46, 19) + SourceIndex(0) -6 >Emitted(46, 14) Source(46, 20) + SourceIndex(0) +1->Emitted(32, 5) Source(46, 5) + SourceIndex(0) +2 >Emitted(32, 8) Source(46, 8) + SourceIndex(0) +3 >Emitted(32, 10) Source(46, 16) + SourceIndex(0) +4 >Emitted(32, 11) Source(46, 17) + SourceIndex(0) +5 >Emitted(32, 13) Source(46, 19) + SourceIndex(0) +6 >Emitted(32, 14) Source(46, 20) + SourceIndex(0) --- >>>}; 1 >^ @@ -863,8 +831,8 @@ sourceFile:contextualTyping.ts 1 > >} 2 > -1 >Emitted(47, 2) Source(47, 2) + SourceIndex(0) -2 >Emitted(47, 3) Source(47, 2) + SourceIndex(0) +1 >Emitted(33, 2) Source(47, 2) + SourceIndex(0) +2 >Emitted(33, 3) Source(47, 2) + SourceIndex(0) --- >>>var c3t13 = ({ 1-> @@ -872,20 +840,20 @@ sourceFile:contextualTyping.ts 3 > ^^^^^ 4 > ^^^ 5 > ^ -6 > ^^^^^^^^^^^^-> +6 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var 3 > c3t13 4 > = 5 > ( -1->Emitted(48, 1) Source(48, 1) + SourceIndex(0) -2 >Emitted(48, 5) Source(48, 5) + SourceIndex(0) -3 >Emitted(48, 10) Source(48, 10) + SourceIndex(0) -4 >Emitted(48, 13) Source(48, 19) + SourceIndex(0) -5 >Emitted(48, 14) Source(48, 20) + SourceIndex(0) +1->Emitted(34, 1) Source(48, 1) + SourceIndex(0) +2 >Emitted(34, 5) Source(48, 5) + SourceIndex(0) +3 >Emitted(34, 10) Source(48, 10) + SourceIndex(0) +4 >Emitted(34, 13) Source(48, 19) + SourceIndex(0) +5 >Emitted(34, 14) Source(48, 20) + SourceIndex(0) --- ->>> f: function (i, s) { +>>> f: function (i, s) { return s; } 1->^^^^ 2 > ^ 3 > ^^ @@ -893,6 +861,13 @@ sourceFile:contextualTyping.ts 5 > ^ 6 > ^^ 7 > ^ +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ 1->{ > 2 > f @@ -901,38 +876,27 @@ sourceFile:contextualTyping.ts 5 > i 6 > , 7 > s -1->Emitted(49, 5) Source(49, 5) + SourceIndex(0) -2 >Emitted(49, 6) Source(49, 6) + SourceIndex(0) -3 >Emitted(49, 8) Source(49, 8) + SourceIndex(0) -4 >Emitted(49, 18) Source(49, 17) + SourceIndex(0) -5 >Emitted(49, 19) Source(49, 18) + SourceIndex(0) -6 >Emitted(49, 21) Source(49, 20) + SourceIndex(0) -7 >Emitted(49, 22) Source(49, 21) + SourceIndex(0) ---- ->>> return s; -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(50, 9) Source(49, 25) + SourceIndex(0) -2 >Emitted(50, 15) Source(49, 31) + SourceIndex(0) -3 >Emitted(50, 16) Source(49, 32) + SourceIndex(0) -4 >Emitted(50, 17) Source(49, 33) + SourceIndex(0) -5 >Emitted(50, 18) Source(49, 34) + SourceIndex(0) ---- ->>> } -1 >^^^^ -2 > ^ -1 > -2 > } -1 >Emitted(51, 5) Source(49, 35) + SourceIndex(0) -2 >Emitted(51, 6) Source(49, 36) + SourceIndex(0) +8 > ) { +9 > return +10> +11> s +12> ; +13> +14> } +1->Emitted(35, 5) Source(49, 5) + SourceIndex(0) +2 >Emitted(35, 6) Source(49, 6) + SourceIndex(0) +3 >Emitted(35, 8) Source(49, 8) + SourceIndex(0) +4 >Emitted(35, 18) Source(49, 17) + SourceIndex(0) +5 >Emitted(35, 19) Source(49, 18) + SourceIndex(0) +6 >Emitted(35, 21) Source(49, 20) + SourceIndex(0) +7 >Emitted(35, 22) Source(49, 21) + SourceIndex(0) +8 >Emitted(35, 26) Source(49, 25) + SourceIndex(0) +9 >Emitted(35, 32) Source(49, 31) + SourceIndex(0) +10>Emitted(35, 33) Source(49, 32) + SourceIndex(0) +11>Emitted(35, 34) Source(49, 33) + SourceIndex(0) +12>Emitted(35, 35) Source(49, 34) + SourceIndex(0) +13>Emitted(35, 36) Source(49, 35) + SourceIndex(0) +14>Emitted(35, 37) Source(49, 36) + SourceIndex(0) --- >>>}); 1 >^ @@ -943,9 +907,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(52, 2) Source(50, 2) + SourceIndex(0) -2 >Emitted(52, 3) Source(50, 3) + SourceIndex(0) -3 >Emitted(52, 4) Source(50, 3) + SourceIndex(0) +1 >Emitted(36, 2) Source(50, 2) + SourceIndex(0) +2 >Emitted(36, 3) Source(50, 3) + SourceIndex(0) +3 >Emitted(36, 4) Source(50, 3) + SourceIndex(0) --- >>>var c3t14 = ({ 1-> @@ -959,11 +923,11 @@ sourceFile:contextualTyping.ts 3 > c3t14 4 > = 5 > ( -1->Emitted(53, 1) Source(51, 1) + SourceIndex(0) -2 >Emitted(53, 5) Source(51, 5) + SourceIndex(0) -3 >Emitted(53, 10) Source(51, 10) + SourceIndex(0) -4 >Emitted(53, 13) Source(51, 19) + SourceIndex(0) -5 >Emitted(53, 14) Source(51, 20) + SourceIndex(0) +1->Emitted(37, 1) Source(51, 1) + SourceIndex(0) +2 >Emitted(37, 5) Source(51, 5) + SourceIndex(0) +3 >Emitted(37, 10) Source(51, 10) + SourceIndex(0) +4 >Emitted(37, 13) Source(51, 19) + SourceIndex(0) +5 >Emitted(37, 14) Source(51, 20) + SourceIndex(0) --- >>> a: [] 1 >^^^^ @@ -975,10 +939,10 @@ sourceFile:contextualTyping.ts 2 > a 3 > : 4 > [] -1 >Emitted(54, 5) Source(52, 5) + SourceIndex(0) -2 >Emitted(54, 6) Source(52, 6) + SourceIndex(0) -3 >Emitted(54, 8) Source(52, 8) + SourceIndex(0) -4 >Emitted(54, 10) Source(52, 10) + SourceIndex(0) +1 >Emitted(38, 5) Source(52, 5) + SourceIndex(0) +2 >Emitted(38, 6) Source(52, 6) + SourceIndex(0) +3 >Emitted(38, 8) Source(52, 8) + SourceIndex(0) +4 >Emitted(38, 10) Source(52, 10) + SourceIndex(0) --- >>>}); 1 >^ @@ -989,9 +953,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(55, 2) Source(53, 2) + SourceIndex(0) -2 >Emitted(55, 3) Source(53, 3) + SourceIndex(0) -3 >Emitted(55, 4) Source(53, 3) + SourceIndex(0) +1 >Emitted(39, 2) Source(53, 2) + SourceIndex(0) +2 >Emitted(39, 3) Source(53, 3) + SourceIndex(0) +3 >Emitted(39, 4) Source(53, 3) + SourceIndex(0) --- >>>// CONTEXT: Class property assignment 1-> @@ -1003,9 +967,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Class property assignment -1->Emitted(56, 1) Source(56, 1) + SourceIndex(0) -2 >Emitted(56, 1) Source(55, 1) + SourceIndex(0) -3 >Emitted(56, 38) Source(55, 38) + SourceIndex(0) +1->Emitted(40, 1) Source(56, 1) + SourceIndex(0) +2 >Emitted(40, 1) Source(55, 1) + SourceIndex(0) +3 >Emitted(40, 38) Source(55, 38) + SourceIndex(0) --- >>>var C4T5 = (function () { 1 >^^^^ @@ -1014,8 +978,8 @@ sourceFile:contextualTyping.ts 1 > >class 2 > C4T5 -1 >Emitted(57, 5) Source(56, 7) + SourceIndex(0) -2 >Emitted(57, 9) Source(56, 11) + SourceIndex(0) +1 >Emitted(41, 5) Source(56, 7) + SourceIndex(0) +2 >Emitted(41, 9) Source(56, 11) + SourceIndex(0) --- >>> function C4T5() { 1->^^^^ @@ -1027,9 +991,9 @@ sourceFile:contextualTyping.ts > 2 > 3 > C4T5 -1->Emitted(58, 5) Source(58, 5) + SourceIndex(0) name (C4T5) -2 >Emitted(58, 14) Source(56, 7) + SourceIndex(0) name (C4T5) -3 >Emitted(58, 18) Source(56, 11) + SourceIndex(0) name (C4T5) +1->Emitted(42, 5) Source(58, 5) + SourceIndex(0) name (C4T5) +2 >Emitted(42, 14) Source(56, 7) + SourceIndex(0) name (C4T5) +3 >Emitted(42, 18) Source(56, 11) + SourceIndex(0) name (C4T5) --- >>> this.foo = function (i, s) { 1->^^^^^^^^ @@ -1053,15 +1017,15 @@ sourceFile:contextualTyping.ts 7 > i 8 > , 9 > s -1->Emitted(59, 9) Source(59, 9) + SourceIndex(0) name (C4T5.constructor) -2 >Emitted(59, 13) Source(59, 13) + SourceIndex(0) name (C4T5.constructor) -3 >Emitted(59, 14) Source(59, 14) + SourceIndex(0) name (C4T5.constructor) -4 >Emitted(59, 17) Source(59, 17) + SourceIndex(0) name (C4T5.constructor) -5 >Emitted(59, 20) Source(59, 20) + SourceIndex(0) name (C4T5.constructor) -6 >Emitted(59, 30) Source(59, 29) + SourceIndex(0) name (C4T5.constructor) -7 >Emitted(59, 31) Source(59, 30) + SourceIndex(0) name (C4T5.constructor) -8 >Emitted(59, 33) Source(59, 32) + SourceIndex(0) name (C4T5.constructor) -9 >Emitted(59, 34) Source(59, 33) + SourceIndex(0) name (C4T5.constructor) +1->Emitted(43, 9) Source(59, 9) + SourceIndex(0) name (C4T5.constructor) +2 >Emitted(43, 13) Source(59, 13) + SourceIndex(0) name (C4T5.constructor) +3 >Emitted(43, 14) Source(59, 14) + SourceIndex(0) name (C4T5.constructor) +4 >Emitted(43, 17) Source(59, 17) + SourceIndex(0) name (C4T5.constructor) +5 >Emitted(43, 20) Source(59, 20) + SourceIndex(0) name (C4T5.constructor) +6 >Emitted(43, 30) Source(59, 29) + SourceIndex(0) name (C4T5.constructor) +7 >Emitted(43, 31) Source(59, 30) + SourceIndex(0) name (C4T5.constructor) +8 >Emitted(43, 33) Source(59, 32) + SourceIndex(0) name (C4T5.constructor) +9 >Emitted(43, 34) Source(59, 33) + SourceIndex(0) name (C4T5.constructor) --- >>> return s; 1 >^^^^^^^^^^^^ @@ -1075,11 +1039,11 @@ sourceFile:contextualTyping.ts 3 > 4 > s 5 > ; -1 >Emitted(60, 13) Source(60, 13) + SourceIndex(0) -2 >Emitted(60, 19) Source(60, 19) + SourceIndex(0) -3 >Emitted(60, 20) Source(60, 20) + SourceIndex(0) -4 >Emitted(60, 21) Source(60, 21) + SourceIndex(0) -5 >Emitted(60, 22) Source(60, 22) + SourceIndex(0) +1 >Emitted(44, 13) Source(60, 13) + SourceIndex(0) +2 >Emitted(44, 19) Source(60, 19) + SourceIndex(0) +3 >Emitted(44, 20) Source(60, 20) + SourceIndex(0) +4 >Emitted(44, 21) Source(60, 21) + SourceIndex(0) +5 >Emitted(44, 22) Source(60, 22) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^ @@ -1089,9 +1053,9 @@ sourceFile:contextualTyping.ts > 2 > } 3 > -1 >Emitted(61, 9) Source(61, 9) + SourceIndex(0) -2 >Emitted(61, 10) Source(61, 10) + SourceIndex(0) -3 >Emitted(61, 11) Source(61, 10) + SourceIndex(0) name (C4T5.constructor) +1 >Emitted(45, 9) Source(61, 9) + SourceIndex(0) +2 >Emitted(45, 10) Source(61, 10) + SourceIndex(0) +3 >Emitted(45, 11) Source(61, 10) + SourceIndex(0) name (C4T5.constructor) --- >>> } 1 >^^^^ @@ -1100,8 +1064,8 @@ sourceFile:contextualTyping.ts 1 > > 2 > } -1 >Emitted(62, 5) Source(62, 5) + SourceIndex(0) name (C4T5.constructor) -2 >Emitted(62, 6) Source(62, 6) + SourceIndex(0) name (C4T5.constructor) +1 >Emitted(46, 5) Source(62, 5) + SourceIndex(0) name (C4T5.constructor) +2 >Emitted(46, 6) Source(62, 6) + SourceIndex(0) name (C4T5.constructor) --- >>> return C4T5; 1->^^^^ @@ -1109,8 +1073,8 @@ sourceFile:contextualTyping.ts 1-> > 2 > } -1->Emitted(63, 5) Source(63, 1) + SourceIndex(0) name (C4T5) -2 >Emitted(63, 16) Source(63, 2) + SourceIndex(0) name (C4T5) +1->Emitted(47, 5) Source(63, 1) + SourceIndex(0) name (C4T5) +2 >Emitted(47, 16) Source(63, 2) + SourceIndex(0) name (C4T5) --- >>>})(); 1 > @@ -1129,10 +1093,10 @@ sourceFile:contextualTyping.ts > } > } > } -1 >Emitted(64, 1) Source(63, 1) + SourceIndex(0) name (C4T5) -2 >Emitted(64, 2) Source(63, 2) + SourceIndex(0) name (C4T5) -3 >Emitted(64, 2) Source(56, 1) + SourceIndex(0) -4 >Emitted(64, 6) Source(63, 2) + SourceIndex(0) +1 >Emitted(48, 1) Source(63, 1) + SourceIndex(0) name (C4T5) +2 >Emitted(48, 2) Source(63, 2) + SourceIndex(0) name (C4T5) +3 >Emitted(48, 2) Source(56, 1) + SourceIndex(0) +4 >Emitted(48, 6) Source(63, 2) + SourceIndex(0) --- >>>// CONTEXT: Module property assignment 1-> @@ -1144,9 +1108,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Module property assignment -1->Emitted(65, 1) Source(66, 1) + SourceIndex(0) -2 >Emitted(65, 1) Source(65, 1) + SourceIndex(0) -3 >Emitted(65, 39) Source(65, 39) + SourceIndex(0) +1->Emitted(49, 1) Source(66, 1) + SourceIndex(0) +2 >Emitted(49, 1) Source(65, 1) + SourceIndex(0) +3 >Emitted(49, 39) Source(65, 39) + SourceIndex(0) --- >>>var C5T5; 1 > @@ -1164,10 +1128,10 @@ sourceFile:contextualTyping.ts > return s; > } > } -1 >Emitted(66, 1) Source(66, 1) + SourceIndex(0) -2 >Emitted(66, 5) Source(66, 8) + SourceIndex(0) -3 >Emitted(66, 9) Source(66, 12) + SourceIndex(0) -4 >Emitted(66, 10) Source(71, 2) + SourceIndex(0) +1 >Emitted(50, 1) Source(66, 1) + SourceIndex(0) +2 >Emitted(50, 5) Source(66, 8) + SourceIndex(0) +3 >Emitted(50, 9) Source(66, 12) + SourceIndex(0) +4 >Emitted(50, 10) Source(71, 2) + SourceIndex(0) --- >>>(function (C5T5) { 1-> @@ -1180,11 +1144,11 @@ sourceFile:contextualTyping.ts 3 > C5T5 4 > 5 > { -1->Emitted(67, 1) Source(66, 1) + SourceIndex(0) -2 >Emitted(67, 12) Source(66, 8) + SourceIndex(0) -3 >Emitted(67, 16) Source(66, 12) + SourceIndex(0) -4 >Emitted(67, 18) Source(66, 13) + SourceIndex(0) -5 >Emitted(67, 19) Source(66, 14) + SourceIndex(0) +1->Emitted(51, 1) Source(66, 1) + SourceIndex(0) +2 >Emitted(51, 12) Source(66, 8) + SourceIndex(0) +3 >Emitted(51, 16) Source(66, 12) + SourceIndex(0) +4 >Emitted(51, 18) Source(66, 13) + SourceIndex(0) +5 >Emitted(51, 19) Source(66, 14) + SourceIndex(0) --- >>> C5T5.foo; 1 >^^^^ @@ -1195,9 +1159,9 @@ sourceFile:contextualTyping.ts > export var 2 > foo: (i: number, s: string) => string 3 > ; -1 >Emitted(68, 5) Source(67, 16) + SourceIndex(0) name (C5T5) -2 >Emitted(68, 13) Source(67, 53) + SourceIndex(0) name (C5T5) -3 >Emitted(68, 14) Source(67, 54) + SourceIndex(0) name (C5T5) +1 >Emitted(52, 5) Source(67, 16) + SourceIndex(0) name (C5T5) +2 >Emitted(52, 13) Source(67, 53) + SourceIndex(0) name (C5T5) +3 >Emitted(52, 14) Source(67, 54) + SourceIndex(0) name (C5T5) --- >>> C5T5.foo = function (i, s) { 1->^^^^ @@ -1215,13 +1179,13 @@ sourceFile:contextualTyping.ts 5 > i 6 > , 7 > s -1->Emitted(69, 5) Source(68, 5) + SourceIndex(0) name (C5T5) -2 >Emitted(69, 13) Source(68, 8) + SourceIndex(0) name (C5T5) -3 >Emitted(69, 16) Source(68, 11) + SourceIndex(0) name (C5T5) -4 >Emitted(69, 26) Source(68, 20) + SourceIndex(0) name (C5T5) -5 >Emitted(69, 27) Source(68, 21) + SourceIndex(0) name (C5T5) -6 >Emitted(69, 29) Source(68, 23) + SourceIndex(0) name (C5T5) -7 >Emitted(69, 30) Source(68, 24) + SourceIndex(0) name (C5T5) +1->Emitted(53, 5) Source(68, 5) + SourceIndex(0) name (C5T5) +2 >Emitted(53, 13) Source(68, 8) + SourceIndex(0) name (C5T5) +3 >Emitted(53, 16) Source(68, 11) + SourceIndex(0) name (C5T5) +4 >Emitted(53, 26) Source(68, 20) + SourceIndex(0) name (C5T5) +5 >Emitted(53, 27) Source(68, 21) + SourceIndex(0) name (C5T5) +6 >Emitted(53, 29) Source(68, 23) + SourceIndex(0) name (C5T5) +7 >Emitted(53, 30) Source(68, 24) + SourceIndex(0) name (C5T5) --- >>> return s; 1 >^^^^^^^^ @@ -1235,11 +1199,11 @@ sourceFile:contextualTyping.ts 3 > 4 > s 5 > ; -1 >Emitted(70, 9) Source(69, 9) + SourceIndex(0) -2 >Emitted(70, 15) Source(69, 15) + SourceIndex(0) -3 >Emitted(70, 16) Source(69, 16) + SourceIndex(0) -4 >Emitted(70, 17) Source(69, 17) + SourceIndex(0) -5 >Emitted(70, 18) Source(69, 18) + SourceIndex(0) +1 >Emitted(54, 9) Source(69, 9) + SourceIndex(0) +2 >Emitted(54, 15) Source(69, 15) + SourceIndex(0) +3 >Emitted(54, 16) Source(69, 16) + SourceIndex(0) +4 >Emitted(54, 17) Source(69, 17) + SourceIndex(0) +5 >Emitted(54, 18) Source(69, 18) + SourceIndex(0) --- >>> }; 1 >^^^^ @@ -1250,9 +1214,9 @@ sourceFile:contextualTyping.ts > 2 > } 3 > -1 >Emitted(71, 5) Source(70, 5) + SourceIndex(0) -2 >Emitted(71, 6) Source(70, 6) + SourceIndex(0) -3 >Emitted(71, 7) Source(70, 6) + SourceIndex(0) name (C5T5) +1 >Emitted(55, 5) Source(70, 5) + SourceIndex(0) +2 >Emitted(55, 6) Source(70, 6) + SourceIndex(0) +3 >Emitted(55, 7) Source(70, 6) + SourceIndex(0) name (C5T5) --- >>>})(C5T5 || (C5T5 = {})); 1-> @@ -1276,13 +1240,13 @@ sourceFile:contextualTyping.ts > return s; > } > } -1->Emitted(72, 1) Source(71, 1) + SourceIndex(0) name (C5T5) -2 >Emitted(72, 2) Source(71, 2) + SourceIndex(0) name (C5T5) -3 >Emitted(72, 4) Source(66, 8) + SourceIndex(0) -4 >Emitted(72, 8) Source(66, 12) + SourceIndex(0) -5 >Emitted(72, 13) Source(66, 8) + SourceIndex(0) -6 >Emitted(72, 17) Source(66, 12) + SourceIndex(0) -7 >Emitted(72, 25) Source(71, 2) + SourceIndex(0) +1->Emitted(56, 1) Source(71, 1) + SourceIndex(0) name (C5T5) +2 >Emitted(56, 2) Source(71, 2) + SourceIndex(0) name (C5T5) +3 >Emitted(56, 4) Source(66, 8) + SourceIndex(0) +4 >Emitted(56, 8) Source(66, 12) + SourceIndex(0) +5 >Emitted(56, 13) Source(66, 8) + SourceIndex(0) +6 >Emitted(56, 17) Source(66, 12) + SourceIndex(0) +7 >Emitted(56, 25) Source(71, 2) + SourceIndex(0) --- >>>// CONTEXT: Variable assignment 1-> @@ -1294,89 +1258,84 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Variable assignment -1->Emitted(73, 1) Source(74, 1) + SourceIndex(0) -2 >Emitted(73, 1) Source(73, 1) + SourceIndex(0) -3 >Emitted(73, 32) Source(73, 32) + SourceIndex(0) +1->Emitted(57, 1) Source(74, 1) + SourceIndex(0) +2 >Emitted(57, 1) Source(73, 1) + SourceIndex(0) +3 >Emitted(57, 32) Source(73, 32) + SourceIndex(0) --- >>>var c6t5; 1 >^^^^ 2 > ^^^^ 3 > ^ -4 > ^^^^^^^^^^^^^-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > >var 2 > c6t5: (n: number) => IFoo 3 > ; -1 >Emitted(74, 5) Source(74, 5) + SourceIndex(0) -2 >Emitted(74, 9) Source(74, 30) + SourceIndex(0) -3 >Emitted(74, 10) Source(74, 31) + SourceIndex(0) +1 >Emitted(58, 5) Source(74, 5) + SourceIndex(0) +2 >Emitted(58, 9) Source(74, 30) + SourceIndex(0) +3 >Emitted(58, 10) Source(74, 31) + SourceIndex(0) --- ->>>c6t5 = function (n) { +>>>c6t5 = function (n) { return ({}); }; 1-> 2 >^^^^ 3 > ^^^ 4 > ^^^^^^^^^^ 5 > ^ +6 > ^^^^ +7 > ^^^^^^ +8 > ^ +9 > ^ +10> ^^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ 1-> > 2 >c6t5 3 > = <(n: number) => IFoo> 4 > function( 5 > n -1->Emitted(75, 1) Source(75, 1) + SourceIndex(0) -2 >Emitted(75, 5) Source(75, 5) + SourceIndex(0) -3 >Emitted(75, 8) Source(75, 29) + SourceIndex(0) -4 >Emitted(75, 18) Source(75, 38) + SourceIndex(0) -5 >Emitted(75, 19) Source(75, 39) + SourceIndex(0) ---- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(76, 5) Source(75, 43) + SourceIndex(0) -2 >Emitted(76, 11) Source(75, 49) + SourceIndex(0) -3 >Emitted(76, 12) Source(75, 56) + SourceIndex(0) -4 >Emitted(76, 13) Source(75, 57) + SourceIndex(0) -5 >Emitted(76, 15) Source(75, 59) + SourceIndex(0) -6 >Emitted(76, 16) Source(75, 60) + SourceIndex(0) -7 >Emitted(76, 17) Source(75, 60) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(77, 1) Source(75, 61) + SourceIndex(0) -2 >Emitted(77, 2) Source(75, 62) + SourceIndex(0) -3 >Emitted(77, 3) Source(75, 63) + SourceIndex(0) +6 > ) { +7 > return +8 > +9 > ( +10> {} +11> ) +12> +13> +14> } +15> ; +1->Emitted(59, 1) Source(75, 1) + SourceIndex(0) +2 >Emitted(59, 5) Source(75, 5) + SourceIndex(0) +3 >Emitted(59, 8) Source(75, 29) + SourceIndex(0) +4 >Emitted(59, 18) Source(75, 38) + SourceIndex(0) +5 >Emitted(59, 19) Source(75, 39) + SourceIndex(0) +6 >Emitted(59, 23) Source(75, 43) + SourceIndex(0) +7 >Emitted(59, 29) Source(75, 49) + SourceIndex(0) +8 >Emitted(59, 30) Source(75, 56) + SourceIndex(0) +9 >Emitted(59, 31) Source(75, 57) + SourceIndex(0) +10>Emitted(59, 33) Source(75, 59) + SourceIndex(0) +11>Emitted(59, 34) Source(75, 60) + SourceIndex(0) +12>Emitted(59, 35) Source(75, 60) + SourceIndex(0) +13>Emitted(59, 36) Source(75, 61) + SourceIndex(0) +14>Emitted(59, 37) Source(75, 62) + SourceIndex(0) +15>Emitted(59, 38) Source(75, 63) + SourceIndex(0) --- >>>// CONTEXT: Array index assignment -1-> +1 > 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1-> +1 > > >// CONTEXT: Array index assignment > 2 > 3 >// CONTEXT: Array index assignment -1->Emitted(78, 1) Source(78, 1) + SourceIndex(0) -2 >Emitted(78, 1) Source(77, 1) + SourceIndex(0) -3 >Emitted(78, 35) Source(77, 35) + SourceIndex(0) +1 >Emitted(60, 1) Source(78, 1) + SourceIndex(0) +2 >Emitted(60, 1) Source(77, 1) + SourceIndex(0) +3 >Emitted(60, 35) Source(77, 35) + SourceIndex(0) --- >>>var c7t2; 1 >^^^^ @@ -1387,9 +1346,9 @@ sourceFile:contextualTyping.ts >var 2 > c7t2: IFoo[] 3 > ; -1 >Emitted(79, 5) Source(78, 5) + SourceIndex(0) -2 >Emitted(79, 9) Source(78, 17) + SourceIndex(0) -3 >Emitted(79, 10) Source(78, 18) + SourceIndex(0) +1 >Emitted(61, 5) Source(78, 5) + SourceIndex(0) +2 >Emitted(61, 9) Source(78, 17) + SourceIndex(0) +3 >Emitted(61, 10) Source(78, 18) + SourceIndex(0) --- >>>c7t2[0] = ({ n: 1 }); 1-> @@ -1421,20 +1380,20 @@ sourceFile:contextualTyping.ts 12> } 13> ) 14> ; -1->Emitted(80, 1) Source(79, 1) + SourceIndex(0) -2 >Emitted(80, 5) Source(79, 5) + SourceIndex(0) -3 >Emitted(80, 6) Source(79, 6) + SourceIndex(0) -4 >Emitted(80, 7) Source(79, 7) + SourceIndex(0) -5 >Emitted(80, 8) Source(79, 8) + SourceIndex(0) -6 >Emitted(80, 11) Source(79, 17) + SourceIndex(0) -7 >Emitted(80, 12) Source(79, 18) + SourceIndex(0) -8 >Emitted(80, 14) Source(79, 19) + SourceIndex(0) -9 >Emitted(80, 15) Source(79, 20) + SourceIndex(0) -10>Emitted(80, 17) Source(79, 22) + SourceIndex(0) -11>Emitted(80, 18) Source(79, 23) + SourceIndex(0) -12>Emitted(80, 20) Source(79, 24) + SourceIndex(0) -13>Emitted(80, 21) Source(79, 25) + SourceIndex(0) -14>Emitted(80, 22) Source(79, 26) + SourceIndex(0) +1->Emitted(62, 1) Source(79, 1) + SourceIndex(0) +2 >Emitted(62, 5) Source(79, 5) + SourceIndex(0) +3 >Emitted(62, 6) Source(79, 6) + SourceIndex(0) +4 >Emitted(62, 7) Source(79, 7) + SourceIndex(0) +5 >Emitted(62, 8) Source(79, 8) + SourceIndex(0) +6 >Emitted(62, 11) Source(79, 17) + SourceIndex(0) +7 >Emitted(62, 12) Source(79, 18) + SourceIndex(0) +8 >Emitted(62, 14) Source(79, 19) + SourceIndex(0) +9 >Emitted(62, 15) Source(79, 20) + SourceIndex(0) +10>Emitted(62, 17) Source(79, 22) + SourceIndex(0) +11>Emitted(62, 18) Source(79, 23) + SourceIndex(0) +12>Emitted(62, 20) Source(79, 24) + SourceIndex(0) +13>Emitted(62, 21) Source(79, 25) + SourceIndex(0) +14>Emitted(62, 22) Source(79, 26) + SourceIndex(0) --- >>>var objc8 = ({}); 1 > @@ -1445,7 +1404,7 @@ sourceFile:contextualTyping.ts 6 > ^^ 7 > ^ 8 > ^ -9 > ^^^^^^^^^^-> +9 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > >// CONTEXT: Object property assignment @@ -1495,16 +1454,16 @@ sourceFile:contextualTyping.ts 6 > {} 7 > ) 8 > ; -1 >Emitted(81, 1) Source(102, 1) + SourceIndex(0) -2 >Emitted(81, 5) Source(102, 5) + SourceIndex(0) -3 >Emitted(81, 10) Source(102, 10) + SourceIndex(0) -4 >Emitted(81, 13) Source(120, 19) + SourceIndex(0) -5 >Emitted(81, 14) Source(120, 20) + SourceIndex(0) -6 >Emitted(81, 16) Source(120, 22) + SourceIndex(0) -7 >Emitted(81, 17) Source(120, 23) + SourceIndex(0) -8 >Emitted(81, 18) Source(120, 24) + SourceIndex(0) +1 >Emitted(63, 1) Source(102, 1) + SourceIndex(0) +2 >Emitted(63, 5) Source(102, 5) + SourceIndex(0) +3 >Emitted(63, 10) Source(102, 10) + SourceIndex(0) +4 >Emitted(63, 13) Source(120, 19) + SourceIndex(0) +5 >Emitted(63, 14) Source(120, 20) + SourceIndex(0) +6 >Emitted(63, 16) Source(120, 22) + SourceIndex(0) +7 >Emitted(63, 17) Source(120, 23) + SourceIndex(0) +8 >Emitted(63, 18) Source(120, 24) + SourceIndex(0) --- ->>>objc8.t1 = (function (s) { +>>>objc8.t1 = (function (s) { return s; }); 1-> 2 >^^^^^ 3 > ^ @@ -1513,6 +1472,15 @@ sourceFile:contextualTyping.ts 6 > ^ 7 > ^^^^^^^^^^ 8 > ^ +9 > ^^^^ +10> ^^^^^^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^ 1-> > > @@ -1523,67 +1491,53 @@ sourceFile:contextualTyping.ts 6 > ( 7 > function( 8 > s -1->Emitted(82, 1) Source(122, 1) + SourceIndex(0) -2 >Emitted(82, 6) Source(122, 6) + SourceIndex(0) -3 >Emitted(82, 7) Source(122, 7) + SourceIndex(0) -4 >Emitted(82, 9) Source(122, 9) + SourceIndex(0) -5 >Emitted(82, 12) Source(122, 12) + SourceIndex(0) -6 >Emitted(82, 13) Source(122, 13) + SourceIndex(0) -7 >Emitted(82, 23) Source(122, 22) + SourceIndex(0) -8 >Emitted(82, 24) Source(122, 23) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > -1 >Emitted(83, 5) Source(122, 27) + SourceIndex(0) -2 >Emitted(83, 11) Source(122, 33) + SourceIndex(0) -3 >Emitted(83, 12) Source(122, 34) + SourceIndex(0) -4 >Emitted(83, 13) Source(122, 35) + SourceIndex(0) -5 >Emitted(83, 14) Source(122, 35) + SourceIndex(0) ---- ->>>}); -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^-> -1 > -2 >} -3 > ) -4 > ; -1 >Emitted(84, 1) Source(122, 36) + SourceIndex(0) -2 >Emitted(84, 2) Source(122, 37) + SourceIndex(0) -3 >Emitted(84, 3) Source(122, 38) + SourceIndex(0) -4 >Emitted(84, 4) Source(122, 39) + SourceIndex(0) +9 > ) { +10> return +11> +12> s +13> +14> +15> } +16> ) +17> ; +1->Emitted(64, 1) Source(122, 1) + SourceIndex(0) +2 >Emitted(64, 6) Source(122, 6) + SourceIndex(0) +3 >Emitted(64, 7) Source(122, 7) + SourceIndex(0) +4 >Emitted(64, 9) Source(122, 9) + SourceIndex(0) +5 >Emitted(64, 12) Source(122, 12) + SourceIndex(0) +6 >Emitted(64, 13) Source(122, 13) + SourceIndex(0) +7 >Emitted(64, 23) Source(122, 22) + SourceIndex(0) +8 >Emitted(64, 24) Source(122, 23) + SourceIndex(0) +9 >Emitted(64, 28) Source(122, 27) + SourceIndex(0) +10>Emitted(64, 34) Source(122, 33) + SourceIndex(0) +11>Emitted(64, 35) Source(122, 34) + SourceIndex(0) +12>Emitted(64, 36) Source(122, 35) + SourceIndex(0) +13>Emitted(64, 37) Source(122, 35) + SourceIndex(0) +14>Emitted(64, 38) Source(122, 36) + SourceIndex(0) +15>Emitted(64, 39) Source(122, 37) + SourceIndex(0) +16>Emitted(64, 40) Source(122, 38) + SourceIndex(0) +17>Emitted(64, 41) Source(122, 39) + SourceIndex(0) --- >>>objc8.t2 = ({ -1-> +1 > 2 >^^^^^ 3 > ^ 4 > ^^ 5 > ^^^ 6 > ^ -1-> +1 > > 2 >objc8 3 > . 4 > t2 5 > = 6 > ( -1->Emitted(85, 1) Source(123, 1) + SourceIndex(0) -2 >Emitted(85, 6) Source(123, 6) + SourceIndex(0) -3 >Emitted(85, 7) Source(123, 7) + SourceIndex(0) -4 >Emitted(85, 9) Source(123, 9) + SourceIndex(0) -5 >Emitted(85, 12) Source(123, 18) + SourceIndex(0) -6 >Emitted(85, 13) Source(123, 19) + SourceIndex(0) +1 >Emitted(65, 1) Source(123, 1) + SourceIndex(0) +2 >Emitted(65, 6) Source(123, 6) + SourceIndex(0) +3 >Emitted(65, 7) Source(123, 7) + SourceIndex(0) +4 >Emitted(65, 9) Source(123, 9) + SourceIndex(0) +5 >Emitted(65, 12) Source(123, 18) + SourceIndex(0) +6 >Emitted(65, 13) Source(123, 19) + SourceIndex(0) --- >>> n: 1 1 >^^^^ @@ -1595,10 +1549,10 @@ sourceFile:contextualTyping.ts 2 > n 3 > : 4 > 1 -1 >Emitted(86, 5) Source(124, 5) + SourceIndex(0) -2 >Emitted(86, 6) Source(124, 6) + SourceIndex(0) -3 >Emitted(86, 8) Source(124, 8) + SourceIndex(0) -4 >Emitted(86, 9) Source(124, 9) + SourceIndex(0) +1 >Emitted(66, 5) Source(124, 5) + SourceIndex(0) +2 >Emitted(66, 6) Source(124, 6) + SourceIndex(0) +3 >Emitted(66, 8) Source(124, 8) + SourceIndex(0) +4 >Emitted(66, 9) Source(124, 9) + SourceIndex(0) --- >>>}); 1 >^ @@ -1609,9 +1563,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > ; -1 >Emitted(87, 2) Source(125, 2) + SourceIndex(0) -2 >Emitted(87, 3) Source(125, 3) + SourceIndex(0) -3 >Emitted(87, 4) Source(125, 4) + SourceIndex(0) +1 >Emitted(67, 2) Source(125, 2) + SourceIndex(0) +2 >Emitted(67, 3) Source(125, 3) + SourceIndex(0) +3 >Emitted(67, 4) Source(125, 4) + SourceIndex(0) --- >>>objc8.t3 = []; 1-> @@ -1621,7 +1575,7 @@ sourceFile:contextualTyping.ts 5 > ^^^ 6 > ^^ 7 > ^ -8 > ^^^^^^^^^^^-> +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >objc8 @@ -1630,69 +1584,64 @@ sourceFile:contextualTyping.ts 5 > = 6 > [] 7 > ; -1->Emitted(88, 1) Source(126, 1) + SourceIndex(0) -2 >Emitted(88, 6) Source(126, 6) + SourceIndex(0) -3 >Emitted(88, 7) Source(126, 7) + SourceIndex(0) -4 >Emitted(88, 9) Source(126, 9) + SourceIndex(0) -5 >Emitted(88, 12) Source(126, 12) + SourceIndex(0) -6 >Emitted(88, 14) Source(126, 14) + SourceIndex(0) -7 >Emitted(88, 15) Source(126, 15) + SourceIndex(0) +1->Emitted(68, 1) Source(126, 1) + SourceIndex(0) +2 >Emitted(68, 6) Source(126, 6) + SourceIndex(0) +3 >Emitted(68, 7) Source(126, 7) + SourceIndex(0) +4 >Emitted(68, 9) Source(126, 9) + SourceIndex(0) +5 >Emitted(68, 12) Source(126, 12) + SourceIndex(0) +6 >Emitted(68, 14) Source(126, 14) + SourceIndex(0) +7 >Emitted(68, 15) Source(126, 15) + SourceIndex(0) --- ->>>objc8.t4 = function () { +>>>objc8.t4 = function () { return ({}); }; 1-> 2 >^^^^^ 3 > ^ 4 > ^^ 5 > ^^^ -6 > ^^^^^^-> +6 > ^^^^^^^^^^^^^^ +7 > ^^^^^^ +8 > ^ +9 > ^ +10> ^^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^^-> 1-> > 2 >objc8 3 > . 4 > t4 5 > = -1->Emitted(89, 1) Source(127, 1) + SourceIndex(0) -2 >Emitted(89, 6) Source(127, 6) + SourceIndex(0) -3 >Emitted(89, 7) Source(127, 7) + SourceIndex(0) -4 >Emitted(89, 9) Source(127, 9) + SourceIndex(0) -5 >Emitted(89, 12) Source(127, 12) + SourceIndex(0) +6 > function() { +7 > return +8 > +9 > ( +10> {} +11> ) +12> +13> +14> } +15> ; +1->Emitted(69, 1) Source(127, 1) + SourceIndex(0) +2 >Emitted(69, 6) Source(127, 6) + SourceIndex(0) +3 >Emitted(69, 7) Source(127, 7) + SourceIndex(0) +4 >Emitted(69, 9) Source(127, 9) + SourceIndex(0) +5 >Emitted(69, 12) Source(127, 12) + SourceIndex(0) +6 >Emitted(69, 26) Source(127, 25) + SourceIndex(0) +7 >Emitted(69, 32) Source(127, 31) + SourceIndex(0) +8 >Emitted(69, 33) Source(127, 38) + SourceIndex(0) +9 >Emitted(69, 34) Source(127, 39) + SourceIndex(0) +10>Emitted(69, 36) Source(127, 41) + SourceIndex(0) +11>Emitted(69, 37) Source(127, 42) + SourceIndex(0) +12>Emitted(69, 38) Source(127, 42) + SourceIndex(0) +13>Emitted(69, 39) Source(127, 43) + SourceIndex(0) +14>Emitted(69, 40) Source(127, 44) + SourceIndex(0) +15>Emitted(69, 41) Source(127, 45) + SourceIndex(0) --- ->>> return ({}); -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1->function() { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1->Emitted(90, 5) Source(127, 25) + SourceIndex(0) -2 >Emitted(90, 11) Source(127, 31) + SourceIndex(0) -3 >Emitted(90, 12) Source(127, 38) + SourceIndex(0) -4 >Emitted(90, 13) Source(127, 39) + SourceIndex(0) -5 >Emitted(90, 15) Source(127, 41) + SourceIndex(0) -6 >Emitted(90, 16) Source(127, 42) + SourceIndex(0) -7 >Emitted(90, 17) Source(127, 42) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(91, 1) Source(127, 43) + SourceIndex(0) -2 >Emitted(91, 2) Source(127, 44) + SourceIndex(0) -3 >Emitted(91, 3) Source(127, 45) + SourceIndex(0) ---- ->>>objc8.t5 = function (n) { +>>>objc8.t5 = function (n) { return ({}); }; 1-> 2 >^^^^^ 3 > ^ @@ -1700,6 +1649,17 @@ sourceFile:contextualTyping.ts 5 > ^^^ 6 > ^^^^^^^^^^ 7 > ^ +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^^^^-> 1-> > 2 >objc8 @@ -1708,50 +1668,35 @@ sourceFile:contextualTyping.ts 5 > = 6 > function( 7 > n -1->Emitted(92, 1) Source(128, 1) + SourceIndex(0) -2 >Emitted(92, 6) Source(128, 6) + SourceIndex(0) -3 >Emitted(92, 7) Source(128, 7) + SourceIndex(0) -4 >Emitted(92, 9) Source(128, 9) + SourceIndex(0) -5 >Emitted(92, 12) Source(128, 12) + SourceIndex(0) -6 >Emitted(92, 22) Source(128, 21) + SourceIndex(0) -7 >Emitted(92, 23) Source(128, 22) + SourceIndex(0) +8 > ) { +9 > return +10> +11> ( +12> {} +13> ) +14> +15> +16> } +17> ; +1->Emitted(70, 1) Source(128, 1) + SourceIndex(0) +2 >Emitted(70, 6) Source(128, 6) + SourceIndex(0) +3 >Emitted(70, 7) Source(128, 7) + SourceIndex(0) +4 >Emitted(70, 9) Source(128, 9) + SourceIndex(0) +5 >Emitted(70, 12) Source(128, 12) + SourceIndex(0) +6 >Emitted(70, 22) Source(128, 21) + SourceIndex(0) +7 >Emitted(70, 23) Source(128, 22) + SourceIndex(0) +8 >Emitted(70, 27) Source(128, 26) + SourceIndex(0) +9 >Emitted(70, 33) Source(128, 32) + SourceIndex(0) +10>Emitted(70, 34) Source(128, 39) + SourceIndex(0) +11>Emitted(70, 35) Source(128, 40) + SourceIndex(0) +12>Emitted(70, 37) Source(128, 42) + SourceIndex(0) +13>Emitted(70, 38) Source(128, 43) + SourceIndex(0) +14>Emitted(70, 39) Source(128, 43) + SourceIndex(0) +15>Emitted(70, 40) Source(128, 44) + SourceIndex(0) +16>Emitted(70, 41) Source(128, 45) + SourceIndex(0) +17>Emitted(70, 42) Source(128, 46) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(93, 5) Source(128, 26) + SourceIndex(0) -2 >Emitted(93, 11) Source(128, 32) + SourceIndex(0) -3 >Emitted(93, 12) Source(128, 39) + SourceIndex(0) -4 >Emitted(93, 13) Source(128, 40) + SourceIndex(0) -5 >Emitted(93, 15) Source(128, 42) + SourceIndex(0) -6 >Emitted(93, 16) Source(128, 43) + SourceIndex(0) -7 >Emitted(93, 17) Source(128, 43) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(94, 1) Source(128, 44) + SourceIndex(0) -2 >Emitted(94, 2) Source(128, 45) + SourceIndex(0) -3 >Emitted(94, 3) Source(128, 46) + SourceIndex(0) ---- ->>>objc8.t6 = function (n, s) { +>>>objc8.t6 = function (n, s) { return ({}); }; 1-> 2 >^^^^^ 3 > ^ @@ -1761,6 +1706,16 @@ sourceFile:contextualTyping.ts 7 > ^ 8 > ^^ 9 > ^ +10> ^^^^ +11> ^^^^^^ +12> ^ +13> ^ +14> ^^ +15> ^ +16> ^ +17> ^ +18> ^ +19> ^ 1-> > 2 >objc8 @@ -1771,60 +1726,54 @@ sourceFile:contextualTyping.ts 7 > n 8 > , 9 > s -1->Emitted(95, 1) Source(129, 1) + SourceIndex(0) -2 >Emitted(95, 6) Source(129, 6) + SourceIndex(0) -3 >Emitted(95, 7) Source(129, 7) + SourceIndex(0) -4 >Emitted(95, 9) Source(129, 9) + SourceIndex(0) -5 >Emitted(95, 12) Source(129, 12) + SourceIndex(0) -6 >Emitted(95, 22) Source(129, 21) + SourceIndex(0) -7 >Emitted(95, 23) Source(129, 22) + SourceIndex(0) -8 >Emitted(95, 25) Source(129, 24) + SourceIndex(0) -9 >Emitted(95, 26) Source(129, 25) + SourceIndex(0) +10> ) { +11> return +12> +13> ( +14> {} +15> ) +16> +17> +18> } +19> ; +1->Emitted(71, 1) Source(129, 1) + SourceIndex(0) +2 >Emitted(71, 6) Source(129, 6) + SourceIndex(0) +3 >Emitted(71, 7) Source(129, 7) + SourceIndex(0) +4 >Emitted(71, 9) Source(129, 9) + SourceIndex(0) +5 >Emitted(71, 12) Source(129, 12) + SourceIndex(0) +6 >Emitted(71, 22) Source(129, 21) + SourceIndex(0) +7 >Emitted(71, 23) Source(129, 22) + SourceIndex(0) +8 >Emitted(71, 25) Source(129, 24) + SourceIndex(0) +9 >Emitted(71, 26) Source(129, 25) + SourceIndex(0) +10>Emitted(71, 30) Source(129, 29) + SourceIndex(0) +11>Emitted(71, 36) Source(129, 35) + SourceIndex(0) +12>Emitted(71, 37) Source(129, 42) + SourceIndex(0) +13>Emitted(71, 38) Source(129, 43) + SourceIndex(0) +14>Emitted(71, 40) Source(129, 45) + SourceIndex(0) +15>Emitted(71, 41) Source(129, 46) + SourceIndex(0) +16>Emitted(71, 42) Source(129, 46) + SourceIndex(0) +17>Emitted(71, 43) Source(129, 47) + SourceIndex(0) +18>Emitted(71, 44) Source(129, 48) + SourceIndex(0) +19>Emitted(71, 45) Source(129, 49) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(96, 5) Source(129, 29) + SourceIndex(0) -2 >Emitted(96, 11) Source(129, 35) + SourceIndex(0) -3 >Emitted(96, 12) Source(129, 42) + SourceIndex(0) -4 >Emitted(96, 13) Source(129, 43) + SourceIndex(0) -5 >Emitted(96, 15) Source(129, 45) + SourceIndex(0) -6 >Emitted(96, 16) Source(129, 46) + SourceIndex(0) -7 >Emitted(96, 17) Source(129, 46) + SourceIndex(0) ---- ->>>}; +>>>objc8.t7 = function (n) { return n; }; 1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(97, 1) Source(129, 47) + SourceIndex(0) -2 >Emitted(97, 2) Source(129, 48) + SourceIndex(0) -3 >Emitted(97, 3) Source(129, 49) + SourceIndex(0) ---- ->>>objc8.t7 = function (n) { -1-> 2 >^^^^^ 3 > ^ 4 > ^^ 5 > ^^^ 6 > ^^^^^^^^^^ 7 > ^ -1-> +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^-> +1 > > 2 >objc8 3 > . @@ -1832,44 +1781,31 @@ sourceFile:contextualTyping.ts 5 > = 6 > function( 7 > n: number -1->Emitted(98, 1) Source(130, 1) + SourceIndex(0) -2 >Emitted(98, 6) Source(130, 6) + SourceIndex(0) -3 >Emitted(98, 7) Source(130, 7) + SourceIndex(0) -4 >Emitted(98, 9) Source(130, 9) + SourceIndex(0) -5 >Emitted(98, 12) Source(130, 12) + SourceIndex(0) -6 >Emitted(98, 22) Source(130, 21) + SourceIndex(0) -7 >Emitted(98, 23) Source(130, 30) + SourceIndex(0) +8 > ) { +9 > return +10> +11> n +12> +13> +14> } +15> ; +1 >Emitted(72, 1) Source(130, 1) + SourceIndex(0) +2 >Emitted(72, 6) Source(130, 6) + SourceIndex(0) +3 >Emitted(72, 7) Source(130, 7) + SourceIndex(0) +4 >Emitted(72, 9) Source(130, 9) + SourceIndex(0) +5 >Emitted(72, 12) Source(130, 12) + SourceIndex(0) +6 >Emitted(72, 22) Source(130, 21) + SourceIndex(0) +7 >Emitted(72, 23) Source(130, 30) + SourceIndex(0) +8 >Emitted(72, 27) Source(130, 34) + SourceIndex(0) +9 >Emitted(72, 33) Source(130, 40) + SourceIndex(0) +10>Emitted(72, 34) Source(130, 41) + SourceIndex(0) +11>Emitted(72, 35) Source(130, 42) + SourceIndex(0) +12>Emitted(72, 36) Source(130, 42) + SourceIndex(0) +13>Emitted(72, 37) Source(130, 43) + SourceIndex(0) +14>Emitted(72, 38) Source(130, 44) + SourceIndex(0) +15>Emitted(72, 39) Source(130, 45) + SourceIndex(0) --- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > -1 >Emitted(99, 5) Source(130, 34) + SourceIndex(0) -2 >Emitted(99, 11) Source(130, 40) + SourceIndex(0) -3 >Emitted(99, 12) Source(130, 41) + SourceIndex(0) -4 >Emitted(99, 13) Source(130, 42) + SourceIndex(0) -5 >Emitted(99, 14) Source(130, 42) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(100, 1) Source(130, 43) + SourceIndex(0) -2 >Emitted(100, 2) Source(130, 44) + SourceIndex(0) -3 >Emitted(100, 3) Source(130, 45) + SourceIndex(0) ---- ->>>objc8.t8 = function (n) { +>>>objc8.t8 = function (n) { return n; }; 1-> 2 >^^^^^ 3 > ^ @@ -1877,6 +1813,14 @@ sourceFile:contextualTyping.ts 5 > ^^^ 6 > ^^^^^^^^^^ 7 > ^ +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ 1-> > > @@ -1886,45 +1830,32 @@ sourceFile:contextualTyping.ts 5 > = 6 > function( 7 > n -1->Emitted(101, 1) Source(132, 1) + SourceIndex(0) -2 >Emitted(101, 6) Source(132, 6) + SourceIndex(0) -3 >Emitted(101, 7) Source(132, 7) + SourceIndex(0) -4 >Emitted(101, 9) Source(132, 9) + SourceIndex(0) -5 >Emitted(101, 12) Source(132, 12) + SourceIndex(0) -6 >Emitted(101, 22) Source(132, 21) + SourceIndex(0) -7 >Emitted(101, 23) Source(132, 22) + SourceIndex(0) ---- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > ; -1 >Emitted(102, 5) Source(132, 26) + SourceIndex(0) -2 >Emitted(102, 11) Source(132, 32) + SourceIndex(0) -3 >Emitted(102, 12) Source(132, 33) + SourceIndex(0) -4 >Emitted(102, 13) Source(132, 34) + SourceIndex(0) -5 >Emitted(102, 14) Source(132, 35) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(103, 1) Source(132, 36) + SourceIndex(0) -2 >Emitted(103, 2) Source(132, 37) + SourceIndex(0) -3 >Emitted(103, 3) Source(132, 38) + SourceIndex(0) +8 > ) { +9 > return +10> +11> n +12> ; +13> +14> } +15> ; +1->Emitted(73, 1) Source(132, 1) + SourceIndex(0) +2 >Emitted(73, 6) Source(132, 6) + SourceIndex(0) +3 >Emitted(73, 7) Source(132, 7) + SourceIndex(0) +4 >Emitted(73, 9) Source(132, 9) + SourceIndex(0) +5 >Emitted(73, 12) Source(132, 12) + SourceIndex(0) +6 >Emitted(73, 22) Source(132, 21) + SourceIndex(0) +7 >Emitted(73, 23) Source(132, 22) + SourceIndex(0) +8 >Emitted(73, 27) Source(132, 26) + SourceIndex(0) +9 >Emitted(73, 33) Source(132, 32) + SourceIndex(0) +10>Emitted(73, 34) Source(132, 33) + SourceIndex(0) +11>Emitted(73, 35) Source(132, 34) + SourceIndex(0) +12>Emitted(73, 36) Source(132, 35) + SourceIndex(0) +13>Emitted(73, 37) Source(132, 36) + SourceIndex(0) +14>Emitted(73, 38) Source(132, 37) + SourceIndex(0) +15>Emitted(73, 39) Source(132, 38) + SourceIndex(0) --- >>>objc8.t9 = [[], []]; -1-> +1 > 2 >^^^^^ 3 > ^ 4 > ^^ @@ -1936,7 +1867,7 @@ sourceFile:contextualTyping.ts 10> ^ 11> ^ 12> ^^^^^^-> -1-> +1 > > 2 >objc8 3 > . @@ -1948,17 +1879,17 @@ sourceFile:contextualTyping.ts 9 > [] 10> ] 11> ; -1->Emitted(104, 1) Source(133, 1) + SourceIndex(0) -2 >Emitted(104, 6) Source(133, 6) + SourceIndex(0) -3 >Emitted(104, 7) Source(133, 7) + SourceIndex(0) -4 >Emitted(104, 9) Source(133, 9) + SourceIndex(0) -5 >Emitted(104, 12) Source(133, 12) + SourceIndex(0) -6 >Emitted(104, 13) Source(133, 13) + SourceIndex(0) -7 >Emitted(104, 15) Source(133, 15) + SourceIndex(0) -8 >Emitted(104, 17) Source(133, 16) + SourceIndex(0) -9 >Emitted(104, 19) Source(133, 18) + SourceIndex(0) -10>Emitted(104, 20) Source(133, 19) + SourceIndex(0) -11>Emitted(104, 21) Source(133, 20) + SourceIndex(0) +1 >Emitted(74, 1) Source(133, 1) + SourceIndex(0) +2 >Emitted(74, 6) Source(133, 6) + SourceIndex(0) +3 >Emitted(74, 7) Source(133, 7) + SourceIndex(0) +4 >Emitted(74, 9) Source(133, 9) + SourceIndex(0) +5 >Emitted(74, 12) Source(133, 12) + SourceIndex(0) +6 >Emitted(74, 13) Source(133, 13) + SourceIndex(0) +7 >Emitted(74, 15) Source(133, 15) + SourceIndex(0) +8 >Emitted(74, 17) Source(133, 16) + SourceIndex(0) +9 >Emitted(74, 19) Source(133, 18) + SourceIndex(0) +10>Emitted(74, 20) Source(133, 19) + SourceIndex(0) +11>Emitted(74, 21) Source(133, 20) + SourceIndex(0) --- >>>objc8.t10 = [({}), ({})]; 1-> @@ -1976,7 +1907,7 @@ sourceFile:contextualTyping.ts 13> ^ 14> ^ 15> ^ -16> ^^^^^^-> +16> ^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >objc8 @@ -1993,23 +1924,23 @@ sourceFile:contextualTyping.ts 13> ) 14> ] 15> ; -1->Emitted(105, 1) Source(134, 1) + SourceIndex(0) -2 >Emitted(105, 6) Source(134, 6) + SourceIndex(0) -3 >Emitted(105, 7) Source(134, 7) + SourceIndex(0) -4 >Emitted(105, 10) Source(134, 10) + SourceIndex(0) -5 >Emitted(105, 13) Source(134, 13) + SourceIndex(0) -6 >Emitted(105, 14) Source(134, 20) + SourceIndex(0) -7 >Emitted(105, 15) Source(134, 21) + SourceIndex(0) -8 >Emitted(105, 17) Source(134, 23) + SourceIndex(0) -9 >Emitted(105, 18) Source(134, 24) + SourceIndex(0) -10>Emitted(105, 20) Source(134, 31) + SourceIndex(0) -11>Emitted(105, 21) Source(134, 32) + SourceIndex(0) -12>Emitted(105, 23) Source(134, 34) + SourceIndex(0) -13>Emitted(105, 24) Source(134, 35) + SourceIndex(0) -14>Emitted(105, 25) Source(134, 36) + SourceIndex(0) -15>Emitted(105, 26) Source(134, 37) + SourceIndex(0) +1->Emitted(75, 1) Source(134, 1) + SourceIndex(0) +2 >Emitted(75, 6) Source(134, 6) + SourceIndex(0) +3 >Emitted(75, 7) Source(134, 7) + SourceIndex(0) +4 >Emitted(75, 10) Source(134, 10) + SourceIndex(0) +5 >Emitted(75, 13) Source(134, 13) + SourceIndex(0) +6 >Emitted(75, 14) Source(134, 20) + SourceIndex(0) +7 >Emitted(75, 15) Source(134, 21) + SourceIndex(0) +8 >Emitted(75, 17) Source(134, 23) + SourceIndex(0) +9 >Emitted(75, 18) Source(134, 24) + SourceIndex(0) +10>Emitted(75, 20) Source(134, 31) + SourceIndex(0) +11>Emitted(75, 21) Source(134, 32) + SourceIndex(0) +12>Emitted(75, 23) Source(134, 34) + SourceIndex(0) +13>Emitted(75, 24) Source(134, 35) + SourceIndex(0) +14>Emitted(75, 25) Source(134, 36) + SourceIndex(0) +15>Emitted(75, 26) Source(134, 37) + SourceIndex(0) --- ->>>objc8.t11 = [function (n, s) { +>>>objc8.t11 = [function (n, s) { return s; }]; 1-> 2 >^^^^^ 3 > ^ @@ -2020,6 +1951,15 @@ sourceFile:contextualTyping.ts 8 > ^ 9 > ^^ 10> ^ +11> ^^^^ +12> ^^^^^^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ +19> ^ 1-> > 2 >objc8 @@ -2031,67 +1971,53 @@ sourceFile:contextualTyping.ts 8 > n 9 > , 10> s -1->Emitted(106, 1) Source(135, 1) + SourceIndex(0) -2 >Emitted(106, 6) Source(135, 6) + SourceIndex(0) -3 >Emitted(106, 7) Source(135, 7) + SourceIndex(0) -4 >Emitted(106, 10) Source(135, 10) + SourceIndex(0) -5 >Emitted(106, 13) Source(135, 13) + SourceIndex(0) -6 >Emitted(106, 14) Source(135, 14) + SourceIndex(0) -7 >Emitted(106, 24) Source(135, 23) + SourceIndex(0) -8 >Emitted(106, 25) Source(135, 24) + SourceIndex(0) -9 >Emitted(106, 27) Source(135, 26) + SourceIndex(0) -10>Emitted(106, 28) Source(135, 27) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(107, 5) Source(135, 31) + SourceIndex(0) -2 >Emitted(107, 11) Source(135, 37) + SourceIndex(0) -3 >Emitted(107, 12) Source(135, 38) + SourceIndex(0) -4 >Emitted(107, 13) Source(135, 39) + SourceIndex(0) -5 >Emitted(107, 14) Source(135, 40) + SourceIndex(0) ---- ->>>}]; -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^-> -1 > -2 >} -3 > ] -4 > ; -1 >Emitted(108, 1) Source(135, 41) + SourceIndex(0) -2 >Emitted(108, 2) Source(135, 42) + SourceIndex(0) -3 >Emitted(108, 3) Source(135, 43) + SourceIndex(0) -4 >Emitted(108, 4) Source(135, 44) + SourceIndex(0) +11> ) { +12> return +13> +14> s +15> ; +16> +17> } +18> ] +19> ; +1->Emitted(76, 1) Source(135, 1) + SourceIndex(0) +2 >Emitted(76, 6) Source(135, 6) + SourceIndex(0) +3 >Emitted(76, 7) Source(135, 7) + SourceIndex(0) +4 >Emitted(76, 10) Source(135, 10) + SourceIndex(0) +5 >Emitted(76, 13) Source(135, 13) + SourceIndex(0) +6 >Emitted(76, 14) Source(135, 14) + SourceIndex(0) +7 >Emitted(76, 24) Source(135, 23) + SourceIndex(0) +8 >Emitted(76, 25) Source(135, 24) + SourceIndex(0) +9 >Emitted(76, 27) Source(135, 26) + SourceIndex(0) +10>Emitted(76, 28) Source(135, 27) + SourceIndex(0) +11>Emitted(76, 32) Source(135, 31) + SourceIndex(0) +12>Emitted(76, 38) Source(135, 37) + SourceIndex(0) +13>Emitted(76, 39) Source(135, 38) + SourceIndex(0) +14>Emitted(76, 40) Source(135, 39) + SourceIndex(0) +15>Emitted(76, 41) Source(135, 40) + SourceIndex(0) +16>Emitted(76, 42) Source(135, 41) + SourceIndex(0) +17>Emitted(76, 43) Source(135, 42) + SourceIndex(0) +18>Emitted(76, 44) Source(135, 43) + SourceIndex(0) +19>Emitted(76, 45) Source(135, 44) + SourceIndex(0) --- >>>objc8.t12 = { -1-> +1 > 2 >^^^^^ 3 > ^ 4 > ^^^ 5 > ^^^ 6 > ^^-> -1-> +1 > > 2 >objc8 3 > . 4 > t12 5 > = -1->Emitted(109, 1) Source(136, 1) + SourceIndex(0) -2 >Emitted(109, 6) Source(136, 6) + SourceIndex(0) -3 >Emitted(109, 7) Source(136, 7) + SourceIndex(0) -4 >Emitted(109, 10) Source(136, 10) + SourceIndex(0) -5 >Emitted(109, 13) Source(136, 13) + SourceIndex(0) +1 >Emitted(77, 1) Source(136, 1) + SourceIndex(0) +2 >Emitted(77, 6) Source(136, 6) + SourceIndex(0) +3 >Emitted(77, 7) Source(136, 7) + SourceIndex(0) +4 >Emitted(77, 10) Source(136, 10) + SourceIndex(0) +5 >Emitted(77, 13) Source(136, 13) + SourceIndex(0) --- >>> foo: ({}) 1->^^^^ @@ -2107,12 +2033,12 @@ sourceFile:contextualTyping.ts 4 > ( 5 > {} 6 > ) -1->Emitted(110, 5) Source(137, 5) + SourceIndex(0) -2 >Emitted(110, 8) Source(137, 8) + SourceIndex(0) -3 >Emitted(110, 10) Source(137, 16) + SourceIndex(0) -4 >Emitted(110, 11) Source(137, 17) + SourceIndex(0) -5 >Emitted(110, 13) Source(137, 19) + SourceIndex(0) -6 >Emitted(110, 14) Source(137, 20) + SourceIndex(0) +1->Emitted(78, 5) Source(137, 5) + SourceIndex(0) +2 >Emitted(78, 8) Source(137, 8) + SourceIndex(0) +3 >Emitted(78, 10) Source(137, 16) + SourceIndex(0) +4 >Emitted(78, 11) Source(137, 17) + SourceIndex(0) +5 >Emitted(78, 13) Source(137, 19) + SourceIndex(0) +6 >Emitted(78, 14) Source(137, 20) + SourceIndex(0) --- >>>}; 1 >^ @@ -2121,8 +2047,8 @@ sourceFile:contextualTyping.ts 1 > >} 2 > -1 >Emitted(111, 2) Source(138, 2) + SourceIndex(0) -2 >Emitted(111, 3) Source(138, 2) + SourceIndex(0) +1 >Emitted(79, 2) Source(138, 2) + SourceIndex(0) +2 >Emitted(79, 3) Source(138, 2) + SourceIndex(0) --- >>>objc8.t13 = ({ 1-> @@ -2131,7 +2057,7 @@ sourceFile:contextualTyping.ts 4 > ^^^ 5 > ^^^ 6 > ^ -7 > ^^^^^^^^^^^^-> +7 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >objc8 @@ -2139,14 +2065,14 @@ sourceFile:contextualTyping.ts 4 > t13 5 > = 6 > ( -1->Emitted(112, 1) Source(139, 1) + SourceIndex(0) -2 >Emitted(112, 6) Source(139, 6) + SourceIndex(0) -3 >Emitted(112, 7) Source(139, 7) + SourceIndex(0) -4 >Emitted(112, 10) Source(139, 10) + SourceIndex(0) -5 >Emitted(112, 13) Source(139, 19) + SourceIndex(0) -6 >Emitted(112, 14) Source(139, 20) + SourceIndex(0) +1->Emitted(80, 1) Source(139, 1) + SourceIndex(0) +2 >Emitted(80, 6) Source(139, 6) + SourceIndex(0) +3 >Emitted(80, 7) Source(139, 7) + SourceIndex(0) +4 >Emitted(80, 10) Source(139, 10) + SourceIndex(0) +5 >Emitted(80, 13) Source(139, 19) + SourceIndex(0) +6 >Emitted(80, 14) Source(139, 20) + SourceIndex(0) --- ->>> f: function (i, s) { +>>> f: function (i, s) { return s; } 1->^^^^ 2 > ^ 3 > ^^ @@ -2154,6 +2080,13 @@ sourceFile:contextualTyping.ts 5 > ^ 6 > ^^ 7 > ^ +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ 1->{ > 2 > f @@ -2162,38 +2095,27 @@ sourceFile:contextualTyping.ts 5 > i 6 > , 7 > s -1->Emitted(113, 5) Source(140, 5) + SourceIndex(0) -2 >Emitted(113, 6) Source(140, 6) + SourceIndex(0) -3 >Emitted(113, 8) Source(140, 8) + SourceIndex(0) -4 >Emitted(113, 18) Source(140, 17) + SourceIndex(0) -5 >Emitted(113, 19) Source(140, 18) + SourceIndex(0) -6 >Emitted(113, 21) Source(140, 20) + SourceIndex(0) -7 >Emitted(113, 22) Source(140, 21) + SourceIndex(0) ---- ->>> return s; -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(114, 9) Source(140, 25) + SourceIndex(0) -2 >Emitted(114, 15) Source(140, 31) + SourceIndex(0) -3 >Emitted(114, 16) Source(140, 32) + SourceIndex(0) -4 >Emitted(114, 17) Source(140, 33) + SourceIndex(0) -5 >Emitted(114, 18) Source(140, 34) + SourceIndex(0) ---- ->>> } -1 >^^^^ -2 > ^ -1 > -2 > } -1 >Emitted(115, 5) Source(140, 35) + SourceIndex(0) -2 >Emitted(115, 6) Source(140, 36) + SourceIndex(0) +8 > ) { +9 > return +10> +11> s +12> ; +13> +14> } +1->Emitted(81, 5) Source(140, 5) + SourceIndex(0) +2 >Emitted(81, 6) Source(140, 6) + SourceIndex(0) +3 >Emitted(81, 8) Source(140, 8) + SourceIndex(0) +4 >Emitted(81, 18) Source(140, 17) + SourceIndex(0) +5 >Emitted(81, 19) Source(140, 18) + SourceIndex(0) +6 >Emitted(81, 21) Source(140, 20) + SourceIndex(0) +7 >Emitted(81, 22) Source(140, 21) + SourceIndex(0) +8 >Emitted(81, 26) Source(140, 25) + SourceIndex(0) +9 >Emitted(81, 32) Source(140, 31) + SourceIndex(0) +10>Emitted(81, 33) Source(140, 32) + SourceIndex(0) +11>Emitted(81, 34) Source(140, 33) + SourceIndex(0) +12>Emitted(81, 35) Source(140, 34) + SourceIndex(0) +13>Emitted(81, 36) Source(140, 35) + SourceIndex(0) +14>Emitted(81, 37) Source(140, 36) + SourceIndex(0) --- >>>}); 1 >^ @@ -2204,9 +2126,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(116, 2) Source(141, 2) + SourceIndex(0) -2 >Emitted(116, 3) Source(141, 3) + SourceIndex(0) -3 >Emitted(116, 4) Source(141, 3) + SourceIndex(0) +1 >Emitted(82, 2) Source(141, 2) + SourceIndex(0) +2 >Emitted(82, 3) Source(141, 3) + SourceIndex(0) +3 >Emitted(82, 4) Source(141, 3) + SourceIndex(0) --- >>>objc8.t14 = ({ 1-> @@ -2222,12 +2144,12 @@ sourceFile:contextualTyping.ts 4 > t14 5 > = 6 > ( -1->Emitted(117, 1) Source(142, 1) + SourceIndex(0) -2 >Emitted(117, 6) Source(142, 6) + SourceIndex(0) -3 >Emitted(117, 7) Source(142, 7) + SourceIndex(0) -4 >Emitted(117, 10) Source(142, 10) + SourceIndex(0) -5 >Emitted(117, 13) Source(142, 19) + SourceIndex(0) -6 >Emitted(117, 14) Source(142, 20) + SourceIndex(0) +1->Emitted(83, 1) Source(142, 1) + SourceIndex(0) +2 >Emitted(83, 6) Source(142, 6) + SourceIndex(0) +3 >Emitted(83, 7) Source(142, 7) + SourceIndex(0) +4 >Emitted(83, 10) Source(142, 10) + SourceIndex(0) +5 >Emitted(83, 13) Source(142, 19) + SourceIndex(0) +6 >Emitted(83, 14) Source(142, 20) + SourceIndex(0) --- >>> a: [] 1 >^^^^ @@ -2239,10 +2161,10 @@ sourceFile:contextualTyping.ts 2 > a 3 > : 4 > [] -1 >Emitted(118, 5) Source(143, 5) + SourceIndex(0) -2 >Emitted(118, 6) Source(143, 6) + SourceIndex(0) -3 >Emitted(118, 8) Source(143, 8) + SourceIndex(0) -4 >Emitted(118, 10) Source(143, 10) + SourceIndex(0) +1 >Emitted(84, 5) Source(143, 5) + SourceIndex(0) +2 >Emitted(84, 6) Source(143, 6) + SourceIndex(0) +3 >Emitted(84, 8) Source(143, 8) + SourceIndex(0) +4 >Emitted(84, 10) Source(143, 10) + SourceIndex(0) --- >>>}); 1 >^ @@ -2253,9 +2175,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(119, 2) Source(144, 2) + SourceIndex(0) -2 >Emitted(119, 3) Source(144, 3) + SourceIndex(0) -3 >Emitted(119, 4) Source(144, 3) + SourceIndex(0) +1 >Emitted(85, 2) Source(144, 2) + SourceIndex(0) +2 >Emitted(85, 3) Source(144, 3) + SourceIndex(0) +3 >Emitted(85, 4) Source(144, 3) + SourceIndex(0) --- >>>// CONTEXT: Function call 1-> @@ -2266,9 +2188,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Function call -1->Emitted(120, 1) Source(146, 1) + SourceIndex(0) -2 >Emitted(120, 1) Source(145, 1) + SourceIndex(0) -3 >Emitted(120, 26) Source(145, 26) + SourceIndex(0) +1->Emitted(86, 1) Source(146, 1) + SourceIndex(0) +2 >Emitted(86, 1) Source(145, 1) + SourceIndex(0) +3 >Emitted(86, 26) Source(145, 26) + SourceIndex(0) --- >>>function c9t5(f) { } 1 >^^^^^^^^^ @@ -2282,11 +2204,11 @@ sourceFile:contextualTyping.ts 3 > ( 4 > f: (n: number) => IFoo 5 > ) {} -1 >Emitted(121, 10) Source(146, 10) + SourceIndex(0) -2 >Emitted(121, 14) Source(146, 14) + SourceIndex(0) -3 >Emitted(121, 15) Source(146, 15) + SourceIndex(0) -4 >Emitted(121, 16) Source(146, 37) + SourceIndex(0) -5 >Emitted(121, 21) Source(146, 41) + SourceIndex(0) +1 >Emitted(87, 10) Source(146, 10) + SourceIndex(0) +2 >Emitted(87, 14) Source(146, 14) + SourceIndex(0) +3 >Emitted(87, 15) Source(146, 15) + SourceIndex(0) +4 >Emitted(87, 16) Source(146, 37) + SourceIndex(0) +5 >Emitted(87, 21) Source(146, 41) + SourceIndex(0) --- >>>; 1 > @@ -2294,8 +2216,8 @@ sourceFile:contextualTyping.ts 3 > ^^^^^^^^^^^^^^^^^^^-> 1 > 2 >; -1 >Emitted(122, 1) Source(146, 41) + SourceIndex(0) -2 >Emitted(122, 2) Source(146, 42) + SourceIndex(0) +1 >Emitted(88, 1) Source(146, 41) + SourceIndex(0) +2 >Emitted(88, 2) Source(146, 42) + SourceIndex(0) --- >>>c9t5(function (n) { 1-> @@ -2310,11 +2232,11 @@ sourceFile:contextualTyping.ts 3 > ( 4 > function( 5 > n -1->Emitted(123, 1) Source(147, 1) + SourceIndex(0) -2 >Emitted(123, 5) Source(147, 5) + SourceIndex(0) -3 >Emitted(123, 6) Source(147, 6) + SourceIndex(0) -4 >Emitted(123, 16) Source(147, 15) + SourceIndex(0) -5 >Emitted(123, 17) Source(147, 16) + SourceIndex(0) +1->Emitted(89, 1) Source(147, 1) + SourceIndex(0) +2 >Emitted(89, 5) Source(147, 5) + SourceIndex(0) +3 >Emitted(89, 6) Source(147, 6) + SourceIndex(0) +4 >Emitted(89, 16) Source(147, 15) + SourceIndex(0) +5 >Emitted(89, 17) Source(147, 16) + SourceIndex(0) --- >>> return ({}); 1->^^^^ @@ -2332,13 +2254,13 @@ sourceFile:contextualTyping.ts 5 > {} 6 > ) 7 > ; -1->Emitted(124, 5) Source(148, 5) + SourceIndex(0) -2 >Emitted(124, 11) Source(148, 11) + SourceIndex(0) -3 >Emitted(124, 12) Source(148, 18) + SourceIndex(0) -4 >Emitted(124, 13) Source(148, 19) + SourceIndex(0) -5 >Emitted(124, 15) Source(148, 21) + SourceIndex(0) -6 >Emitted(124, 16) Source(148, 22) + SourceIndex(0) -7 >Emitted(124, 17) Source(148, 23) + SourceIndex(0) +1->Emitted(90, 5) Source(148, 5) + SourceIndex(0) +2 >Emitted(90, 11) Source(148, 11) + SourceIndex(0) +3 >Emitted(90, 12) Source(148, 18) + SourceIndex(0) +4 >Emitted(90, 13) Source(148, 19) + SourceIndex(0) +5 >Emitted(90, 15) Source(148, 21) + SourceIndex(0) +6 >Emitted(90, 16) Source(148, 22) + SourceIndex(0) +7 >Emitted(90, 17) Source(148, 23) + SourceIndex(0) --- >>>}); 1 > @@ -2351,115 +2273,106 @@ sourceFile:contextualTyping.ts 2 >} 3 > ) 4 > ; -1 >Emitted(125, 1) Source(149, 1) + SourceIndex(0) -2 >Emitted(125, 2) Source(149, 2) + SourceIndex(0) -3 >Emitted(125, 3) Source(149, 3) + SourceIndex(0) -4 >Emitted(125, 4) Source(149, 4) + SourceIndex(0) +1 >Emitted(91, 1) Source(149, 1) + SourceIndex(0) +2 >Emitted(91, 2) Source(149, 2) + SourceIndex(0) +3 >Emitted(91, 3) Source(149, 3) + SourceIndex(0) +4 >Emitted(91, 4) Source(149, 4) + SourceIndex(0) --- >>>// CONTEXT: Return statement 1-> 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > >// CONTEXT: Return statement > 2 > 3 >// CONTEXT: Return statement -1->Emitted(126, 1) Source(152, 1) + SourceIndex(0) -2 >Emitted(126, 1) Source(151, 1) + SourceIndex(0) -3 >Emitted(126, 29) Source(151, 29) + SourceIndex(0) +1->Emitted(92, 1) Source(152, 1) + SourceIndex(0) +2 >Emitted(92, 1) Source(151, 1) + SourceIndex(0) +3 >Emitted(92, 29) Source(151, 29) + SourceIndex(0) --- ->>>var c10t5 = function () { -1 >^^^^ +>>>var c10t5 = function () { return function (n) { return ({}); }; }; +1->^^^^ 2 > ^^^^^ 3 > ^^^ -4 > ^^^^^^^^^^^^^^-> -1 > +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^^^^^^^ +8 > ^ +9 > ^^^^ +10> ^^^^^^ +11> ^ +12> ^ +13> ^^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ +19> ^ +20> ^ +21> ^ +1-> >var 2 > c10t5 3 > : () => (n: number) => IFoo = -1 >Emitted(127, 5) Source(152, 5) + SourceIndex(0) -2 >Emitted(127, 10) Source(152, 10) + SourceIndex(0) -3 >Emitted(127, 13) Source(152, 40) + SourceIndex(0) ---- ->>> return function (n) { -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^ -5 > ^ -1->function() { -2 > return -3 > -4 > function( -5 > n -1->Emitted(128, 5) Source(152, 53) + SourceIndex(0) -2 >Emitted(128, 11) Source(152, 59) + SourceIndex(0) -3 >Emitted(128, 12) Source(152, 60) + SourceIndex(0) -4 >Emitted(128, 22) Source(152, 69) + SourceIndex(0) -5 >Emitted(128, 23) Source(152, 70) + SourceIndex(0) ---- ->>> return ({}); -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(129, 9) Source(152, 74) + SourceIndex(0) -2 >Emitted(129, 15) Source(152, 80) + SourceIndex(0) -3 >Emitted(129, 16) Source(152, 87) + SourceIndex(0) -4 >Emitted(129, 17) Source(152, 88) + SourceIndex(0) -5 >Emitted(129, 19) Source(152, 90) + SourceIndex(0) -6 >Emitted(129, 20) Source(152, 91) + SourceIndex(0) -7 >Emitted(129, 21) Source(152, 91) + SourceIndex(0) ---- ->>> }; -1 >^^^^ -2 > ^ -3 > ^ -1 > -2 > } -3 > -1 >Emitted(130, 5) Source(152, 92) + SourceIndex(0) -2 >Emitted(130, 6) Source(152, 93) + SourceIndex(0) -3 >Emitted(130, 7) Source(152, 93) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(131, 1) Source(152, 94) + SourceIndex(0) -2 >Emitted(131, 2) Source(152, 95) + SourceIndex(0) -3 >Emitted(131, 3) Source(152, 96) + SourceIndex(0) +4 > function() { +5 > return +6 > +7 > function( +8 > n +9 > ) { +10> return +11> +12> ( +13> {} +14> ) +15> +16> +17> } +18> +19> +20> } +21> ; +1->Emitted(93, 5) Source(152, 5) + SourceIndex(0) +2 >Emitted(93, 10) Source(152, 10) + SourceIndex(0) +3 >Emitted(93, 13) Source(152, 40) + SourceIndex(0) +4 >Emitted(93, 27) Source(152, 53) + SourceIndex(0) +5 >Emitted(93, 33) Source(152, 59) + SourceIndex(0) +6 >Emitted(93, 34) Source(152, 60) + SourceIndex(0) +7 >Emitted(93, 44) Source(152, 69) + SourceIndex(0) +8 >Emitted(93, 45) Source(152, 70) + SourceIndex(0) +9 >Emitted(93, 49) Source(152, 74) + SourceIndex(0) +10>Emitted(93, 55) Source(152, 80) + SourceIndex(0) +11>Emitted(93, 56) Source(152, 87) + SourceIndex(0) +12>Emitted(93, 57) Source(152, 88) + SourceIndex(0) +13>Emitted(93, 59) Source(152, 90) + SourceIndex(0) +14>Emitted(93, 60) Source(152, 91) + SourceIndex(0) +15>Emitted(93, 61) Source(152, 91) + SourceIndex(0) +16>Emitted(93, 62) Source(152, 92) + SourceIndex(0) +17>Emitted(93, 63) Source(152, 93) + SourceIndex(0) +18>Emitted(93, 64) Source(152, 93) + SourceIndex(0) +19>Emitted(93, 65) Source(152, 94) + SourceIndex(0) +20>Emitted(93, 66) Source(152, 95) + SourceIndex(0) +21>Emitted(93, 67) Source(152, 96) + SourceIndex(0) --- >>>// CONTEXT: Newing a class -1-> +1 > 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 > ^-> -1-> +1 > > >// CONTEXT: Newing a class > 2 > 3 >// CONTEXT: Newing a class -1->Emitted(132, 1) Source(155, 1) + SourceIndex(0) -2 >Emitted(132, 1) Source(154, 1) + SourceIndex(0) -3 >Emitted(132, 27) Source(154, 27) + SourceIndex(0) +1 >Emitted(94, 1) Source(155, 1) + SourceIndex(0) +2 >Emitted(94, 1) Source(154, 1) + SourceIndex(0) +3 >Emitted(94, 27) Source(154, 27) + SourceIndex(0) --- >>>var C11t5 = (function () { 1->^^^^ @@ -2468,8 +2381,8 @@ sourceFile:contextualTyping.ts 1-> >class 2 > C11t5 -1->Emitted(133, 5) Source(155, 7) + SourceIndex(0) -2 >Emitted(133, 10) Source(155, 12) + SourceIndex(0) +1->Emitted(95, 5) Source(155, 7) + SourceIndex(0) +2 >Emitted(95, 10) Source(155, 12) + SourceIndex(0) --- >>> function C11t5(f) { 1->^^^^ @@ -2482,11 +2395,11 @@ sourceFile:contextualTyping.ts 3 > C11t5 4 > { constructor( 5 > f: (n: number) => IFoo -1->Emitted(134, 5) Source(155, 15) + SourceIndex(0) name (C11t5) -2 >Emitted(134, 14) Source(155, 7) + SourceIndex(0) name (C11t5) -3 >Emitted(134, 19) Source(155, 12) + SourceIndex(0) name (C11t5) -4 >Emitted(134, 20) Source(155, 27) + SourceIndex(0) name (C11t5) -5 >Emitted(134, 21) Source(155, 49) + SourceIndex(0) name (C11t5) +1->Emitted(96, 5) Source(155, 15) + SourceIndex(0) name (C11t5) +2 >Emitted(96, 14) Source(155, 7) + SourceIndex(0) name (C11t5) +3 >Emitted(96, 19) Source(155, 12) + SourceIndex(0) name (C11t5) +4 >Emitted(96, 20) Source(155, 27) + SourceIndex(0) name (C11t5) +5 >Emitted(96, 21) Source(155, 49) + SourceIndex(0) name (C11t5) --- >>> } 1 >^^^^ @@ -2494,16 +2407,16 @@ sourceFile:contextualTyping.ts 3 > ^^^^^^^^^^^^^-> 1 >) { 2 > } -1 >Emitted(135, 5) Source(155, 53) + SourceIndex(0) name (C11t5.constructor) -2 >Emitted(135, 6) Source(155, 54) + SourceIndex(0) name (C11t5.constructor) +1 >Emitted(97, 5) Source(155, 53) + SourceIndex(0) name (C11t5.constructor) +2 >Emitted(97, 6) Source(155, 54) + SourceIndex(0) name (C11t5.constructor) --- >>> return C11t5; 1->^^^^ 2 > ^^^^^^^^^^^^ 1-> 2 > } -1->Emitted(136, 5) Source(155, 55) + SourceIndex(0) name (C11t5) -2 >Emitted(136, 17) Source(155, 56) + SourceIndex(0) name (C11t5) +1->Emitted(98, 5) Source(155, 55) + SourceIndex(0) name (C11t5) +2 >Emitted(98, 17) Source(155, 56) + SourceIndex(0) name (C11t5) --- >>>})(); 1 > @@ -2514,21 +2427,21 @@ sourceFile:contextualTyping.ts 2 >} 3 > 4 > class C11t5 { constructor(f: (n: number) => IFoo) { } } -1 >Emitted(137, 1) Source(155, 55) + SourceIndex(0) name (C11t5) -2 >Emitted(137, 2) Source(155, 56) + SourceIndex(0) name (C11t5) -3 >Emitted(137, 2) Source(155, 1) + SourceIndex(0) -4 >Emitted(137, 6) Source(155, 56) + SourceIndex(0) +1 >Emitted(99, 1) Source(155, 55) + SourceIndex(0) name (C11t5) +2 >Emitted(99, 2) Source(155, 56) + SourceIndex(0) name (C11t5) +3 >Emitted(99, 2) Source(155, 1) + SourceIndex(0) +4 >Emitted(99, 6) Source(155, 56) + SourceIndex(0) --- >>>; 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 >; -1 >Emitted(138, 1) Source(155, 56) + SourceIndex(0) -2 >Emitted(138, 2) Source(155, 57) + SourceIndex(0) +1 >Emitted(100, 1) Source(155, 56) + SourceIndex(0) +2 >Emitted(100, 2) Source(155, 57) + SourceIndex(0) --- ->>>var i = new C11t5(function (n) { +>>>var i = new C11t5(function (n) { return ({}); }); 1-> 2 >^^^^ 3 > ^ @@ -2538,6 +2451,17 @@ sourceFile:contextualTyping.ts 7 > ^ 8 > ^^^^^^^^^^ 9 > ^ +10> ^^^^ +11> ^^^^^^ +12> ^ +13> ^ +14> ^^ +15> ^ +16> ^ +17> ^ +18> ^ +19> ^ +20> ^ 1-> > 2 >var @@ -2548,138 +2472,118 @@ sourceFile:contextualTyping.ts 7 > ( 8 > function( 9 > n -1->Emitted(139, 1) Source(156, 1) + SourceIndex(0) -2 >Emitted(139, 5) Source(156, 5) + SourceIndex(0) -3 >Emitted(139, 6) Source(156, 6) + SourceIndex(0) -4 >Emitted(139, 9) Source(156, 9) + SourceIndex(0) -5 >Emitted(139, 13) Source(156, 13) + SourceIndex(0) -6 >Emitted(139, 18) Source(156, 18) + SourceIndex(0) -7 >Emitted(139, 19) Source(156, 19) + SourceIndex(0) -8 >Emitted(139, 29) Source(156, 28) + SourceIndex(0) -9 >Emitted(139, 30) Source(156, 29) + SourceIndex(0) ---- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(140, 5) Source(156, 33) + SourceIndex(0) -2 >Emitted(140, 11) Source(156, 39) + SourceIndex(0) -3 >Emitted(140, 12) Source(156, 46) + SourceIndex(0) -4 >Emitted(140, 13) Source(156, 47) + SourceIndex(0) -5 >Emitted(140, 15) Source(156, 49) + SourceIndex(0) -6 >Emitted(140, 16) Source(156, 50) + SourceIndex(0) -7 >Emitted(140, 17) Source(156, 50) + SourceIndex(0) ---- ->>>}); -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ) -4 > ; -1 >Emitted(141, 1) Source(156, 51) + SourceIndex(0) -2 >Emitted(141, 2) Source(156, 52) + SourceIndex(0) -3 >Emitted(141, 3) Source(156, 53) + SourceIndex(0) -4 >Emitted(141, 4) Source(156, 54) + SourceIndex(0) +10> ) { +11> return +12> +13> ( +14> {} +15> ) +16> +17> +18> } +19> ) +20> ; +1->Emitted(101, 1) Source(156, 1) + SourceIndex(0) +2 >Emitted(101, 5) Source(156, 5) + SourceIndex(0) +3 >Emitted(101, 6) Source(156, 6) + SourceIndex(0) +4 >Emitted(101, 9) Source(156, 9) + SourceIndex(0) +5 >Emitted(101, 13) Source(156, 13) + SourceIndex(0) +6 >Emitted(101, 18) Source(156, 18) + SourceIndex(0) +7 >Emitted(101, 19) Source(156, 19) + SourceIndex(0) +8 >Emitted(101, 29) Source(156, 28) + SourceIndex(0) +9 >Emitted(101, 30) Source(156, 29) + SourceIndex(0) +10>Emitted(101, 34) Source(156, 33) + SourceIndex(0) +11>Emitted(101, 40) Source(156, 39) + SourceIndex(0) +12>Emitted(101, 41) Source(156, 46) + SourceIndex(0) +13>Emitted(101, 42) Source(156, 47) + SourceIndex(0) +14>Emitted(101, 44) Source(156, 49) + SourceIndex(0) +15>Emitted(101, 45) Source(156, 50) + SourceIndex(0) +16>Emitted(101, 46) Source(156, 50) + SourceIndex(0) +17>Emitted(101, 47) Source(156, 51) + SourceIndex(0) +18>Emitted(101, 48) Source(156, 52) + SourceIndex(0) +19>Emitted(101, 49) Source(156, 53) + SourceIndex(0) +20>Emitted(101, 50) Source(156, 54) + SourceIndex(0) --- >>>// CONTEXT: Type annotated expression -1-> +1 > 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1-> +4 > ^^^^^-> +1 > > >// CONTEXT: Type annotated expression > 2 > 3 >// CONTEXT: Type annotated expression -1->Emitted(142, 1) Source(159, 1) + SourceIndex(0) -2 >Emitted(142, 1) Source(158, 1) + SourceIndex(0) -3 >Emitted(142, 38) Source(158, 38) + SourceIndex(0) +1 >Emitted(102, 1) Source(159, 1) + SourceIndex(0) +2 >Emitted(102, 1) Source(158, 1) + SourceIndex(0) +3 >Emitted(102, 38) Source(158, 38) + SourceIndex(0) --- ->>>var c12t1 = (function (s) { -1 >^^^^ +>>>var c12t1 = (function (s) { return s; }); +1->^^^^ 2 > ^^^^^ 3 > ^^^ 4 > ^ 5 > ^^^^^^^^^^ 6 > ^ -1 > +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ +1-> >var 2 > c12t1 3 > = <(s: string) => string> 4 > ( 5 > function( 6 > s -1 >Emitted(143, 5) Source(159, 5) + SourceIndex(0) -2 >Emitted(143, 10) Source(159, 10) + SourceIndex(0) -3 >Emitted(143, 13) Source(159, 37) + SourceIndex(0) -4 >Emitted(143, 14) Source(159, 38) + SourceIndex(0) -5 >Emitted(143, 24) Source(159, 47) + SourceIndex(0) -6 >Emitted(143, 25) Source(159, 48) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > -1 >Emitted(144, 5) Source(159, 52) + SourceIndex(0) -2 >Emitted(144, 11) Source(159, 58) + SourceIndex(0) -3 >Emitted(144, 12) Source(159, 59) + SourceIndex(0) -4 >Emitted(144, 13) Source(159, 60) + SourceIndex(0) -5 >Emitted(144, 14) Source(159, 60) + SourceIndex(0) ---- ->>>}); -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > ) -4 > ; -1 >Emitted(145, 1) Source(159, 61) + SourceIndex(0) -2 >Emitted(145, 2) Source(159, 62) + SourceIndex(0) -3 >Emitted(145, 3) Source(159, 63) + SourceIndex(0) -4 >Emitted(145, 4) Source(159, 64) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> s +11> +12> +13> } +14> ) +15> ; +1->Emitted(103, 5) Source(159, 5) + SourceIndex(0) +2 >Emitted(103, 10) Source(159, 10) + SourceIndex(0) +3 >Emitted(103, 13) Source(159, 37) + SourceIndex(0) +4 >Emitted(103, 14) Source(159, 38) + SourceIndex(0) +5 >Emitted(103, 24) Source(159, 47) + SourceIndex(0) +6 >Emitted(103, 25) Source(159, 48) + SourceIndex(0) +7 >Emitted(103, 29) Source(159, 52) + SourceIndex(0) +8 >Emitted(103, 35) Source(159, 58) + SourceIndex(0) +9 >Emitted(103, 36) Source(159, 59) + SourceIndex(0) +10>Emitted(103, 37) Source(159, 60) + SourceIndex(0) +11>Emitted(103, 38) Source(159, 60) + SourceIndex(0) +12>Emitted(103, 39) Source(159, 61) + SourceIndex(0) +13>Emitted(103, 40) Source(159, 62) + SourceIndex(0) +14>Emitted(103, 41) Source(159, 63) + SourceIndex(0) +15>Emitted(103, 42) Source(159, 64) + SourceIndex(0) --- >>>var c12t2 = ({ -1-> +1 > 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^ -1-> +1 > > 2 >var 3 > c12t2 4 > = 5 > ( -1->Emitted(146, 1) Source(160, 1) + SourceIndex(0) -2 >Emitted(146, 5) Source(160, 5) + SourceIndex(0) -3 >Emitted(146, 10) Source(160, 10) + SourceIndex(0) -4 >Emitted(146, 13) Source(160, 20) + SourceIndex(0) -5 >Emitted(146, 14) Source(160, 21) + SourceIndex(0) +1 >Emitted(104, 1) Source(160, 1) + SourceIndex(0) +2 >Emitted(104, 5) Source(160, 5) + SourceIndex(0) +3 >Emitted(104, 10) Source(160, 10) + SourceIndex(0) +4 >Emitted(104, 13) Source(160, 20) + SourceIndex(0) +5 >Emitted(104, 14) Source(160, 21) + SourceIndex(0) --- >>> n: 1 1 >^^^^ @@ -2691,10 +2595,10 @@ sourceFile:contextualTyping.ts 2 > n 3 > : 4 > 1 -1 >Emitted(147, 5) Source(161, 5) + SourceIndex(0) -2 >Emitted(147, 6) Source(161, 6) + SourceIndex(0) -3 >Emitted(147, 8) Source(161, 8) + SourceIndex(0) -4 >Emitted(147, 9) Source(161, 9) + SourceIndex(0) +1 >Emitted(105, 5) Source(161, 5) + SourceIndex(0) +2 >Emitted(105, 6) Source(161, 6) + SourceIndex(0) +3 >Emitted(105, 8) Source(161, 8) + SourceIndex(0) +4 >Emitted(105, 9) Source(161, 9) + SourceIndex(0) --- >>>}); 1 >^ @@ -2705,9 +2609,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > ; -1 >Emitted(148, 2) Source(162, 2) + SourceIndex(0) -2 >Emitted(148, 3) Source(162, 3) + SourceIndex(0) -3 >Emitted(148, 4) Source(162, 4) + SourceIndex(0) +1 >Emitted(106, 2) Source(162, 2) + SourceIndex(0) +2 >Emitted(106, 3) Source(162, 3) + SourceIndex(0) +3 >Emitted(106, 4) Source(162, 4) + SourceIndex(0) --- >>>var c12t3 = []; 1-> @@ -2716,7 +2620,7 @@ sourceFile:contextualTyping.ts 4 > ^^^ 5 > ^^ 6 > ^ -7 > ^^^^^^^^^^^-> +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -2724,71 +2628,77 @@ sourceFile:contextualTyping.ts 4 > = 5 > [] 6 > ; -1->Emitted(149, 1) Source(163, 1) + SourceIndex(0) -2 >Emitted(149, 5) Source(163, 5) + SourceIndex(0) -3 >Emitted(149, 10) Source(163, 10) + SourceIndex(0) -4 >Emitted(149, 13) Source(163, 24) + SourceIndex(0) -5 >Emitted(149, 15) Source(163, 26) + SourceIndex(0) -6 >Emitted(149, 16) Source(163, 27) + SourceIndex(0) +1->Emitted(107, 1) Source(163, 1) + SourceIndex(0) +2 >Emitted(107, 5) Source(163, 5) + SourceIndex(0) +3 >Emitted(107, 10) Source(163, 10) + SourceIndex(0) +4 >Emitted(107, 13) Source(163, 24) + SourceIndex(0) +5 >Emitted(107, 15) Source(163, 26) + SourceIndex(0) +6 >Emitted(107, 16) Source(163, 27) + SourceIndex(0) --- ->>>var c12t4 = function () { +>>>var c12t4 = function () { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ -5 > ^^^^^-> +5 > ^^^^^^^^^^^^^^ +6 > ^^^^^^ +7 > ^ +8 > ^ +9 > ^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^^-> 1-> > 2 >var 3 > c12t4 4 > = <() => IFoo> -1->Emitted(150, 1) Source(164, 1) + SourceIndex(0) -2 >Emitted(150, 5) Source(164, 5) + SourceIndex(0) -3 >Emitted(150, 10) Source(164, 10) + SourceIndex(0) -4 >Emitted(150, 13) Source(164, 26) + SourceIndex(0) +5 > function() { +6 > return +7 > +8 > ( +9 > {} +10> ) +11> +12> +13> } +14> ; +1->Emitted(108, 1) Source(164, 1) + SourceIndex(0) +2 >Emitted(108, 5) Source(164, 5) + SourceIndex(0) +3 >Emitted(108, 10) Source(164, 10) + SourceIndex(0) +4 >Emitted(108, 13) Source(164, 26) + SourceIndex(0) +5 >Emitted(108, 27) Source(164, 39) + SourceIndex(0) +6 >Emitted(108, 33) Source(164, 45) + SourceIndex(0) +7 >Emitted(108, 34) Source(164, 52) + SourceIndex(0) +8 >Emitted(108, 35) Source(164, 53) + SourceIndex(0) +9 >Emitted(108, 37) Source(164, 55) + SourceIndex(0) +10>Emitted(108, 38) Source(164, 56) + SourceIndex(0) +11>Emitted(108, 39) Source(164, 56) + SourceIndex(0) +12>Emitted(108, 40) Source(164, 57) + SourceIndex(0) +13>Emitted(108, 41) Source(164, 58) + SourceIndex(0) +14>Emitted(108, 42) Source(164, 59) + SourceIndex(0) --- ->>> return ({}); -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1->function() { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1->Emitted(151, 5) Source(164, 39) + SourceIndex(0) -2 >Emitted(151, 11) Source(164, 45) + SourceIndex(0) -3 >Emitted(151, 12) Source(164, 52) + SourceIndex(0) -4 >Emitted(151, 13) Source(164, 53) + SourceIndex(0) -5 >Emitted(151, 15) Source(164, 55) + SourceIndex(0) -6 >Emitted(151, 16) Source(164, 56) + SourceIndex(0) -7 >Emitted(151, 17) Source(164, 56) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(152, 1) Source(164, 57) + SourceIndex(0) -2 >Emitted(152, 2) Source(164, 58) + SourceIndex(0) -3 >Emitted(152, 3) Source(164, 59) + SourceIndex(0) ---- ->>>var c12t5 = function (n) { +>>>var c12t5 = function (n) { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^^^^-> 1-> > 2 >var @@ -2796,49 +2706,34 @@ sourceFile:contextualTyping.ts 4 > = <(n: number) => IFoo> 5 > function( 6 > n -1->Emitted(153, 1) Source(165, 1) + SourceIndex(0) -2 >Emitted(153, 5) Source(165, 5) + SourceIndex(0) -3 >Emitted(153, 10) Source(165, 10) + SourceIndex(0) -4 >Emitted(153, 13) Source(165, 35) + SourceIndex(0) -5 >Emitted(153, 23) Source(165, 44) + SourceIndex(0) -6 >Emitted(153, 24) Source(165, 45) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> ( +11> {} +12> ) +13> +14> +15> } +16> ; +1->Emitted(109, 1) Source(165, 1) + SourceIndex(0) +2 >Emitted(109, 5) Source(165, 5) + SourceIndex(0) +3 >Emitted(109, 10) Source(165, 10) + SourceIndex(0) +4 >Emitted(109, 13) Source(165, 35) + SourceIndex(0) +5 >Emitted(109, 23) Source(165, 44) + SourceIndex(0) +6 >Emitted(109, 24) Source(165, 45) + SourceIndex(0) +7 >Emitted(109, 28) Source(165, 49) + SourceIndex(0) +8 >Emitted(109, 34) Source(165, 55) + SourceIndex(0) +9 >Emitted(109, 35) Source(165, 62) + SourceIndex(0) +10>Emitted(109, 36) Source(165, 63) + SourceIndex(0) +11>Emitted(109, 38) Source(165, 65) + SourceIndex(0) +12>Emitted(109, 39) Source(165, 66) + SourceIndex(0) +13>Emitted(109, 40) Source(165, 66) + SourceIndex(0) +14>Emitted(109, 41) Source(165, 67) + SourceIndex(0) +15>Emitted(109, 42) Source(165, 68) + SourceIndex(0) +16>Emitted(109, 43) Source(165, 69) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(154, 5) Source(165, 49) + SourceIndex(0) -2 >Emitted(154, 11) Source(165, 55) + SourceIndex(0) -3 >Emitted(154, 12) Source(165, 62) + SourceIndex(0) -4 >Emitted(154, 13) Source(165, 63) + SourceIndex(0) -5 >Emitted(154, 15) Source(165, 65) + SourceIndex(0) -6 >Emitted(154, 16) Source(165, 66) + SourceIndex(0) -7 >Emitted(154, 17) Source(165, 66) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(155, 1) Source(165, 67) + SourceIndex(0) -2 >Emitted(155, 2) Source(165, 68) + SourceIndex(0) -3 >Emitted(155, 3) Source(165, 69) + SourceIndex(0) ---- ->>>var c12t6 = function (n, s) { +>>>var c12t6 = function (n, s) { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^^ @@ -2847,6 +2742,16 @@ sourceFile:contextualTyping.ts 6 > ^ 7 > ^^ 8 > ^ +9 > ^^^^ +10> ^^^^^^ +11> ^ +12> ^ +13> ^^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ 1-> > 2 >var @@ -2856,58 +2761,52 @@ sourceFile:contextualTyping.ts 6 > n 7 > , 8 > s -1->Emitted(156, 1) Source(166, 1) + SourceIndex(0) -2 >Emitted(156, 5) Source(166, 5) + SourceIndex(0) -3 >Emitted(156, 10) Source(166, 10) + SourceIndex(0) -4 >Emitted(156, 13) Source(166, 46) + SourceIndex(0) -5 >Emitted(156, 23) Source(166, 55) + SourceIndex(0) -6 >Emitted(156, 24) Source(166, 56) + SourceIndex(0) -7 >Emitted(156, 26) Source(166, 58) + SourceIndex(0) -8 >Emitted(156, 27) Source(166, 59) + SourceIndex(0) +9 > ) { +10> return +11> +12> ( +13> {} +14> ) +15> +16> +17> } +18> ; +1->Emitted(110, 1) Source(166, 1) + SourceIndex(0) +2 >Emitted(110, 5) Source(166, 5) + SourceIndex(0) +3 >Emitted(110, 10) Source(166, 10) + SourceIndex(0) +4 >Emitted(110, 13) Source(166, 46) + SourceIndex(0) +5 >Emitted(110, 23) Source(166, 55) + SourceIndex(0) +6 >Emitted(110, 24) Source(166, 56) + SourceIndex(0) +7 >Emitted(110, 26) Source(166, 58) + SourceIndex(0) +8 >Emitted(110, 27) Source(166, 59) + SourceIndex(0) +9 >Emitted(110, 31) Source(166, 63) + SourceIndex(0) +10>Emitted(110, 37) Source(166, 69) + SourceIndex(0) +11>Emitted(110, 38) Source(166, 76) + SourceIndex(0) +12>Emitted(110, 39) Source(166, 77) + SourceIndex(0) +13>Emitted(110, 41) Source(166, 79) + SourceIndex(0) +14>Emitted(110, 42) Source(166, 80) + SourceIndex(0) +15>Emitted(110, 43) Source(166, 80) + SourceIndex(0) +16>Emitted(110, 44) Source(166, 81) + SourceIndex(0) +17>Emitted(110, 45) Source(166, 82) + SourceIndex(0) +18>Emitted(110, 46) Source(166, 83) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(157, 5) Source(166, 63) + SourceIndex(0) -2 >Emitted(157, 11) Source(166, 69) + SourceIndex(0) -3 >Emitted(157, 12) Source(166, 76) + SourceIndex(0) -4 >Emitted(157, 13) Source(166, 77) + SourceIndex(0) -5 >Emitted(157, 15) Source(166, 79) + SourceIndex(0) -6 >Emitted(157, 16) Source(166, 80) + SourceIndex(0) -7 >Emitted(157, 17) Source(166, 80) + SourceIndex(0) ---- ->>>}; +>>>var c12t7 = function (n) { return n; }; 1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(158, 1) Source(166, 81) + SourceIndex(0) -2 >Emitted(158, 2) Source(166, 82) + SourceIndex(0) -3 >Emitted(158, 3) Source(166, 83) + SourceIndex(0) ---- ->>>var c12t7 = function (n) { -1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ -1-> +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^-> +1 > > 2 >var 3 > c12t7 @@ -2917,49 +2816,44 @@ sourceFile:contextualTyping.ts > }> 5 > function( 6 > n:number -1->Emitted(159, 1) Source(167, 1) + SourceIndex(0) -2 >Emitted(159, 5) Source(167, 5) + SourceIndex(0) -3 >Emitted(159, 10) Source(167, 10) + SourceIndex(0) -4 >Emitted(159, 13) Source(170, 4) + SourceIndex(0) -5 >Emitted(159, 23) Source(170, 13) + SourceIndex(0) -6 >Emitted(159, 24) Source(170, 21) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> n +11> +12> +13> } +14> ; +1 >Emitted(111, 1) Source(167, 1) + SourceIndex(0) +2 >Emitted(111, 5) Source(167, 5) + SourceIndex(0) +3 >Emitted(111, 10) Source(167, 10) + SourceIndex(0) +4 >Emitted(111, 13) Source(170, 4) + SourceIndex(0) +5 >Emitted(111, 23) Source(170, 13) + SourceIndex(0) +6 >Emitted(111, 24) Source(170, 21) + SourceIndex(0) +7 >Emitted(111, 28) Source(170, 25) + SourceIndex(0) +8 >Emitted(111, 34) Source(170, 31) + SourceIndex(0) +9 >Emitted(111, 35) Source(170, 32) + SourceIndex(0) +10>Emitted(111, 36) Source(170, 33) + SourceIndex(0) +11>Emitted(111, 37) Source(170, 33) + SourceIndex(0) +12>Emitted(111, 38) Source(170, 34) + SourceIndex(0) +13>Emitted(111, 39) Source(170, 35) + SourceIndex(0) +14>Emitted(111, 40) Source(170, 36) + SourceIndex(0) --- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > -1 >Emitted(160, 5) Source(170, 25) + SourceIndex(0) -2 >Emitted(160, 11) Source(170, 31) + SourceIndex(0) -3 >Emitted(160, 12) Source(170, 32) + SourceIndex(0) -4 >Emitted(160, 13) Source(170, 33) + SourceIndex(0) -5 >Emitted(160, 14) Source(170, 33) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(161, 1) Source(170, 34) + SourceIndex(0) -2 >Emitted(161, 2) Source(170, 35) + SourceIndex(0) -3 >Emitted(161, 3) Source(170, 36) + SourceIndex(0) ---- ->>>var c12t8 = function (n) { +>>>var c12t8 = function (n) { return n; }; 1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ 1-> > > @@ -2968,44 +2862,31 @@ sourceFile:contextualTyping.ts 4 > = <(n: number, s: string) => number> 5 > function( 6 > n -1->Emitted(162, 1) Source(172, 1) + SourceIndex(0) -2 >Emitted(162, 5) Source(172, 5) + SourceIndex(0) -3 >Emitted(162, 10) Source(172, 10) + SourceIndex(0) -4 >Emitted(162, 13) Source(172, 48) + SourceIndex(0) -5 >Emitted(162, 23) Source(172, 57) + SourceIndex(0) -6 >Emitted(162, 24) Source(172, 58) + SourceIndex(0) ---- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > ; -1 >Emitted(163, 5) Source(172, 62) + SourceIndex(0) -2 >Emitted(163, 11) Source(172, 68) + SourceIndex(0) -3 >Emitted(163, 12) Source(172, 69) + SourceIndex(0) -4 >Emitted(163, 13) Source(172, 70) + SourceIndex(0) -5 >Emitted(163, 14) Source(172, 71) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(164, 1) Source(172, 72) + SourceIndex(0) -2 >Emitted(164, 2) Source(172, 73) + SourceIndex(0) -3 >Emitted(164, 3) Source(172, 74) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> n +11> ; +12> +13> } +14> ; +1->Emitted(112, 1) Source(172, 1) + SourceIndex(0) +2 >Emitted(112, 5) Source(172, 5) + SourceIndex(0) +3 >Emitted(112, 10) Source(172, 10) + SourceIndex(0) +4 >Emitted(112, 13) Source(172, 48) + SourceIndex(0) +5 >Emitted(112, 23) Source(172, 57) + SourceIndex(0) +6 >Emitted(112, 24) Source(172, 58) + SourceIndex(0) +7 >Emitted(112, 28) Source(172, 62) + SourceIndex(0) +8 >Emitted(112, 34) Source(172, 68) + SourceIndex(0) +9 >Emitted(112, 35) Source(172, 69) + SourceIndex(0) +10>Emitted(112, 36) Source(172, 70) + SourceIndex(0) +11>Emitted(112, 37) Source(172, 71) + SourceIndex(0) +12>Emitted(112, 38) Source(172, 72) + SourceIndex(0) +13>Emitted(112, 39) Source(172, 73) + SourceIndex(0) +14>Emitted(112, 40) Source(172, 74) + SourceIndex(0) --- >>>var c12t9 = [[], []]; -1-> +1 > 2 >^^^^ 3 > ^^^^^ 4 > ^^^ @@ -3016,7 +2897,7 @@ sourceFile:contextualTyping.ts 9 > ^ 10> ^ 11> ^^^^^^-> -1-> +1 > > 2 >var 3 > c12t9 @@ -3027,16 +2908,16 @@ sourceFile:contextualTyping.ts 8 > [] 9 > ] 10> ; -1->Emitted(165, 1) Source(173, 1) + SourceIndex(0) -2 >Emitted(165, 5) Source(173, 5) + SourceIndex(0) -3 >Emitted(165, 10) Source(173, 10) + SourceIndex(0) -4 >Emitted(165, 13) Source(173, 26) + SourceIndex(0) -5 >Emitted(165, 14) Source(173, 27) + SourceIndex(0) -6 >Emitted(165, 16) Source(173, 29) + SourceIndex(0) -7 >Emitted(165, 18) Source(173, 30) + SourceIndex(0) -8 >Emitted(165, 20) Source(173, 32) + SourceIndex(0) -9 >Emitted(165, 21) Source(173, 33) + SourceIndex(0) -10>Emitted(165, 22) Source(173, 34) + SourceIndex(0) +1 >Emitted(113, 1) Source(173, 1) + SourceIndex(0) +2 >Emitted(113, 5) Source(173, 5) + SourceIndex(0) +3 >Emitted(113, 10) Source(173, 10) + SourceIndex(0) +4 >Emitted(113, 13) Source(173, 26) + SourceIndex(0) +5 >Emitted(113, 14) Source(173, 27) + SourceIndex(0) +6 >Emitted(113, 16) Source(173, 29) + SourceIndex(0) +7 >Emitted(113, 18) Source(173, 30) + SourceIndex(0) +8 >Emitted(113, 20) Source(173, 32) + SourceIndex(0) +9 >Emitted(113, 21) Source(173, 33) + SourceIndex(0) +10>Emitted(113, 22) Source(173, 34) + SourceIndex(0) --- >>>var c12t10 = [({}), ({})]; 1-> @@ -3053,7 +2934,7 @@ sourceFile:contextualTyping.ts 12> ^ 13> ^ 14> ^ -15> ^^^^^^-> +15> ^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -3069,22 +2950,22 @@ sourceFile:contextualTyping.ts 12> ) 13> ] 14> ; -1->Emitted(166, 1) Source(174, 1) + SourceIndex(0) -2 >Emitted(166, 5) Source(174, 5) + SourceIndex(0) -3 >Emitted(166, 11) Source(174, 11) + SourceIndex(0) -4 >Emitted(166, 14) Source(174, 23) + SourceIndex(0) -5 >Emitted(166, 15) Source(174, 30) + SourceIndex(0) -6 >Emitted(166, 16) Source(174, 31) + SourceIndex(0) -7 >Emitted(166, 18) Source(174, 33) + SourceIndex(0) -8 >Emitted(166, 19) Source(174, 34) + SourceIndex(0) -9 >Emitted(166, 21) Source(174, 41) + SourceIndex(0) -10>Emitted(166, 22) Source(174, 42) + SourceIndex(0) -11>Emitted(166, 24) Source(174, 44) + SourceIndex(0) -12>Emitted(166, 25) Source(174, 45) + SourceIndex(0) -13>Emitted(166, 26) Source(174, 46) + SourceIndex(0) -14>Emitted(166, 27) Source(174, 47) + SourceIndex(0) +1->Emitted(114, 1) Source(174, 1) + SourceIndex(0) +2 >Emitted(114, 5) Source(174, 5) + SourceIndex(0) +3 >Emitted(114, 11) Source(174, 11) + SourceIndex(0) +4 >Emitted(114, 14) Source(174, 23) + SourceIndex(0) +5 >Emitted(114, 15) Source(174, 30) + SourceIndex(0) +6 >Emitted(114, 16) Source(174, 31) + SourceIndex(0) +7 >Emitted(114, 18) Source(174, 33) + SourceIndex(0) +8 >Emitted(114, 19) Source(174, 34) + SourceIndex(0) +9 >Emitted(114, 21) Source(174, 41) + SourceIndex(0) +10>Emitted(114, 22) Source(174, 42) + SourceIndex(0) +11>Emitted(114, 24) Source(174, 44) + SourceIndex(0) +12>Emitted(114, 25) Source(174, 45) + SourceIndex(0) +13>Emitted(114, 26) Source(174, 46) + SourceIndex(0) +14>Emitted(114, 27) Source(174, 47) + SourceIndex(0) --- ->>>var c12t11 = [function (n, s) { +>>>var c12t11 = [function (n, s) { return s; }]; 1-> 2 >^^^^ 3 > ^^^^^^ @@ -3094,6 +2975,15 @@ sourceFile:contextualTyping.ts 7 > ^ 8 > ^^ 9 > ^ +10> ^^^^ +11> ^^^^^^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ 1-> > 2 >var @@ -3104,63 +2994,49 @@ sourceFile:contextualTyping.ts 7 > n 8 > , 9 > s -1->Emitted(167, 1) Source(175, 1) + SourceIndex(0) -2 >Emitted(167, 5) Source(175, 5) + SourceIndex(0) -3 >Emitted(167, 11) Source(175, 11) + SourceIndex(0) -4 >Emitted(167, 14) Source(175, 52) + SourceIndex(0) -5 >Emitted(167, 15) Source(175, 53) + SourceIndex(0) -6 >Emitted(167, 25) Source(175, 62) + SourceIndex(0) -7 >Emitted(167, 26) Source(175, 63) + SourceIndex(0) -8 >Emitted(167, 28) Source(175, 65) + SourceIndex(0) -9 >Emitted(167, 29) Source(175, 66) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(168, 5) Source(175, 70) + SourceIndex(0) -2 >Emitted(168, 11) Source(175, 76) + SourceIndex(0) -3 >Emitted(168, 12) Source(175, 77) + SourceIndex(0) -4 >Emitted(168, 13) Source(175, 78) + SourceIndex(0) -5 >Emitted(168, 14) Source(175, 79) + SourceIndex(0) ---- ->>>}]; -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > ] -4 > ; -1 >Emitted(169, 1) Source(175, 80) + SourceIndex(0) -2 >Emitted(169, 2) Source(175, 81) + SourceIndex(0) -3 >Emitted(169, 3) Source(175, 82) + SourceIndex(0) -4 >Emitted(169, 4) Source(175, 83) + SourceIndex(0) +10> ) { +11> return +12> +13> s +14> ; +15> +16> } +17> ] +18> ; +1->Emitted(115, 1) Source(175, 1) + SourceIndex(0) +2 >Emitted(115, 5) Source(175, 5) + SourceIndex(0) +3 >Emitted(115, 11) Source(175, 11) + SourceIndex(0) +4 >Emitted(115, 14) Source(175, 52) + SourceIndex(0) +5 >Emitted(115, 15) Source(175, 53) + SourceIndex(0) +6 >Emitted(115, 25) Source(175, 62) + SourceIndex(0) +7 >Emitted(115, 26) Source(175, 63) + SourceIndex(0) +8 >Emitted(115, 28) Source(175, 65) + SourceIndex(0) +9 >Emitted(115, 29) Source(175, 66) + SourceIndex(0) +10>Emitted(115, 33) Source(175, 70) + SourceIndex(0) +11>Emitted(115, 39) Source(175, 76) + SourceIndex(0) +12>Emitted(115, 40) Source(175, 77) + SourceIndex(0) +13>Emitted(115, 41) Source(175, 78) + SourceIndex(0) +14>Emitted(115, 42) Source(175, 79) + SourceIndex(0) +15>Emitted(115, 43) Source(175, 80) + SourceIndex(0) +16>Emitted(115, 44) Source(175, 81) + SourceIndex(0) +17>Emitted(115, 45) Source(175, 82) + SourceIndex(0) +18>Emitted(115, 46) Source(175, 83) + SourceIndex(0) --- >>>var c12t12 = { -1-> +1 > 2 >^^^^ 3 > ^^^^^^ 4 > ^^^ 5 > ^-> -1-> +1 > > 2 >var 3 > c12t12 4 > = -1->Emitted(170, 1) Source(176, 1) + SourceIndex(0) -2 >Emitted(170, 5) Source(176, 5) + SourceIndex(0) -3 >Emitted(170, 11) Source(176, 11) + SourceIndex(0) -4 >Emitted(170, 14) Source(176, 21) + SourceIndex(0) +1 >Emitted(116, 1) Source(176, 1) + SourceIndex(0) +2 >Emitted(116, 5) Source(176, 5) + SourceIndex(0) +3 >Emitted(116, 11) Source(176, 11) + SourceIndex(0) +4 >Emitted(116, 14) Source(176, 21) + SourceIndex(0) --- >>> foo: ({}) 1->^^^^ @@ -3176,12 +3052,12 @@ sourceFile:contextualTyping.ts 4 > ( 5 > {} 6 > ) -1->Emitted(171, 5) Source(177, 5) + SourceIndex(0) -2 >Emitted(171, 8) Source(177, 8) + SourceIndex(0) -3 >Emitted(171, 10) Source(177, 16) + SourceIndex(0) -4 >Emitted(171, 11) Source(177, 17) + SourceIndex(0) -5 >Emitted(171, 13) Source(177, 19) + SourceIndex(0) -6 >Emitted(171, 14) Source(177, 20) + SourceIndex(0) +1->Emitted(117, 5) Source(177, 5) + SourceIndex(0) +2 >Emitted(117, 8) Source(177, 8) + SourceIndex(0) +3 >Emitted(117, 10) Source(177, 16) + SourceIndex(0) +4 >Emitted(117, 11) Source(177, 17) + SourceIndex(0) +5 >Emitted(117, 13) Source(177, 19) + SourceIndex(0) +6 >Emitted(117, 14) Source(177, 20) + SourceIndex(0) --- >>>}; 1 >^ @@ -3190,8 +3066,8 @@ sourceFile:contextualTyping.ts 1 > >} 2 > -1 >Emitted(172, 2) Source(178, 2) + SourceIndex(0) -2 >Emitted(172, 3) Source(178, 2) + SourceIndex(0) +1 >Emitted(118, 2) Source(178, 2) + SourceIndex(0) +2 >Emitted(118, 3) Source(178, 2) + SourceIndex(0) --- >>>var c12t13 = ({ 1-> @@ -3199,20 +3075,20 @@ sourceFile:contextualTyping.ts 3 > ^^^^^^ 4 > ^^^ 5 > ^ -6 > ^^^^^^^^^^^-> +6 > ^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var 3 > c12t13 4 > = 5 > ( -1->Emitted(173, 1) Source(179, 1) + SourceIndex(0) -2 >Emitted(173, 5) Source(179, 5) + SourceIndex(0) -3 >Emitted(173, 11) Source(179, 11) + SourceIndex(0) -4 >Emitted(173, 14) Source(179, 21) + SourceIndex(0) -5 >Emitted(173, 15) Source(179, 22) + SourceIndex(0) +1->Emitted(119, 1) Source(179, 1) + SourceIndex(0) +2 >Emitted(119, 5) Source(179, 5) + SourceIndex(0) +3 >Emitted(119, 11) Source(179, 11) + SourceIndex(0) +4 >Emitted(119, 14) Source(179, 21) + SourceIndex(0) +5 >Emitted(119, 15) Source(179, 22) + SourceIndex(0) --- ->>> f: function (i, s) { +>>> f: function (i, s) { return s; } 1->^^^^ 2 > ^ 3 > ^^ @@ -3220,6 +3096,13 @@ sourceFile:contextualTyping.ts 5 > ^ 6 > ^^ 7 > ^ +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ 1->{ > 2 > f @@ -3228,38 +3111,27 @@ sourceFile:contextualTyping.ts 5 > i 6 > , 7 > s -1->Emitted(174, 5) Source(180, 5) + SourceIndex(0) -2 >Emitted(174, 6) Source(180, 6) + SourceIndex(0) -3 >Emitted(174, 8) Source(180, 8) + SourceIndex(0) -4 >Emitted(174, 18) Source(180, 17) + SourceIndex(0) -5 >Emitted(174, 19) Source(180, 18) + SourceIndex(0) -6 >Emitted(174, 21) Source(180, 20) + SourceIndex(0) -7 >Emitted(174, 22) Source(180, 21) + SourceIndex(0) ---- ->>> return s; -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(175, 9) Source(180, 25) + SourceIndex(0) -2 >Emitted(175, 15) Source(180, 31) + SourceIndex(0) -3 >Emitted(175, 16) Source(180, 32) + SourceIndex(0) -4 >Emitted(175, 17) Source(180, 33) + SourceIndex(0) -5 >Emitted(175, 18) Source(180, 34) + SourceIndex(0) ---- ->>> } -1 >^^^^ -2 > ^ -1 > -2 > } -1 >Emitted(176, 5) Source(180, 35) + SourceIndex(0) -2 >Emitted(176, 6) Source(180, 36) + SourceIndex(0) +8 > ) { +9 > return +10> +11> s +12> ; +13> +14> } +1->Emitted(120, 5) Source(180, 5) + SourceIndex(0) +2 >Emitted(120, 6) Source(180, 6) + SourceIndex(0) +3 >Emitted(120, 8) Source(180, 8) + SourceIndex(0) +4 >Emitted(120, 18) Source(180, 17) + SourceIndex(0) +5 >Emitted(120, 19) Source(180, 18) + SourceIndex(0) +6 >Emitted(120, 21) Source(180, 20) + SourceIndex(0) +7 >Emitted(120, 22) Source(180, 21) + SourceIndex(0) +8 >Emitted(120, 26) Source(180, 25) + SourceIndex(0) +9 >Emitted(120, 32) Source(180, 31) + SourceIndex(0) +10>Emitted(120, 33) Source(180, 32) + SourceIndex(0) +11>Emitted(120, 34) Source(180, 33) + SourceIndex(0) +12>Emitted(120, 35) Source(180, 34) + SourceIndex(0) +13>Emitted(120, 36) Source(180, 35) + SourceIndex(0) +14>Emitted(120, 37) Source(180, 36) + SourceIndex(0) --- >>>}); 1 >^ @@ -3270,9 +3142,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(177, 2) Source(181, 2) + SourceIndex(0) -2 >Emitted(177, 3) Source(181, 3) + SourceIndex(0) -3 >Emitted(177, 4) Source(181, 3) + SourceIndex(0) +1 >Emitted(121, 2) Source(181, 2) + SourceIndex(0) +2 >Emitted(121, 3) Source(181, 3) + SourceIndex(0) +3 >Emitted(121, 4) Source(181, 3) + SourceIndex(0) --- >>>var c12t14 = ({ 1-> @@ -3286,11 +3158,11 @@ sourceFile:contextualTyping.ts 3 > c12t14 4 > = 5 > ( -1->Emitted(178, 1) Source(182, 1) + SourceIndex(0) -2 >Emitted(178, 5) Source(182, 5) + SourceIndex(0) -3 >Emitted(178, 11) Source(182, 11) + SourceIndex(0) -4 >Emitted(178, 14) Source(182, 21) + SourceIndex(0) -5 >Emitted(178, 15) Source(182, 22) + SourceIndex(0) +1->Emitted(122, 1) Source(182, 1) + SourceIndex(0) +2 >Emitted(122, 5) Source(182, 5) + SourceIndex(0) +3 >Emitted(122, 11) Source(182, 11) + SourceIndex(0) +4 >Emitted(122, 14) Source(182, 21) + SourceIndex(0) +5 >Emitted(122, 15) Source(182, 22) + SourceIndex(0) --- >>> a: [] 1 >^^^^ @@ -3302,25 +3174,25 @@ sourceFile:contextualTyping.ts 2 > a 3 > : 4 > [] -1 >Emitted(179, 5) Source(183, 5) + SourceIndex(0) -2 >Emitted(179, 6) Source(183, 6) + SourceIndex(0) -3 >Emitted(179, 8) Source(183, 8) + SourceIndex(0) -4 >Emitted(179, 10) Source(183, 10) + SourceIndex(0) +1 >Emitted(123, 5) Source(183, 5) + SourceIndex(0) +2 >Emitted(123, 6) Source(183, 6) + SourceIndex(0) +3 >Emitted(123, 8) Source(183, 8) + SourceIndex(0) +4 >Emitted(123, 10) Source(183, 10) + SourceIndex(0) --- >>>}); 1 >^ 2 > ^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > >} 2 > ) 3 > -1 >Emitted(180, 2) Source(184, 2) + SourceIndex(0) -2 >Emitted(180, 3) Source(184, 3) + SourceIndex(0) -3 >Emitted(180, 4) Source(184, 3) + SourceIndex(0) +1 >Emitted(124, 2) Source(184, 2) + SourceIndex(0) +2 >Emitted(124, 3) Source(184, 3) + SourceIndex(0) +3 >Emitted(124, 4) Source(184, 3) + SourceIndex(0) --- ->>>function EF1(a, b) { +>>>function EF1(a, b) { return a + b; } 1-> 2 >^^^^^^^^^ 3 > ^^^ @@ -3328,7 +3200,15 @@ sourceFile:contextualTyping.ts 5 > ^ 6 > ^^ 7 > ^ -8 > ^-> +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^^^ +13> ^ +14> ^ +15> ^ +16> ^ 1-> > >// CONTEXT: Contextual typing declarations @@ -3343,48 +3223,34 @@ sourceFile:contextualTyping.ts 5 > a 6 > , 7 > b -1->Emitted(181, 1) Source(191, 1) + SourceIndex(0) -2 >Emitted(181, 10) Source(191, 10) + SourceIndex(0) -3 >Emitted(181, 13) Source(191, 13) + SourceIndex(0) -4 >Emitted(181, 14) Source(191, 14) + SourceIndex(0) -5 >Emitted(181, 15) Source(191, 15) + SourceIndex(0) -6 >Emitted(181, 17) Source(191, 16) + SourceIndex(0) -7 >Emitted(181, 18) Source(191, 17) + SourceIndex(0) ---- ->>> return a + b; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^^ -6 > ^ -7 > ^ -1->) { -2 > return -3 > -4 > a -5 > + -6 > b -7 > ; -1->Emitted(182, 5) Source(191, 21) + SourceIndex(0) name (EF1) -2 >Emitted(182, 11) Source(191, 27) + SourceIndex(0) name (EF1) -3 >Emitted(182, 12) Source(191, 28) + SourceIndex(0) name (EF1) -4 >Emitted(182, 13) Source(191, 29) + SourceIndex(0) name (EF1) -5 >Emitted(182, 16) Source(191, 30) + SourceIndex(0) name (EF1) -6 >Emitted(182, 17) Source(191, 31) + SourceIndex(0) name (EF1) -7 >Emitted(182, 18) Source(191, 32) + SourceIndex(0) name (EF1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -1 >Emitted(183, 1) Source(191, 33) + SourceIndex(0) name (EF1) -2 >Emitted(183, 2) Source(191, 34) + SourceIndex(0) name (EF1) +8 > ) { +9 > return +10> +11> a +12> + +13> b +14> ; +15> +16> } +1->Emitted(125, 1) Source(191, 1) + SourceIndex(0) +2 >Emitted(125, 10) Source(191, 10) + SourceIndex(0) +3 >Emitted(125, 13) Source(191, 13) + SourceIndex(0) +4 >Emitted(125, 14) Source(191, 14) + SourceIndex(0) +5 >Emitted(125, 15) Source(191, 15) + SourceIndex(0) +6 >Emitted(125, 17) Source(191, 16) + SourceIndex(0) +7 >Emitted(125, 18) Source(191, 17) + SourceIndex(0) +8 >Emitted(125, 22) Source(191, 21) + SourceIndex(0) name (EF1) +9 >Emitted(125, 28) Source(191, 27) + SourceIndex(0) name (EF1) +10>Emitted(125, 29) Source(191, 28) + SourceIndex(0) name (EF1) +11>Emitted(125, 30) Source(191, 29) + SourceIndex(0) name (EF1) +12>Emitted(125, 33) Source(191, 30) + SourceIndex(0) name (EF1) +13>Emitted(125, 34) Source(191, 31) + SourceIndex(0) name (EF1) +14>Emitted(125, 35) Source(191, 32) + SourceIndex(0) name (EF1) +15>Emitted(125, 36) Source(191, 33) + SourceIndex(0) name (EF1) +16>Emitted(125, 37) Source(191, 34) + SourceIndex(0) name (EF1) --- >>>var efv = EF1(1, 2); -1-> +1 > 2 >^^^^ 3 > ^^^ 4 > ^^^ @@ -3396,7 +3262,7 @@ sourceFile:contextualTyping.ts 10> ^ 11> ^ 12> ^^^-> -1-> +1 > > > 2 >var @@ -3409,17 +3275,17 @@ sourceFile:contextualTyping.ts 9 > 2 10> ) 11> ; -1->Emitted(184, 1) Source(193, 1) + SourceIndex(0) -2 >Emitted(184, 5) Source(193, 5) + SourceIndex(0) -3 >Emitted(184, 8) Source(193, 8) + SourceIndex(0) -4 >Emitted(184, 11) Source(193, 11) + SourceIndex(0) -5 >Emitted(184, 14) Source(193, 14) + SourceIndex(0) -6 >Emitted(184, 15) Source(193, 15) + SourceIndex(0) -7 >Emitted(184, 16) Source(193, 16) + SourceIndex(0) -8 >Emitted(184, 18) Source(193, 17) + SourceIndex(0) -9 >Emitted(184, 19) Source(193, 18) + SourceIndex(0) -10>Emitted(184, 20) Source(193, 19) + SourceIndex(0) -11>Emitted(184, 21) Source(193, 20) + SourceIndex(0) +1 >Emitted(126, 1) Source(193, 1) + SourceIndex(0) +2 >Emitted(126, 5) Source(193, 5) + SourceIndex(0) +3 >Emitted(126, 8) Source(193, 8) + SourceIndex(0) +4 >Emitted(126, 11) Source(193, 11) + SourceIndex(0) +5 >Emitted(126, 14) Source(193, 14) + SourceIndex(0) +6 >Emitted(126, 15) Source(193, 15) + SourceIndex(0) +7 >Emitted(126, 16) Source(193, 16) + SourceIndex(0) +8 >Emitted(126, 18) Source(193, 17) + SourceIndex(0) +9 >Emitted(126, 19) Source(193, 18) + SourceIndex(0) +10>Emitted(126, 20) Source(193, 19) + SourceIndex(0) +11>Emitted(126, 21) Source(193, 20) + SourceIndex(0) --- >>>function Point(x, y) { 1-> @@ -3450,13 +3316,13 @@ sourceFile:contextualTyping.ts 5 > x 6 > , 7 > y -1->Emitted(185, 1) Source(207, 1) + SourceIndex(0) -2 >Emitted(185, 10) Source(207, 10) + SourceIndex(0) -3 >Emitted(185, 15) Source(207, 15) + SourceIndex(0) -4 >Emitted(185, 16) Source(207, 16) + SourceIndex(0) -5 >Emitted(185, 17) Source(207, 17) + SourceIndex(0) -6 >Emitted(185, 19) Source(207, 19) + SourceIndex(0) -7 >Emitted(185, 20) Source(207, 20) + SourceIndex(0) +1->Emitted(127, 1) Source(207, 1) + SourceIndex(0) +2 >Emitted(127, 10) Source(207, 10) + SourceIndex(0) +3 >Emitted(127, 15) Source(207, 15) + SourceIndex(0) +4 >Emitted(127, 16) Source(207, 16) + SourceIndex(0) +5 >Emitted(127, 17) Source(207, 17) + SourceIndex(0) +6 >Emitted(127, 19) Source(207, 19) + SourceIndex(0) +7 >Emitted(127, 20) Source(207, 20) + SourceIndex(0) --- >>> this.x = x; 1 >^^^^ @@ -3475,13 +3341,13 @@ sourceFile:contextualTyping.ts 5 > = 6 > x 7 > ; -1 >Emitted(186, 5) Source(208, 5) + SourceIndex(0) name (Point) -2 >Emitted(186, 9) Source(208, 9) + SourceIndex(0) name (Point) -3 >Emitted(186, 10) Source(208, 10) + SourceIndex(0) name (Point) -4 >Emitted(186, 11) Source(208, 11) + SourceIndex(0) name (Point) -5 >Emitted(186, 14) Source(208, 14) + SourceIndex(0) name (Point) -6 >Emitted(186, 15) Source(208, 15) + SourceIndex(0) name (Point) -7 >Emitted(186, 16) Source(208, 16) + SourceIndex(0) name (Point) +1 >Emitted(128, 5) Source(208, 5) + SourceIndex(0) name (Point) +2 >Emitted(128, 9) Source(208, 9) + SourceIndex(0) name (Point) +3 >Emitted(128, 10) Source(208, 10) + SourceIndex(0) name (Point) +4 >Emitted(128, 11) Source(208, 11) + SourceIndex(0) name (Point) +5 >Emitted(128, 14) Source(208, 14) + SourceIndex(0) name (Point) +6 >Emitted(128, 15) Source(208, 15) + SourceIndex(0) name (Point) +7 >Emitted(128, 16) Source(208, 16) + SourceIndex(0) name (Point) --- >>> this.y = y; 1->^^^^ @@ -3500,13 +3366,13 @@ sourceFile:contextualTyping.ts 5 > = 6 > y 7 > ; -1->Emitted(187, 5) Source(209, 5) + SourceIndex(0) name (Point) -2 >Emitted(187, 9) Source(209, 9) + SourceIndex(0) name (Point) -3 >Emitted(187, 10) Source(209, 10) + SourceIndex(0) name (Point) -4 >Emitted(187, 11) Source(209, 11) + SourceIndex(0) name (Point) -5 >Emitted(187, 14) Source(209, 14) + SourceIndex(0) name (Point) -6 >Emitted(187, 15) Source(209, 15) + SourceIndex(0) name (Point) -7 >Emitted(187, 16) Source(209, 16) + SourceIndex(0) name (Point) +1->Emitted(129, 5) Source(209, 5) + SourceIndex(0) name (Point) +2 >Emitted(129, 9) Source(209, 9) + SourceIndex(0) name (Point) +3 >Emitted(129, 10) Source(209, 10) + SourceIndex(0) name (Point) +4 >Emitted(129, 11) Source(209, 11) + SourceIndex(0) name (Point) +5 >Emitted(129, 14) Source(209, 14) + SourceIndex(0) name (Point) +6 >Emitted(129, 15) Source(209, 15) + SourceIndex(0) name (Point) +7 >Emitted(129, 16) Source(209, 16) + SourceIndex(0) name (Point) --- >>> return this; 1->^^^^ @@ -3521,11 +3387,11 @@ sourceFile:contextualTyping.ts 3 > 4 > this 5 > ; -1->Emitted(188, 5) Source(211, 5) + SourceIndex(0) name (Point) -2 >Emitted(188, 11) Source(211, 11) + SourceIndex(0) name (Point) -3 >Emitted(188, 12) Source(211, 12) + SourceIndex(0) name (Point) -4 >Emitted(188, 16) Source(211, 16) + SourceIndex(0) name (Point) -5 >Emitted(188, 17) Source(211, 17) + SourceIndex(0) name (Point) +1->Emitted(130, 5) Source(211, 5) + SourceIndex(0) name (Point) +2 >Emitted(130, 11) Source(211, 11) + SourceIndex(0) name (Point) +3 >Emitted(130, 12) Source(211, 12) + SourceIndex(0) name (Point) +4 >Emitted(130, 16) Source(211, 16) + SourceIndex(0) name (Point) +5 >Emitted(130, 17) Source(211, 17) + SourceIndex(0) name (Point) --- >>>} 1 > @@ -3534,8 +3400,8 @@ sourceFile:contextualTyping.ts 1 > > 2 >} -1 >Emitted(189, 1) Source(212, 1) + SourceIndex(0) name (Point) -2 >Emitted(189, 2) Source(212, 2) + SourceIndex(0) name (Point) +1 >Emitted(131, 1) Source(212, 1) + SourceIndex(0) name (Point) +2 >Emitted(131, 2) Source(212, 2) + SourceIndex(0) name (Point) --- >>>Point.origin = new Point(0, 0); 1-> @@ -3567,19 +3433,19 @@ sourceFile:contextualTyping.ts 11> 0 12> ) 13> ; -1->Emitted(190, 1) Source(214, 1) + SourceIndex(0) -2 >Emitted(190, 6) Source(214, 6) + SourceIndex(0) -3 >Emitted(190, 7) Source(214, 7) + SourceIndex(0) -4 >Emitted(190, 13) Source(214, 13) + SourceIndex(0) -5 >Emitted(190, 16) Source(214, 16) + SourceIndex(0) -6 >Emitted(190, 20) Source(214, 20) + SourceIndex(0) -7 >Emitted(190, 25) Source(214, 25) + SourceIndex(0) -8 >Emitted(190, 26) Source(214, 26) + SourceIndex(0) -9 >Emitted(190, 27) Source(214, 27) + SourceIndex(0) -10>Emitted(190, 29) Source(214, 29) + SourceIndex(0) -11>Emitted(190, 30) Source(214, 30) + SourceIndex(0) -12>Emitted(190, 31) Source(214, 31) + SourceIndex(0) -13>Emitted(190, 32) Source(214, 32) + SourceIndex(0) +1->Emitted(132, 1) Source(214, 1) + SourceIndex(0) +2 >Emitted(132, 6) Source(214, 6) + SourceIndex(0) +3 >Emitted(132, 7) Source(214, 7) + SourceIndex(0) +4 >Emitted(132, 13) Source(214, 13) + SourceIndex(0) +5 >Emitted(132, 16) Source(214, 16) + SourceIndex(0) +6 >Emitted(132, 20) Source(214, 20) + SourceIndex(0) +7 >Emitted(132, 25) Source(214, 25) + SourceIndex(0) +8 >Emitted(132, 26) Source(214, 26) + SourceIndex(0) +9 >Emitted(132, 27) Source(214, 27) + SourceIndex(0) +10>Emitted(132, 29) Source(214, 29) + SourceIndex(0) +11>Emitted(132, 30) Source(214, 30) + SourceIndex(0) +12>Emitted(132, 31) Source(214, 31) + SourceIndex(0) +13>Emitted(132, 32) Source(214, 32) + SourceIndex(0) --- >>>Point.prototype.add = function (dx, dy) { 1-> @@ -3607,17 +3473,17 @@ sourceFile:contextualTyping.ts 9 > dx 10> , 11> dy -1->Emitted(191, 1) Source(216, 1) + SourceIndex(0) -2 >Emitted(191, 6) Source(216, 6) + SourceIndex(0) -3 >Emitted(191, 7) Source(216, 7) + SourceIndex(0) -4 >Emitted(191, 16) Source(216, 16) + SourceIndex(0) -5 >Emitted(191, 17) Source(216, 17) + SourceIndex(0) -6 >Emitted(191, 20) Source(216, 20) + SourceIndex(0) -7 >Emitted(191, 23) Source(216, 23) + SourceIndex(0) -8 >Emitted(191, 33) Source(216, 32) + SourceIndex(0) -9 >Emitted(191, 35) Source(216, 34) + SourceIndex(0) -10>Emitted(191, 37) Source(216, 36) + SourceIndex(0) -11>Emitted(191, 39) Source(216, 38) + SourceIndex(0) +1->Emitted(133, 1) Source(216, 1) + SourceIndex(0) +2 >Emitted(133, 6) Source(216, 6) + SourceIndex(0) +3 >Emitted(133, 7) Source(216, 7) + SourceIndex(0) +4 >Emitted(133, 16) Source(216, 16) + SourceIndex(0) +5 >Emitted(133, 17) Source(216, 17) + SourceIndex(0) +6 >Emitted(133, 20) Source(216, 20) + SourceIndex(0) +7 >Emitted(133, 23) Source(216, 23) + SourceIndex(0) +8 >Emitted(133, 33) Source(216, 32) + SourceIndex(0) +9 >Emitted(133, 35) Source(216, 34) + SourceIndex(0) +10>Emitted(133, 37) Source(216, 36) + SourceIndex(0) +11>Emitted(133, 39) Source(216, 38) + SourceIndex(0) --- >>> return new Point(this.x + dx, this.y + dy); 1->^^^^ @@ -3659,25 +3525,25 @@ sourceFile:contextualTyping.ts 17> dy 18> ) 19> ; -1->Emitted(192, 5) Source(217, 5) + SourceIndex(0) -2 >Emitted(192, 11) Source(217, 11) + SourceIndex(0) -3 >Emitted(192, 12) Source(217, 12) + SourceIndex(0) -4 >Emitted(192, 16) Source(217, 16) + SourceIndex(0) -5 >Emitted(192, 21) Source(217, 21) + SourceIndex(0) -6 >Emitted(192, 22) Source(217, 22) + SourceIndex(0) -7 >Emitted(192, 26) Source(217, 26) + SourceIndex(0) -8 >Emitted(192, 27) Source(217, 27) + SourceIndex(0) -9 >Emitted(192, 28) Source(217, 28) + SourceIndex(0) -10>Emitted(192, 31) Source(217, 31) + SourceIndex(0) -11>Emitted(192, 33) Source(217, 33) + SourceIndex(0) -12>Emitted(192, 35) Source(217, 35) + SourceIndex(0) -13>Emitted(192, 39) Source(217, 39) + SourceIndex(0) -14>Emitted(192, 40) Source(217, 40) + SourceIndex(0) -15>Emitted(192, 41) Source(217, 41) + SourceIndex(0) -16>Emitted(192, 44) Source(217, 44) + SourceIndex(0) -17>Emitted(192, 46) Source(217, 46) + SourceIndex(0) -18>Emitted(192, 47) Source(217, 47) + SourceIndex(0) -19>Emitted(192, 48) Source(217, 48) + SourceIndex(0) +1->Emitted(134, 5) Source(217, 5) + SourceIndex(0) +2 >Emitted(134, 11) Source(217, 11) + SourceIndex(0) +3 >Emitted(134, 12) Source(217, 12) + SourceIndex(0) +4 >Emitted(134, 16) Source(217, 16) + SourceIndex(0) +5 >Emitted(134, 21) Source(217, 21) + SourceIndex(0) +6 >Emitted(134, 22) Source(217, 22) + SourceIndex(0) +7 >Emitted(134, 26) Source(217, 26) + SourceIndex(0) +8 >Emitted(134, 27) Source(217, 27) + SourceIndex(0) +9 >Emitted(134, 28) Source(217, 28) + SourceIndex(0) +10>Emitted(134, 31) Source(217, 31) + SourceIndex(0) +11>Emitted(134, 33) Source(217, 33) + SourceIndex(0) +12>Emitted(134, 35) Source(217, 35) + SourceIndex(0) +13>Emitted(134, 39) Source(217, 39) + SourceIndex(0) +14>Emitted(134, 40) Source(217, 40) + SourceIndex(0) +15>Emitted(134, 41) Source(217, 41) + SourceIndex(0) +16>Emitted(134, 44) Source(217, 44) + SourceIndex(0) +17>Emitted(134, 46) Source(217, 46) + SourceIndex(0) +18>Emitted(134, 47) Source(217, 47) + SourceIndex(0) +19>Emitted(134, 48) Source(217, 48) + SourceIndex(0) --- >>>}; 1 > @@ -3688,9 +3554,9 @@ sourceFile:contextualTyping.ts > 2 >} 3 > ; -1 >Emitted(193, 1) Source(218, 1) + SourceIndex(0) -2 >Emitted(193, 2) Source(218, 2) + SourceIndex(0) -3 >Emitted(193, 3) Source(218, 3) + SourceIndex(0) +1 >Emitted(135, 1) Source(218, 1) + SourceIndex(0) +2 >Emitted(135, 2) Source(218, 2) + SourceIndex(0) +3 >Emitted(135, 3) Source(218, 3) + SourceIndex(0) --- >>>Point.prototype = { 1-> @@ -3705,11 +3571,11 @@ sourceFile:contextualTyping.ts 3 > . 4 > prototype 5 > = -1->Emitted(194, 1) Source(220, 1) + SourceIndex(0) -2 >Emitted(194, 6) Source(220, 6) + SourceIndex(0) -3 >Emitted(194, 7) Source(220, 7) + SourceIndex(0) -4 >Emitted(194, 16) Source(220, 16) + SourceIndex(0) -5 >Emitted(194, 19) Source(220, 19) + SourceIndex(0) +1->Emitted(136, 1) Source(220, 1) + SourceIndex(0) +2 >Emitted(136, 6) Source(220, 6) + SourceIndex(0) +3 >Emitted(136, 7) Source(220, 7) + SourceIndex(0) +4 >Emitted(136, 16) Source(220, 16) + SourceIndex(0) +5 >Emitted(136, 19) Source(220, 19) + SourceIndex(0) --- >>> x: 0, 1 >^^^^ @@ -3722,10 +3588,10 @@ sourceFile:contextualTyping.ts 2 > x 3 > : 4 > 0 -1 >Emitted(195, 5) Source(221, 5) + SourceIndex(0) -2 >Emitted(195, 6) Source(221, 6) + SourceIndex(0) -3 >Emitted(195, 8) Source(221, 8) + SourceIndex(0) -4 >Emitted(195, 9) Source(221, 9) + SourceIndex(0) +1 >Emitted(137, 5) Source(221, 5) + SourceIndex(0) +2 >Emitted(137, 6) Source(221, 6) + SourceIndex(0) +3 >Emitted(137, 8) Source(221, 8) + SourceIndex(0) +4 >Emitted(137, 9) Source(221, 9) + SourceIndex(0) --- >>> y: 0, 1->^^^^ @@ -3738,10 +3604,10 @@ sourceFile:contextualTyping.ts 2 > y 3 > : 4 > 0 -1->Emitted(196, 5) Source(222, 5) + SourceIndex(0) -2 >Emitted(196, 6) Source(222, 6) + SourceIndex(0) -3 >Emitted(196, 8) Source(222, 8) + SourceIndex(0) -4 >Emitted(196, 9) Source(222, 9) + SourceIndex(0) +1->Emitted(138, 5) Source(222, 5) + SourceIndex(0) +2 >Emitted(138, 6) Source(222, 6) + SourceIndex(0) +3 >Emitted(138, 8) Source(222, 8) + SourceIndex(0) +4 >Emitted(138, 9) Source(222, 9) + SourceIndex(0) --- >>> add: function (dx, dy) { 1->^^^^ @@ -3760,13 +3626,13 @@ sourceFile:contextualTyping.ts 5 > dx 6 > , 7 > dy -1->Emitted(197, 5) Source(223, 5) + SourceIndex(0) -2 >Emitted(197, 8) Source(223, 8) + SourceIndex(0) -3 >Emitted(197, 10) Source(223, 10) + SourceIndex(0) -4 >Emitted(197, 20) Source(223, 19) + SourceIndex(0) -5 >Emitted(197, 22) Source(223, 21) + SourceIndex(0) -6 >Emitted(197, 24) Source(223, 23) + SourceIndex(0) -7 >Emitted(197, 26) Source(223, 25) + SourceIndex(0) +1->Emitted(139, 5) Source(223, 5) + SourceIndex(0) +2 >Emitted(139, 8) Source(223, 8) + SourceIndex(0) +3 >Emitted(139, 10) Source(223, 10) + SourceIndex(0) +4 >Emitted(139, 20) Source(223, 19) + SourceIndex(0) +5 >Emitted(139, 22) Source(223, 21) + SourceIndex(0) +6 >Emitted(139, 24) Source(223, 23) + SourceIndex(0) +7 >Emitted(139, 26) Source(223, 25) + SourceIndex(0) --- >>> return new Point(this.x + dx, this.y + dy); 1->^^^^^^^^ @@ -3808,25 +3674,25 @@ sourceFile:contextualTyping.ts 17> dy 18> ) 19> ; -1->Emitted(198, 9) Source(224, 9) + SourceIndex(0) -2 >Emitted(198, 15) Source(224, 15) + SourceIndex(0) -3 >Emitted(198, 16) Source(224, 16) + SourceIndex(0) -4 >Emitted(198, 20) Source(224, 20) + SourceIndex(0) -5 >Emitted(198, 25) Source(224, 25) + SourceIndex(0) -6 >Emitted(198, 26) Source(224, 26) + SourceIndex(0) -7 >Emitted(198, 30) Source(224, 30) + SourceIndex(0) -8 >Emitted(198, 31) Source(224, 31) + SourceIndex(0) -9 >Emitted(198, 32) Source(224, 32) + SourceIndex(0) -10>Emitted(198, 35) Source(224, 35) + SourceIndex(0) -11>Emitted(198, 37) Source(224, 37) + SourceIndex(0) -12>Emitted(198, 39) Source(224, 39) + SourceIndex(0) -13>Emitted(198, 43) Source(224, 43) + SourceIndex(0) -14>Emitted(198, 44) Source(224, 44) + SourceIndex(0) -15>Emitted(198, 45) Source(224, 45) + SourceIndex(0) -16>Emitted(198, 48) Source(224, 48) + SourceIndex(0) -17>Emitted(198, 50) Source(224, 50) + SourceIndex(0) -18>Emitted(198, 51) Source(224, 51) + SourceIndex(0) -19>Emitted(198, 52) Source(224, 52) + SourceIndex(0) +1->Emitted(140, 9) Source(224, 9) + SourceIndex(0) +2 >Emitted(140, 15) Source(224, 15) + SourceIndex(0) +3 >Emitted(140, 16) Source(224, 16) + SourceIndex(0) +4 >Emitted(140, 20) Source(224, 20) + SourceIndex(0) +5 >Emitted(140, 25) Source(224, 25) + SourceIndex(0) +6 >Emitted(140, 26) Source(224, 26) + SourceIndex(0) +7 >Emitted(140, 30) Source(224, 30) + SourceIndex(0) +8 >Emitted(140, 31) Source(224, 31) + SourceIndex(0) +9 >Emitted(140, 32) Source(224, 32) + SourceIndex(0) +10>Emitted(140, 35) Source(224, 35) + SourceIndex(0) +11>Emitted(140, 37) Source(224, 37) + SourceIndex(0) +12>Emitted(140, 39) Source(224, 39) + SourceIndex(0) +13>Emitted(140, 43) Source(224, 43) + SourceIndex(0) +14>Emitted(140, 44) Source(224, 44) + SourceIndex(0) +15>Emitted(140, 45) Source(224, 45) + SourceIndex(0) +16>Emitted(140, 48) Source(224, 48) + SourceIndex(0) +17>Emitted(140, 50) Source(224, 50) + SourceIndex(0) +18>Emitted(140, 51) Source(224, 51) + SourceIndex(0) +19>Emitted(140, 52) Source(224, 52) + SourceIndex(0) --- >>> } 1 >^^^^ @@ -3834,8 +3700,8 @@ sourceFile:contextualTyping.ts 1 > > 2 > } -1 >Emitted(199, 5) Source(225, 5) + SourceIndex(0) -2 >Emitted(199, 6) Source(225, 6) + SourceIndex(0) +1 >Emitted(141, 5) Source(225, 5) + SourceIndex(0) +2 >Emitted(141, 6) Source(225, 6) + SourceIndex(0) --- >>>}; 1 >^ @@ -3844,8 +3710,8 @@ sourceFile:contextualTyping.ts 1 > >} 2 > ; -1 >Emitted(200, 2) Source(226, 2) + SourceIndex(0) -2 >Emitted(200, 3) Source(226, 3) + SourceIndex(0) +1 >Emitted(142, 2) Source(226, 2) + SourceIndex(0) +2 >Emitted(142, 3) Source(226, 3) + SourceIndex(0) --- >>>var x = {}; 1-> @@ -3865,11 +3731,11 @@ sourceFile:contextualTyping.ts 4 > : B = 5 > { } 6 > ; -1->Emitted(201, 1) Source(230, 1) + SourceIndex(0) -2 >Emitted(201, 5) Source(230, 5) + SourceIndex(0) -3 >Emitted(201, 6) Source(230, 6) + SourceIndex(0) -4 >Emitted(201, 9) Source(230, 12) + SourceIndex(0) -5 >Emitted(201, 11) Source(230, 15) + SourceIndex(0) -6 >Emitted(201, 12) Source(230, 16) + SourceIndex(0) +1->Emitted(143, 1) Source(230, 1) + SourceIndex(0) +2 >Emitted(143, 5) Source(230, 5) + SourceIndex(0) +3 >Emitted(143, 6) Source(230, 6) + SourceIndex(0) +4 >Emitted(143, 9) Source(230, 12) + SourceIndex(0) +5 >Emitted(143, 11) Source(230, 15) + SourceIndex(0) +6 >Emitted(143, 12) Source(230, 16) + SourceIndex(0) --- >>>//# sourceMappingURL=contextualTyping.js.map \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping13.js b/tests/baselines/reference/contextualTyping13.js index c035434342e..7965745b943 100644 --- a/tests/baselines/reference/contextualTyping13.js +++ b/tests/baselines/reference/contextualTyping13.js @@ -2,6 +2,4 @@ var foo:(a:number)=>number = function(a){return a}; //// [contextualTyping13.js] -var foo = function (a) { - return a; -}; +var foo = function (a) { return a; }; diff --git a/tests/baselines/reference/contextualTyping14.js b/tests/baselines/reference/contextualTyping14.js index ea9539ef41e..5bae8c948a2 100644 --- a/tests/baselines/reference/contextualTyping14.js +++ b/tests/baselines/reference/contextualTyping14.js @@ -4,9 +4,7 @@ class foo { public bar:(a:number)=>number = function(a){return a}; } //// [contextualTyping14.js] var foo = (function () { function foo() { - this.bar = function (a) { - return a; - }; + this.bar = function (a) { return a; }; } return foo; })(); diff --git a/tests/baselines/reference/contextualTyping15.js b/tests/baselines/reference/contextualTyping15.js index 99855681571..250076ec4d5 100644 --- a/tests/baselines/reference/contextualTyping15.js +++ b/tests/baselines/reference/contextualTyping15.js @@ -4,9 +4,7 @@ class foo { public bar: { (): number; (i: number): number; } = function() { retu //// [contextualTyping15.js] var foo = (function () { function foo() { - this.bar = function () { - return 1; - }; + this.bar = function () { return 1; }; } return foo; })(); diff --git a/tests/baselines/reference/contextualTyping22.js b/tests/baselines/reference/contextualTyping22.js index b8ebfd3ecb7..3c9a5cb4d3e 100644 --- a/tests/baselines/reference/contextualTyping22.js +++ b/tests/baselines/reference/contextualTyping22.js @@ -2,9 +2,5 @@ var foo:(a:number)=>number = function(a){return a}; foo = function(b){return b}; //// [contextualTyping22.js] -var foo = function (a) { - return a; -}; -foo = function (b) { - return b; -}; +var foo = function (a) { return a; }; +foo = function (b) { return b; }; diff --git a/tests/baselines/reference/contextualTyping23.js b/tests/baselines/reference/contextualTyping23.js index 187fd3f86d3..0207f6af15d 100644 --- a/tests/baselines/reference/contextualTyping23.js +++ b/tests/baselines/reference/contextualTyping23.js @@ -3,6 +3,4 @@ var foo:(a:{():number; (i:number):number; })=>number; foo = function(a){return 5 //// [contextualTyping23.js] var foo; -foo = function (a) { - return 5; -}; +foo = function (a) { return 5; }; diff --git a/tests/baselines/reference/contextualTyping24.js b/tests/baselines/reference/contextualTyping24.js index 170a6983b9f..04c4ecba21b 100644 --- a/tests/baselines/reference/contextualTyping24.js +++ b/tests/baselines/reference/contextualTyping24.js @@ -3,6 +3,4 @@ var foo:(a:{():number; (i:number):number; })=>number; foo = function(a:string){r //// [contextualTyping24.js] var foo; -foo = function (a) { - return 5; -}; +foo = function (a) { return 5; }; diff --git a/tests/baselines/reference/contextualTyping32.js b/tests/baselines/reference/contextualTyping32.js index 992724d4130..bbbafa70796 100644 --- a/tests/baselines/reference/contextualTyping32.js +++ b/tests/baselines/reference/contextualTyping32.js @@ -4,8 +4,4 @@ function foo(param: {():number; (i:number):number; }[]) { }; foo([function(){ret //// [contextualTyping32.js] function foo(param) { } ; -foo([function () { - return 1; -}, function () { - return 4; -}]); +foo([function () { return 1; }, function () { return 4; }]); diff --git a/tests/baselines/reference/contextualTyping33.js b/tests/baselines/reference/contextualTyping33.js index 0ca0c965b8b..1d800b1d113 100644 --- a/tests/baselines/reference/contextualTyping33.js +++ b/tests/baselines/reference/contextualTyping33.js @@ -4,8 +4,4 @@ function foo(param: {():number; (i:number):number; }[]) { }; foo([function(){ret //// [contextualTyping33.js] function foo(param) { } ; -foo([function () { - return 1; -}, function () { - return "foo"; -}]); +foo([function () { return 1; }, function () { return "foo"; }]); diff --git a/tests/baselines/reference/contextualTyping38.js b/tests/baselines/reference/contextualTyping38.js index 71ed8ece57d..9bed543ff7f 100644 --- a/tests/baselines/reference/contextualTyping38.js +++ b/tests/baselines/reference/contextualTyping38.js @@ -2,6 +2,4 @@ var foo = <{ (): number; }> function(a) { return a }; //// [contextualTyping38.js] -var foo = function (a) { - return a; -}; +var foo = function (a) { return a; }; diff --git a/tests/baselines/reference/contextualTyping39.js b/tests/baselines/reference/contextualTyping39.js index 9a97b7eb3cc..89d045830a3 100644 --- a/tests/baselines/reference/contextualTyping39.js +++ b/tests/baselines/reference/contextualTyping39.js @@ -2,6 +2,4 @@ var foo = <{ (): number; }> function() { return "err"; }; //// [contextualTyping39.js] -var foo = function () { - return "err"; -}; +var foo = function () { return "err"; }; diff --git a/tests/baselines/reference/contextualTyping40.js b/tests/baselines/reference/contextualTyping40.js index ba2c447b10f..0b98f8e45c6 100644 --- a/tests/baselines/reference/contextualTyping40.js +++ b/tests/baselines/reference/contextualTyping40.js @@ -2,6 +2,4 @@ var foo = <{():number; (i:number):number; }> function(){return 1;}; //// [contextualTyping40.js] -var foo = function () { - return 1; -}; +var foo = function () { return 1; }; diff --git a/tests/baselines/reference/contextualTyping41.js b/tests/baselines/reference/contextualTyping41.js index 720f1d178f6..8bce7918dd2 100644 --- a/tests/baselines/reference/contextualTyping41.js +++ b/tests/baselines/reference/contextualTyping41.js @@ -2,6 +2,4 @@ var foo = <{():number; (i:number):number; }> (function(){return "err";}); //// [contextualTyping41.js] -var foo = (function () { - return "err"; -}); +var foo = (function () { return "err"; }); diff --git a/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.js b/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.js index b2a8bf0dba1..8142b51dcdd 100644 --- a/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.js +++ b/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.js @@ -22,10 +22,6 @@ var r6 = _.forEach(c2, (x) => { return x.toFixed() }); var c2; var _; // errors on all 3 lines, bug was that r5 was the only line with errors -var f = function (x) { - return x.toFixed(); -}; +var f = function (x) { return x.toFixed(); }; var r5 = _.forEach(c2, f); -var r6 = _.forEach(c2, function (x) { - return x.toFixed(); -}); +var r6 = _.forEach(c2, function (x) { return x.toFixed(); }); diff --git a/tests/baselines/reference/contextualTypingOfLambdaReturnExpression.js b/tests/baselines/reference/contextualTypingOfLambdaReturnExpression.js index 220e06da59d..67670bf872e 100644 --- a/tests/baselines/reference/contextualTypingOfLambdaReturnExpression.js +++ b/tests/baselines/reference/contextualTypingOfLambdaReturnExpression.js @@ -9,6 +9,4 @@ callb((a) => { a.length; }); // Error, we picked the first overload and errored //// [contextualTypingOfLambdaReturnExpression.js] function callb(a) { } callb(function (a) { return a.length; }); // Ok, we choose the second overload because the first one gave us an error when trying to resolve the lambda return type -callb(function (a) { - a.length; -}); // Error, we picked the first overload and errored when type checking the lambda body +callb(function (a) { a.length; }); // Error, we picked the first overload and errored when type checking the lambda body diff --git a/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures2.js b/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures2.js index 415fc3acd2e..442ded4ba75 100644 --- a/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures2.js +++ b/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures2.js @@ -8,6 +8,4 @@ f = (a) => { return a.asdf } //// [contextualTypingOfLambdaWithMultipleSignatures2.js] var f; -f = function (a) { - return a.asdf; -}; +f = function (a) { return a.asdf; }; diff --git a/tests/baselines/reference/contextualTypingWithGenericAndNonGenericSignature.js b/tests/baselines/reference/contextualTypingWithGenericAndNonGenericSignature.js index f548b6daaad..5ee0c758022 100644 --- a/tests/baselines/reference/contextualTypingWithGenericAndNonGenericSignature.js +++ b/tests/baselines/reference/contextualTypingWithGenericAndNonGenericSignature.js @@ -19,10 +19,6 @@ f3 = (x, y) => { return x } //// [contextualTypingWithGenericAndNonGenericSignature.js] //• If e is a FunctionExpression or ArrowFunctionExpression with no type parameters and no parameter or return type annotations, and T is a function type with EXACTLY ONE non - generic call signature, then any inferences made for type parameters referenced by the parameters of T’s call signature are fixed(section 4.12.2) and e is processed with the contextual type T, as described in section 4.9.3. var f2; -f2 = function (x, y) { - return x; -}; +f2 = function (x, y) { return x; }; var f3; -f3 = function (x, y) { - return x; -}; +f3 = function (x, y) { return x; }; diff --git a/tests/baselines/reference/contextualTypingWithGenericSignature.js b/tests/baselines/reference/contextualTypingWithGenericSignature.js index a1417e90b43..611a35f38ac 100644 --- a/tests/baselines/reference/contextualTypingWithGenericSignature.js +++ b/tests/baselines/reference/contextualTypingWithGenericSignature.js @@ -10,6 +10,4 @@ f2 = (x, y) => { return x } //// [contextualTypingWithGenericSignature.js] // If e is a FunctionExpression or ArrowFunctionExpression with no type parameters and no parameter or return type annotations, and T is a function type with EXACTLY ONE non - generic call signature, then any inferences made for type parameters referenced by the parameters of T’s call signature are fixed(section 4.12.2) and e is processed with the contextual type T, as described in section 4.9.3. var f2; -f2 = function (x, y) { - return x; -}; +f2 = function (x, y) { return x; }; diff --git a/tests/baselines/reference/contextuallyTypingOrOperator.js b/tests/baselines/reference/contextuallyTypingOrOperator.js index 8d7babbbe6b..6dc3e09bf89 100644 --- a/tests/baselines/reference/contextuallyTypingOrOperator.js +++ b/tests/baselines/reference/contextuallyTypingOrOperator.js @@ -8,12 +8,6 @@ var v4 = (s: number) => 1 || function (s: string) { return s.length }; //// [contextuallyTypingOrOperator.js] var v = { a: function (s) { return s.length; } } || { a: function (s) { return 1; } }; -var v2 = function (s) { return s.length || function (s) { - s.length; -}; }; -var v3 = function (s) { return s.length || function (s) { - return 1; -}; }; -var v4 = function (s) { return 1 || function (s) { - return s.length; -}; }; +var v2 = function (s) { return s.length || function (s) { s.length; }; }; +var v3 = function (s) { return s.length || function (s) { return 1; }; }; +var v4 = function (s) { return 1 || function (s) { return s.length; }; }; diff --git a/tests/baselines/reference/contextuallyTypingOrOperator2.js b/tests/baselines/reference/contextuallyTypingOrOperator2.js index 9aa2c778345..fa850929b3e 100644 --- a/tests/baselines/reference/contextuallyTypingOrOperator2.js +++ b/tests/baselines/reference/contextuallyTypingOrOperator2.js @@ -5,6 +5,4 @@ var v2 = (s: string) => s.length || function (s) { s.aaa }; //// [contextuallyTypingOrOperator2.js] var v = { a: function (s) { return s.length; } } || { a: function (s) { return 1; } }; -var v2 = function (s) { return s.length || function (s) { - s.aaa; -}; }; +var v2 = function (s) { return s.length || function (s) { s.aaa; }; }; diff --git a/tests/baselines/reference/couldNotSelectGenericOverload.js b/tests/baselines/reference/couldNotSelectGenericOverload.js index 45ce1c42274..996ebde8448 100644 --- a/tests/baselines/reference/couldNotSelectGenericOverload.js +++ b/tests/baselines/reference/couldNotSelectGenericOverload.js @@ -9,13 +9,9 @@ var b3G = makeArray2(1, ""); // error //// [couldNotSelectGenericOverload.js] -function makeArray(items) { - return items; -} +function makeArray(items) { return items; } var b = [1, ""]; var b1G = makeArray(1, ""); // any, no error var b2G = makeArray(b); // any[] -function makeArray2(items) { - return items; -} +function makeArray2(items) { return items; } var b3G = makeArray2(1, ""); // error diff --git a/tests/baselines/reference/debuggerEmit.js b/tests/baselines/reference/debuggerEmit.js index c2f730271be..8cf5dc69cd0 100644 --- a/tests/baselines/reference/debuggerEmit.js +++ b/tests/baselines/reference/debuggerEmit.js @@ -3,7 +3,5 @@ var x = function () { debugger; } x(); //// [debuggerEmit.js] -var x = function () { - debugger; -}; +var x = function () { debugger; }; x(); diff --git a/tests/baselines/reference/declFileGenericType.js b/tests/baselines/reference/declFileGenericType.js index d6d63e3443a..e01626a7ead 100644 --- a/tests/baselines/reference/declFileGenericType.js +++ b/tests/baselines/reference/declFileGenericType.js @@ -60,29 +60,17 @@ var C; return B; })(); C.B = B; - function F(x) { - return null; - } + function F(x) { return null; } C.F = F; - function F2(x) { - return null; - } + function F2(x) { return null; } C.F2 = F2; - function F3(x) { - return null; - } + function F3(x) { return null; } C.F3 = F3; - function F4(x) { - return null; - } + function F4(x) { return null; } C.F4 = F4; - function F5() { - return null; - } + function F5() { return null; } C.F5 = F5; - function F6(x) { - return null; - } + function F6(x) { return null; } C.F6 = F6; var D = (function () { function D(val) { diff --git a/tests/baselines/reference/declFileObjectLiteralWithAccessors.js b/tests/baselines/reference/declFileObjectLiteralWithAccessors.js index 7d7c6ee73d3..85897bc2c9d 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithAccessors.js +++ b/tests/baselines/reference/declFileObjectLiteralWithAccessors.js @@ -15,12 +15,8 @@ point./*3*/x = 30; function makePoint(x) { return { b: 10, - get x() { - return x; - }, - set x(a) { - this.b = a; - } + get x() { return x; }, + set x(a) { this.b = a; } }; } ; diff --git a/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js b/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js index b3d41829637..dd39a30f7a2 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js +++ b/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js @@ -12,9 +12,7 @@ var /*2*/x = point./*3*/x; //// [declFileObjectLiteralWithOnlyGetter.js] function makePoint(x) { return { - get x() { - return x; - } + get x() { return x; } }; } ; diff --git a/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js b/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js index dae362caf36..e219e885053 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js +++ b/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js @@ -13,9 +13,7 @@ point./*2*/x = 30; function makePoint(x) { return { b: 10, - set x(a) { - this.b = a; - } + set x(a) { this.b = a; } }; } ; diff --git a/tests/baselines/reference/declFilePrivateStatic.js b/tests/baselines/reference/declFilePrivateStatic.js index 38efa8255a7..326ce62171d 100644 --- a/tests/baselines/reference/declFilePrivateStatic.js +++ b/tests/baselines/reference/declFilePrivateStatic.js @@ -21,16 +21,12 @@ var C = (function () { C.a = function () { }; C.b = function () { }; Object.defineProperty(C, "c", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); Object.defineProperty(C, "d", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js b/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js index 3cea09c8c26..0150c3f9d42 100644 --- a/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js +++ b/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js @@ -16,9 +16,7 @@ function f2(x) { } function f3(x) { } function f4() { } function f5() { } -var f6 = function () { - return [10]; -}; +var f6 = function () { return [10]; }; //// [declFileRestParametersOfFunctionAndFunctionType.d.ts] diff --git a/tests/baselines/reference/declFileTypeofFunction.js b/tests/baselines/reference/declFileTypeofFunction.js index 2af519f411d..656e02b8ddd 100644 --- a/tests/baselines/reference/declFileTypeofFunction.js +++ b/tests/baselines/reference/declFileTypeofFunction.js @@ -34,12 +34,8 @@ function foo5(x: number) { } //// [declFileTypeofFunction.js] -function f() { - return undefined; -} -function g() { - return undefined; -} +function f() { return undefined; } +function g() { return undefined; } var b; function b1() { return b1; diff --git a/tests/baselines/reference/declInput-2.js b/tests/baselines/reference/declInput-2.js index 30a306c09f8..dcd37454ef0 100644 --- a/tests/baselines/reference/declInput-2.js +++ b/tests/baselines/reference/declInput-2.js @@ -38,20 +38,12 @@ var M; var D = (function () { function D() { } - D.prototype.m232 = function () { - return null; - }; - D.prototype.m242 = function () { - return null; - }; - D.prototype.m252 = function () { - return null; - }; // don't generate + D.prototype.m232 = function () { return null; }; + D.prototype.m242 = function () { return null; }; + D.prototype.m252 = function () { return null; }; // don't generate D.prototype.m26 = function (i) { }; D.prototype.m262 = function (i) { }; - D.prototype.m3 = function () { - return new C(); - }; + D.prototype.m3 = function () { return new C(); }; return D; })(); M.D = D; diff --git a/tests/baselines/reference/declInput.js b/tests/baselines/reference/declInput.js index 39d466498fa..cd558c93403 100644 --- a/tests/baselines/reference/declInput.js +++ b/tests/baselines/reference/declInput.js @@ -14,12 +14,8 @@ class bar { var bar = (function () { function bar() { } - bar.prototype.f = function () { - return ''; - }; - bar.prototype.g = function () { - return { a: null, b: undefined, c: void 4 }; - }; + bar.prototype.f = function () { return ''; }; + bar.prototype.g = function () { return { a: null, b: undefined, c: void 4 }; }; bar.prototype.h = function (x, y, z) { if (x === void 0) { x = 4; } if (y === void 0) { y = null; } diff --git a/tests/baselines/reference/declInput3.js b/tests/baselines/reference/declInput3.js index fa577a90645..3be31de3de0 100644 --- a/tests/baselines/reference/declInput3.js +++ b/tests/baselines/reference/declInput3.js @@ -14,12 +14,8 @@ class bar { var bar = (function () { function bar() { } - bar.prototype.f = function () { - return ''; - }; - bar.prototype.g = function () { - return { a: null, b: undefined, c: void 4 }; - }; + bar.prototype.f = function () { return ''; }; + bar.prototype.g = function () { return { a: null, b: undefined, c: void 4 }; }; bar.prototype.h = function (x, y, z) { if (x === void 0) { x = 4; } if (y === void 0) { y = null; } diff --git a/tests/baselines/reference/declInput4.js b/tests/baselines/reference/declInput4.js index cce9127eddc..07b6f091a14 100644 --- a/tests/baselines/reference/declInput4.js +++ b/tests/baselines/reference/declInput4.js @@ -32,12 +32,8 @@ var M; var D = (function () { function D() { } - D.prototype.m232 = function () { - return null; - }; - D.prototype.m242 = function () { - return null; - }; + D.prototype.m232 = function () { return null; }; + D.prototype.m242 = function () { return null; }; D.prototype.m26 = function (i) { }; return D; })(); diff --git a/tests/baselines/reference/declarationEmit_protectedMembers.js b/tests/baselines/reference/declarationEmit_protectedMembers.js index ff4323ce542..61a4ebdfcab 100644 --- a/tests/baselines/reference/declarationEmit_protectedMembers.js +++ b/tests/baselines/reference/declarationEmit_protectedMembers.js @@ -65,9 +65,7 @@ var C1 = (function () { return this.x; }; Object.defineProperty(C1.prototype, "accessor", { - get: function () { - return 0; - }, + get: function () { return 0; }, set: function (a) { }, enumerable: true, configurable: true @@ -81,9 +79,7 @@ var C1 = (function () { configurable: true }); Object.defineProperty(C1, "staticGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -116,9 +112,7 @@ var C3 = (function (_super) { return _super.sf.call(this); }; Object.defineProperty(C3, "staticGetter", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js b/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js index 8fc1c601982..34e862063ce 100644 --- a/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js +++ b/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js @@ -50,15 +50,11 @@ foo()--; // -- operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -72,14 +68,10 @@ var ResultIsNumber2 = NUMBER1--; // number type literal var ResultIsNumber3 = --1; var ResultIsNumber4 = --{ x: 1, y: 2 }; -var ResultIsNumber5 = --{ x: 1, y: function (n) { - return n; -} }; +var ResultIsNumber5 = --{ x: 1, y: function (n) { return n; } }; var ResultIsNumber6 = 1--; var ResultIsNumber7 = { x: 1, y: 2 }--; -var ResultIsNumber8 = { x: 1, y: function (n) { - return n; -} }--; +var ResultIsNumber8 = { x: 1, y: function (n) { return n; } }--; // number type expressions var ResultIsNumber9 = --foo(); var ResultIsNumber10 = --A.foo(); diff --git a/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js b/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js index 22c86aa8450..2be74a64d8f 100644 --- a/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js +++ b/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js @@ -57,15 +57,11 @@ objA.a--, M.n--; //// [decrementOperatorWithUnsupportedBooleanType.js] // -- operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return true; - }; + A.foo = function () { return true; }; return A; })(); var M; @@ -79,14 +75,10 @@ var ResultIsNumber2 = BOOLEAN--; // boolean type literal var ResultIsNumber3 = --true; var ResultIsNumber4 = --{ x: true, y: false }; -var ResultIsNumber5 = --{ x: true, y: function (n) { - return n; -} }; +var ResultIsNumber5 = --{ x: true, y: function (n) { return n; } }; var ResultIsNumber6 = true--; var ResultIsNumber7 = { x: true, y: false }--; -var ResultIsNumber8 = { x: true, y: function (n) { - return n; -} }--; +var ResultIsNumber8 = { x: true, y: function (n) { return n; } }--; // boolean type expressions var ResultIsNumber9 = --objA.a; var ResultIsNumber10 = --M.n; diff --git a/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js b/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js index 1747b1648d6..430f9af963f 100644 --- a/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js +++ b/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js @@ -69,15 +69,11 @@ objA.a--, M.n--; // -- operator on string type var STRING; var STRING1 = ["", ""]; -function foo() { - return ""; -} +function foo() { return ""; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -93,14 +89,10 @@ var ResultIsNumber4 = STRING1--; // string type literal var ResultIsNumber5 = --""; var ResultIsNumber6 = --{ x: "", y: "" }; -var ResultIsNumber7 = --{ x: "", y: function (s) { - return s; -} }; +var ResultIsNumber7 = --{ x: "", y: function (s) { return s; } }; var ResultIsNumber8 = ""--; var ResultIsNumber9 = { x: "", y: "" }--; -var ResultIsNumber10 = { x: "", y: function (s) { - return s; -} }--; +var ResultIsNumber10 = { x: "", y: function (s) { return s; } }--; // string type expressions var ResultIsNumber11 = --objA.a; var ResultIsNumber12 = --M.n; diff --git a/tests/baselines/reference/defaultBestCommonTypesHaveDecls.js b/tests/baselines/reference/defaultBestCommonTypesHaveDecls.js index 98e135cc712..ad6181ba7c5 100644 --- a/tests/baselines/reference/defaultBestCommonTypesHaveDecls.js +++ b/tests/baselines/reference/defaultBestCommonTypesHaveDecls.js @@ -20,13 +20,9 @@ var obj1; obj1.length; var obj2; obj2.length; -function concat(x, y) { - return null; -} +function concat(x, y) { return null; } var result = concat(1, ""); // error var elementCount = result.length; -function concat2(x, y) { - return null; -} +function concat2(x, y) { return null; } var result2 = concat2(1, ""); // result2 will be number|string var elementCount2 = result.length; diff --git a/tests/baselines/reference/deleteOperatorWithBooleanType.js b/tests/baselines/reference/deleteOperatorWithBooleanType.js index cab9cba2c95..b0a60a23744 100644 --- a/tests/baselines/reference/deleteOperatorWithBooleanType.js +++ b/tests/baselines/reference/deleteOperatorWithBooleanType.js @@ -41,15 +41,11 @@ delete M.n; //// [deleteOperatorWithBooleanType.js] // delete operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/deleteOperatorWithNumberType.js b/tests/baselines/reference/deleteOperatorWithNumberType.js index d19ae045805..bb70c55024d 100644 --- a/tests/baselines/reference/deleteOperatorWithNumberType.js +++ b/tests/baselines/reference/deleteOperatorWithNumberType.js @@ -49,15 +49,11 @@ delete objA.a, M.n; // delete operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -71,9 +67,7 @@ var ResultIsBoolean2 = delete NUMBER1; // number type literal var ResultIsBoolean3 = delete 1; var ResultIsBoolean4 = delete { x: 1, y: 2 }; -var ResultIsBoolean5 = delete { x: 1, y: function (n) { - return n; -} }; +var ResultIsBoolean5 = delete { x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsBoolean6 = delete objA.a; var ResultIsBoolean7 = delete M.n; diff --git a/tests/baselines/reference/deleteOperatorWithStringType.js b/tests/baselines/reference/deleteOperatorWithStringType.js index ad27e8f84ad..79246e27725 100644 --- a/tests/baselines/reference/deleteOperatorWithStringType.js +++ b/tests/baselines/reference/deleteOperatorWithStringType.js @@ -48,15 +48,11 @@ delete objA.a,M.n; // delete operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -70,9 +66,7 @@ var ResultIsBoolean2 = delete STRING1; // string type literal var ResultIsBoolean3 = delete ""; var ResultIsBoolean4 = delete { x: "", y: "" }; -var ResultIsBoolean5 = delete { x: "", y: function (s) { - return s; -} }; +var ResultIsBoolean5 = delete { x: "", y: function (s) { return s; } }; // string type expressions var ResultIsBoolean6 = delete objA.a; var ResultIsBoolean7 = delete M.n; diff --git a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js index 1c56819b200..32e8cf4199e 100644 --- a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js +++ b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js @@ -66,9 +66,7 @@ var Derived2 = (function (_super) { var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3() { - var r = function () { - _super.call(this); - }; // error + var r = function () { _super.call(this); }; // error } return Derived3; })(Base2); diff --git a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js index bdfa31cb04f..f2e816604d2 100644 --- a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js +++ b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js @@ -52,18 +52,14 @@ var Base = (function () { } Base.prototype.b = function () { }; Object.defineProperty(Base.prototype, "c", { - get: function () { - return ''; - }, + get: function () { return ''; }, set: function (v) { }, enumerable: true, configurable: true }); Base.s = function () { }; Object.defineProperty(Base, "t", { - get: function () { - return ''; - }, + get: function () { return ''; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js index af725e9b7bd..b66d356a73e 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js @@ -50,18 +50,14 @@ var Base = (function () { } Base.prototype.b = function (a) { }; Object.defineProperty(Base.prototype, "c", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true }); Base.s = function (a) { }; Object.defineProperty(Base, "t", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true @@ -75,18 +71,14 @@ var Derived = (function (_super) { } Derived.prototype.b = function (a) { }; Object.defineProperty(Derived.prototype, "c", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (v) { }, enumerable: true, configurable: true }); Derived.s = function (a) { }; Object.defineProperty(Derived, "t", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (a) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js index b1f5de00fb5..80f7456ab9a 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js @@ -77,18 +77,14 @@ var Base = (function () { } Base.prototype.b = function (a) { }; Object.defineProperty(Base.prototype, "c", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true }); Base.s = function (a) { }; Object.defineProperty(Base, "t", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true @@ -103,18 +99,14 @@ var Derived = (function (_super) { } Derived.prototype.b = function (a) { }; Object.defineProperty(Derived.prototype, "c", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (v) { }, enumerable: true, configurable: true }); Derived.s = function (a) { }; Object.defineProperty(Derived, "t", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (a) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js index d6b93addbd3..cfb6116ee85 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js @@ -85,18 +85,14 @@ var Base = (function () { } Base.prototype.b = function (a) { }; Object.defineProperty(Base.prototype, "c", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true }); Base.s = function (a) { }; Object.defineProperty(Base, "t", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true @@ -126,9 +122,7 @@ var Derived3 = (function (_super) { _super.call(this, a); } Object.defineProperty(Derived3.prototype, "c", { - get: function () { - return x; - }, + get: function () { return x; }, enumerable: true, configurable: true }); @@ -174,9 +168,7 @@ var Derived8 = (function (_super) { _super.call(this, a); } Object.defineProperty(Derived8, "t", { - get: function () { - return x; - }, + get: function () { return x; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/derivedClassOverridesPublicMembers.js b/tests/baselines/reference/derivedClassOverridesPublicMembers.js index a1df28586d9..9d7df0eee40 100644 --- a/tests/baselines/reference/derivedClassOverridesPublicMembers.js +++ b/tests/baselines/reference/derivedClassOverridesPublicMembers.js @@ -76,18 +76,14 @@ var Base = (function () { } Base.prototype.b = function (a) { }; Object.defineProperty(Base.prototype, "c", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true }); Base.s = function (a) { }; Object.defineProperty(Base, "t", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true @@ -101,18 +97,14 @@ var Derived = (function (_super) { } Derived.prototype.b = function (a) { }; Object.defineProperty(Derived.prototype, "c", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (v) { }, enumerable: true, configurable: true }); Derived.s = function (a) { }; Object.defineProperty(Derived, "t", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (a) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js index 7e61be1c1c9..1902b6f4068 100644 --- a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js +++ b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js @@ -67,9 +67,7 @@ var Derived3 = (function (_super) { var Derived4 = (function (_super) { __extends(Derived4, _super); function Derived4(a) { - _super.call(this, function () { - return this; - }); // ok + _super.call(this, function () { return this; }); // ok this.a = a; } return Derived4; diff --git a/tests/baselines/reference/derivedClassWithAny.js b/tests/baselines/reference/derivedClassWithAny.js index 0b568eaec9b..8070e689bd0 100644 --- a/tests/baselines/reference/derivedClassWithAny.js +++ b/tests/baselines/reference/derivedClassWithAny.js @@ -70,9 +70,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "X", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); @@ -125,9 +123,7 @@ var E = (function (_super) { _super.apply(this, arguments); } Object.defineProperty(E.prototype, "X", { - get: function () { - return ''; - }, + get: function () { return ''; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js index 63c33f87836..8b00c632058 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js @@ -36,9 +36,7 @@ var Base = (function () { return ''; }; Object.defineProperty(Base.prototype, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true @@ -55,9 +53,7 @@ var Derived = (function (_super) { return ''; }; Object.defineProperty(Derived.prototype, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js index 692ae1569ec..4ac57d159e6 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js @@ -46,9 +46,7 @@ var Base = (function () { return ''; }; Object.defineProperty(Base.prototype, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true @@ -65,9 +63,7 @@ var Derived = (function (_super) { return ''; }; Object.defineProperty(Derived.prototype, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js index 56ce444de0b..1037d3faaae 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js @@ -35,9 +35,7 @@ var Base = (function () { return ''; }; Object.defineProperty(Base, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true @@ -54,9 +52,7 @@ var Derived = (function (_super) { return ''; }; Object.defineProperty(Derived, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js index 7ae518eeedf..c5bfea288bd 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js @@ -47,9 +47,7 @@ var Base = (function () { return ''; }; Object.defineProperty(Base, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true @@ -67,9 +65,7 @@ var Derived = (function (_super) { return ''; }; Object.defineProperty(Derived, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClasses.js b/tests/baselines/reference/derivedClasses.js index a0d6de6a819..e256313d27b 100644 --- a/tests/baselines/reference/derivedClasses.js +++ b/tests/baselines/reference/derivedClasses.js @@ -44,9 +44,7 @@ var Red = (function (_super) { } Red.prototype.shade = function () { var _this = this; - var getHue = function () { - return _this.hue(); - }; + var getHue = function () { return _this.hue(); }; return getHue() + " red"; }; return Red; @@ -54,12 +52,8 @@ var Red = (function (_super) { var Color = (function () { function Color() { } - Color.prototype.shade = function () { - return "some shade"; - }; - Color.prototype.hue = function () { - return "some hue"; - }; + Color.prototype.shade = function () { return "some shade"; }; + Color.prototype.hue = function () { return "some hue"; }; return Color; })(); var Blue = (function (_super) { @@ -69,9 +63,7 @@ var Blue = (function (_super) { } Blue.prototype.shade = function () { var _this = this; - var getHue = function () { - return _this.hue(); - }; + var getHue = function () { return _this.hue(); }; return getHue() + " blue"; }; return Blue; diff --git a/tests/baselines/reference/derivedGenericClassWithAny.js b/tests/baselines/reference/derivedGenericClassWithAny.js index 677fadf3876..4d1f0452be4 100644 --- a/tests/baselines/reference/derivedGenericClassWithAny.js +++ b/tests/baselines/reference/derivedGenericClassWithAny.js @@ -53,9 +53,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "X", { - get: function () { - return null; - }, + get: function () { return null; }, enumerable: true, configurable: true }); @@ -98,9 +96,7 @@ var E = (function (_super) { _super.apply(this, arguments); } Object.defineProperty(E.prototype, "X", { - get: function () { - return ''; - } // error + get: function () { return ''; } // error , enumerable: true, configurable: true diff --git a/tests/baselines/reference/duplicateLocalVariable1.js b/tests/baselines/reference/duplicateLocalVariable1.js index cace580eea1..e77a38c5be8 100644 --- a/tests/baselines/reference/duplicateLocalVariable1.js +++ b/tests/baselines/reference/duplicateLocalVariable1.js @@ -361,9 +361,7 @@ var TestRunner = (function () { this.tests = []; } TestRunner.arrayCompare = function (arg1, arg2) { - return (arg1.every(function (val, index) { - return val === arg2[index]; - })); + return (arg1.every(function (val, index) { return val === arg2[index]; })); }; TestRunner.prototype.addTest = function (test) { this.tests.push(test); @@ -410,23 +408,11 @@ exports.TestRunner = TestRunner; exports.tests = (function () { var testRunner = new TestRunner(); // First 3 are for simple harness validation - testRunner.addTest(new TestCase("Basic test", function () { - return true; - })); - testRunner.addTest(new TestCase("Test for any error", function () { - throw new Error(); - return false; - }, "")); - testRunner.addTest(new TestCase("Test RegEx error message match", function () { - throw new Error("Should also pass"); - return false; - }, "Should [also]+ pass")); - testRunner.addTest(new TestCase("Test array compare true", function () { - return TestRunner.arrayCompare([1, 2, 3], [1, 2, 3]); - })); - testRunner.addTest(new TestCase("Test array compare false", function () { - return !TestRunner.arrayCompare([3, 2, 3], [1, 2, 3]); - })); + testRunner.addTest(new TestCase("Basic test", function () { return true; })); + testRunner.addTest(new TestCase("Test for any error", function () { throw new Error(); return false; }, "")); + testRunner.addTest(new TestCase("Test RegEx error message match", function () { throw new Error("Should also pass"); return false; }, "Should [also]+ pass")); + testRunner.addTest(new TestCase("Test array compare true", function () { return TestRunner.arrayCompare([1, 2, 3], [1, 2, 3]); })); + testRunner.addTest(new TestCase("Test array compare false", function () { return !TestRunner.arrayCompare([3, 2, 3], [1, 2, 3]); })); // File detection tests testRunner.addTest(new TestCase("Check file exists", function () { return FileManager.DirectoryManager.fileExists(TestFileDir + "\\Test.txt"); @@ -436,22 +422,38 @@ exports.tests = (function () { })); // File pattern matching tests testRunner.addTest(new TestCase("Check text file match", function () { - return (FileManager.FileBuffer.isTextFile("C:\\somedir\\readme.txt") && FileManager.FileBuffer.isTextFile("C:\\spaces path\\myapp.str") && FileManager.FileBuffer.isTextFile("C:\\somedir\\code.js")); + return (FileManager.FileBuffer.isTextFile("C:\\somedir\\readme.txt") && + FileManager.FileBuffer.isTextFile("C:\\spaces path\\myapp.str") && + FileManager.FileBuffer.isTextFile("C:\\somedir\\code.js")); })); testRunner.addTest(new TestCase("Check makefile match", function () { return FileManager.FileBuffer.isTextFile("C:\\some dir\\makefile"); })); testRunner.addTest(new TestCase("Check binary file doesn't match", function () { - return (!FileManager.FileBuffer.isTextFile("C:\\somedir\\app.exe") && !FileManager.FileBuffer.isTextFile("C:\\somedir\\my lib.dll")); + return (!FileManager.FileBuffer.isTextFile("C:\\somedir\\app.exe") && + !FileManager.FileBuffer.isTextFile("C:\\somedir\\my lib.dll")); })); // Command-line parameter tests testRunner.addTest(new TestCase("Check App defaults", function () { var app = new App.App([]); - return (app.fixLines === false && app.recurse === true && app.lineEndings === "CRLF" && app.matchPattern === undefined && app.rootDirectory === ".\\" && app.encodings[0] === "ascii" && app.encodings[1] === "utf8nobom"); + return (app.fixLines === false && + app.recurse === true && + app.lineEndings === "CRLF" && + app.matchPattern === undefined && + app.rootDirectory === ".\\" && + app.encodings[0] === "ascii" && + app.encodings[1] === "utf8nobom"); })); testRunner.addTest(new TestCase("Check App params", function () { var app = new App.App(["-dir=C:\\test dir", "-lineEndings=LF", "-encodings=utf16be,ascii", "-recurse=false", "-fixlines"]); - return (app.fixLines === true && app.lineEndings === "LF" && app.recurse === false && app.matchPattern === undefined && app.rootDirectory === "C:\\test dir" && app.encodings[0] === "utf16be" && app.encodings[1] === "ascii" && app.encodings.length === 2); + return (app.fixLines === true && + app.lineEndings === "LF" && + app.recurse === false && + app.matchPattern === undefined && + app.rootDirectory === "C:\\test dir" && + app.encodings[0] === "utf16be" && + app.encodings[1] === "ascii" && + app.encodings.length === 2); })); // File BOM detection tests testRunner.addTest(new TestCase("Check encoding detection no BOM", function () { @@ -516,9 +518,7 @@ exports.tests = (function () { var fb = new FileManager.FileBuffer(14); fb.writeUtf16leBom(); var chars = [0x0054, 0x00E8, 0x1D23, 0x2020, 0x000D, 0x000A]; - chars.forEach(function (val) { - fb.writeUtf16CodePoint(val, false); - }); + chars.forEach(function (val) { fb.writeUtf16CodePoint(val, false); }); fb.save(filename); var savedFile = new FileManager.FileBuffer(filename); if (savedFile.encoding !== 'utf16le') { @@ -573,9 +573,7 @@ exports.tests = (function () { var filename = TestFileDir + "\\tmpUTF8nonBmp.txt"; var fb = new FileManager.FileBuffer(15); var chars = [0x10480, 0x10481, 0x10482, 0x54, 0x68, 0x69]; - chars.forEach(function (val) { - fb.writeUtf8CodePoint(val); - }); + chars.forEach(function (val) { fb.writeUtf8CodePoint(val); }); fb.save(filename); var savedFile = new FileManager.FileBuffer(filename); if (savedFile.encoding !== 'utf8') { diff --git a/tests/baselines/reference/duplicateObjectLiteralProperty.js b/tests/baselines/reference/duplicateObjectLiteralProperty.js index 5fd2d1177f8..9c629b211cf 100644 --- a/tests/baselines/reference/duplicateObjectLiteralProperty.js +++ b/tests/baselines/reference/duplicateObjectLiteralProperty.js @@ -30,11 +30,7 @@ var x = { } }; var y = { - get a() { - return 0; - }, + get a() { return 0; }, set a(v) { }, - get a() { - return 0; - } + get a() { return 0; } }; diff --git a/tests/baselines/reference/emitArrowFunction.js b/tests/baselines/reference/emitArrowFunction.js index 41c52cbfefc..9c50c4776b1 100644 --- a/tests/baselines/reference/emitArrowFunction.js +++ b/tests/baselines/reference/emitArrowFunction.js @@ -14,6 +14,4 @@ var f3 = function (x, y) { }; var f4 = function (x, y, z) { }; function foo(func) { } foo(function () { return true; }); -foo(function () { - return false; -}); +foo(function () { return false; }); diff --git a/tests/baselines/reference/emitArrowFunctionES6.js b/tests/baselines/reference/emitArrowFunctionES6.js index 39d69cc1f0e..35078502ef7 100644 --- a/tests/baselines/reference/emitArrowFunctionES6.js +++ b/tests/baselines/reference/emitArrowFunctionES6.js @@ -15,6 +15,4 @@ var f3 = (x, y, ...rest) => { }; var f4 = (x, y, z = 10) => { }; function foo(func) { } foo(() => { return true; }); -foo(() => { - return false; -}); +foo(() => { return false; }); diff --git a/tests/baselines/reference/enumBasics.js b/tests/baselines/reference/enumBasics.js index 6f1a039ca6e..eca92215fb6 100644 --- a/tests/baselines/reference/enumBasics.js +++ b/tests/baselines/reference/enumBasics.js @@ -150,21 +150,9 @@ var E9; // (refer to .js to validate) // Enum constant members are propagated var doNotPropagate = [ - E8.B, - E7.A, - E4.Z, - E3.X, - E3.Y, - E3.Z + E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z ]; // Enum computed members are not propagated var doPropagate = [ - 0 /* A */, - E9.B, - 0 /* B */, - 1 /* C */, - 0 /* A */, - 0 /* A */, - 3 /* B */, - 4 /* C */ + 0 /* A */, E9.B, 0 /* B */, 1 /* C */, 0 /* A */, 0 /* A */, 3 /* B */, 4 /* C */ ]; diff --git a/tests/baselines/reference/errorSuperPropertyAccess.js b/tests/baselines/reference/errorSuperPropertyAccess.js index 845bc9834f7..79ba631afed 100644 --- a/tests/baselines/reference/errorSuperPropertyAccess.js +++ b/tests/baselines/reference/errorSuperPropertyAccess.js @@ -209,9 +209,7 @@ var SomeDerived1 = (function (_super) { super.publicFunc.call(this); } var x = { - test: function () { - return super.publicFunc.call(this); - } + test: function () { return super.publicFunc.call(this); } }; }; return SomeDerived1; diff --git a/tests/baselines/reference/errorSupression1.js b/tests/baselines/reference/errorSupression1.js index 059530be452..53e40e585f0 100644 --- a/tests/baselines/reference/errorSupression1.js +++ b/tests/baselines/reference/errorSupression1.js @@ -12,9 +12,7 @@ baz.concat("y"); var Foo = (function () { function Foo() { } - Foo.bar = function () { - return "x"; - }; + Foo.bar = function () { return "x"; }; return Foo; })(); var baz = Foo.b; diff --git a/tests/baselines/reference/errorsInGenericTypeReference.js b/tests/baselines/reference/errorsInGenericTypeReference.js index 1a27a681e59..03bf31a6a6b 100644 --- a/tests/baselines/reference/errorsInGenericTypeReference.js +++ b/tests/baselines/reference/errorsInGenericTypeReference.js @@ -104,12 +104,8 @@ var tc2 = new testClass2(); // error: could not find symbol V var testClass3 = (function () { function testClass3() { } - testClass3.prototype.testMethod1 = function () { - return null; - }; // error: could not find symbol V - testClass3.testMethod2 = function () { - return null; - }; // error: could not find symbol V + testClass3.prototype.testMethod1 = function () { return null; }; // error: could not find symbol V + testClass3.testMethod2 = function () { return null; }; // error: could not find symbol V Object.defineProperty(testClass3.prototype, "a", { set: function (value) { } // error: could not find symbol V , @@ -119,9 +115,7 @@ var testClass3 = (function () { return testClass3; })(); // in function return type annotation -function testFunction1() { - return null; -} // error: could not find symbol V +function testFunction1() { return null; } // error: could not find symbol V // in paramter types function testFunction2(p) { } // error: could not find symbol V // in var type annotation diff --git a/tests/baselines/reference/es6ClassTest.js b/tests/baselines/reference/es6ClassTest.js index 5fd9f0e9b7f..08c184a0df2 100644 --- a/tests/baselines/reference/es6ClassTest.js +++ b/tests/baselines/reference/es6ClassTest.js @@ -112,12 +112,8 @@ var Foo = (function (_super) { this.x = x; this.gar = 5; } - Foo.prototype.bar = function () { - return 0; - }; - Foo.prototype.boo = function (x) { - return x; - }; + Foo.prototype.bar = function () { return 0; }; + Foo.prototype.boo = function (x) { return x; }; Foo.statVal = 0; return Foo; })(Bar); diff --git a/tests/baselines/reference/es6ClassTest2.js b/tests/baselines/reference/es6ClassTest2.js index f4854644079..fb0349c9044 100644 --- a/tests/baselines/reference/es6ClassTest2.js +++ b/tests/baselines/reference/es6ClassTest2.js @@ -243,9 +243,7 @@ var SplatMonster = (function () { SplatMonster.prototype.roar = function (name) { }; return SplatMonster; })(); -function foo() { - return true; -} +function foo() { return true; } var PrototypeMonster = (function () { function PrototypeMonster() { this.age = 1; diff --git a/tests/baselines/reference/es6ClassTest8.js b/tests/baselines/reference/es6ClassTest8.js index 3c616e5e893..f96bbd16b0b 100644 --- a/tests/baselines/reference/es6ClassTest8.js +++ b/tests/baselines/reference/es6ClassTest8.js @@ -41,9 +41,7 @@ class Camera { //// [es6ClassTest8.js] -function f1(x) { - return x; -} +function f1(x) { return x; } var C = (function () { function C() { var bar = (function () { @@ -59,21 +57,11 @@ var Vector = (function () { this.y = y; this.z = z; } - Vector.norm = function (v) { - return null; - }; - Vector.minus = function (v1, v2) { - return null; - }; - Vector.times = function (v1, v2) { - return null; - }; - Vector.cross = function (v1, v2) { - return null; - }; - Vector.dot = function (v1, v2) { - return null; - }; + Vector.norm = function (v) { return null; }; + Vector.minus = function (v1, v2) { return null; }; + Vector.times = function (v1, v2) { return null; }; + Vector.cross = function (v1, v2) { return null; }; + Vector.dot = function (v1, v2) { return null; }; return Vector; })(); var Camera = (function () { diff --git a/tests/baselines/reference/es6ImportDefaultBinding.errors.txt b/tests/baselines/reference/es6ImportDefaultBinding.errors.txt index 3f69c2d7de9..85390ecce4b 100644 --- a/tests/baselines/reference/es6ImportDefaultBinding.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBinding.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/es6ImportDefaultBinding_1.ts(1,8): error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBinding_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBinding_1.ts(1,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBinding_0"' has no default export or export assignment. ==== tests/cases/compiler/es6ImportDefaultBinding_0.ts (0 errors) ==== @@ -8,4 +8,4 @@ tests/cases/compiler/es6ImportDefaultBinding_1.ts(1,8): error TS1189: External m ==== tests/cases/compiler/es6ImportDefaultBinding_1.ts (1 errors) ==== import defaultBinding from "es6ImportDefaultBinding_0"; ~~~~~~~~~~~~~~ -!!! error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBinding_0"' has no default export or export assignment. \ No newline at end of file +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBinding_0"' has no default export or export assignment. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.errors.txt index 5fc8e8f9058..bd8714cb86f 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.errors.txt @@ -1,14 +1,14 @@ -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(1,8): error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(1,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(1,8): error TS2300: Duplicate identifier 'defaultBinding'. -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(2,8): error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(2,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(2,8): error TS2300: Duplicate identifier 'defaultBinding'. -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(3,8): error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(3,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(3,8): error TS2300: Duplicate identifier 'defaultBinding'. -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(4,8): error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(4,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(4,8): error TS2300: Duplicate identifier 'defaultBinding'. -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(5,8): error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(5,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(5,8): error TS2300: Duplicate identifier 'defaultBinding'. -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(6,8): error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(6,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(6,8): error TS2300: Duplicate identifier 'defaultBinding'. @@ -21,31 +21,31 @@ tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(6,8): e ==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts (12 errors) ==== import defaultBinding, { } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; ~~~~~~~~~~~~~~ -!!! error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. ~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'defaultBinding'. import defaultBinding, { a } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; ~~~~~~~~~~~~~~ -!!! error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. ~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'defaultBinding'. import defaultBinding, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; ~~~~~~~~~~~~~~ -!!! error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. ~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'defaultBinding'. import defaultBinding, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; ~~~~~~~~~~~~~~ -!!! error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. ~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'defaultBinding'. import defaultBinding, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; ~~~~~~~~~~~~~~ -!!! error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. ~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'defaultBinding'. import defaultBinding, { m, } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; ~~~~~~~~~~~~~~ -!!! error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. ~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'defaultBinding'. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportInEs5.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportInEs5.errors.txt index dc079cac8f7..157360f5238 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportInEs5.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportInEs5.errors.txt @@ -1,14 +1,14 @@ -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(1,8): error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(1,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(1,8): error TS2300: Duplicate identifier 'defaultBinding'. -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(2,8): error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(2,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(2,8): error TS2300: Duplicate identifier 'defaultBinding'. -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(3,8): error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(3,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(3,8): error TS2300: Duplicate identifier 'defaultBinding'. -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(4,8): error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(4,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(4,8): error TS2300: Duplicate identifier 'defaultBinding'. -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(5,8): error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(5,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(5,8): error TS2300: Duplicate identifier 'defaultBinding'. -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(6,8): error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(6,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(6,8): error TS2300: Duplicate identifier 'defaultBinding'. @@ -21,31 +21,31 @@ tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(6, ==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts (12 errors) ==== import defaultBinding, { } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; ~~~~~~~~~~~~~~ -!!! error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. ~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'defaultBinding'. import defaultBinding, { a } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; ~~~~~~~~~~~~~~ -!!! error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. ~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'defaultBinding'. import defaultBinding, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; ~~~~~~~~~~~~~~ -!!! error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. ~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'defaultBinding'. import defaultBinding, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; ~~~~~~~~~~~~~~ -!!! error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. ~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'defaultBinding'. import defaultBinding, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; ~~~~~~~~~~~~~~ -!!! error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. ~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'defaultBinding'. import defaultBinding, { m, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; ~~~~~~~~~~~~~~ -!!! error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. ~~~~~~~~~~~~~~ !!! error TS2300: Duplicate identifier 'defaultBinding'. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding.errors.txt index c270b9bdd69..98371eb9198 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_1.ts(1,8): error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_1.ts(1,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_0"' has no default export or export assignment. ==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_0.ts (0 errors) ==== @@ -8,4 +8,4 @@ tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_1.ts(1, ==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_1.ts (1 errors) ==== import defaultBinding, * as nameSpaceBinding from "es6ImportDefaultBindingFollowedWithNamespaceBinding_0"; ~~~~~~~~~~~~~~ -!!! error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_0"' has no default export or export assignment. \ No newline at end of file +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_0"' has no default export or export assignment. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.errors.txt index 37424bc7bd8..f1d20dccc59 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.ts(1,8): error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.ts(1,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"' has no default export or export assignment. ==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0.ts (0 errors) ==== @@ -8,4 +8,4 @@ tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1. ==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.ts (1 errors) ==== import defaultBinding, * as nameSpaceBinding from "es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"; ~~~~~~~~~~~~~~ -!!! error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"' has no default export or export assignment. \ No newline at end of file +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"' has no default export or export assignment. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportDefaultBindingInEs5.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingInEs5.errors.txt index 34439fa91c1..5d656094a8c 100644 --- a/tests/baselines/reference/es6ImportDefaultBindingInEs5.errors.txt +++ b/tests/baselines/reference/es6ImportDefaultBindingInEs5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/es6ImportDefaultBindingInEs5_1.ts(1,8): error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingInEs5_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingInEs5_1.ts(1,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingInEs5_0"' has no default export or export assignment. ==== tests/cases/compiler/es6ImportDefaultBindingInEs5_0.ts (0 errors) ==== @@ -8,4 +8,4 @@ tests/cases/compiler/es6ImportDefaultBindingInEs5_1.ts(1,8): error TS1189: Exter ==== tests/cases/compiler/es6ImportDefaultBindingInEs5_1.ts (1 errors) ==== import defaultBinding from "es6ImportDefaultBindingInEs5_0"; ~~~~~~~~~~~~~~ -!!! error TS1189: External module '"tests/cases/compiler/es6ImportDefaultBindingInEs5_0"' has no default export or export assignment. \ No newline at end of file +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingInEs5_0"' has no default export or export assignment. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportNamedImportParsingError.errors.txt b/tests/baselines/reference/es6ImportNamedImportParsingError.errors.txt index 89a82e286b7..22428100985 100644 --- a/tests/baselines/reference/es6ImportNamedImportParsingError.errors.txt +++ b/tests/baselines/reference/es6ImportNamedImportParsingError.errors.txt @@ -3,7 +3,7 @@ tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(1,10): error TS1141: tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(1,12): error TS1109: Expression expected. tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(1,14): error TS2304: Cannot find name 'from'. tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(1,19): error TS1005: ';' expected. -tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(2,8): error TS1189: External module '"tests/cases/compiler/es6ImportNamedImportParsingError_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(2,8): error TS1192: External module '"tests/cases/compiler/es6ImportNamedImportParsingError_0"' has no default export or export assignment. tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(2,24): error TS1005: '{' expected. tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(3,1): error TS1128: Declaration or statement expected. tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(3,8): error TS1128: Declaration or statement expected. @@ -34,7 +34,7 @@ tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(4,20): error TS1005: !!! error TS1005: ';' expected. import defaultBinding, from "es6ImportNamedImportParsingError_0"; ~~~~~~~~~~~~~~ -!!! error TS1189: External module '"tests/cases/compiler/es6ImportNamedImportParsingError_0"' has no default export or export assignment. +!!! error TS1192: External module '"tests/cases/compiler/es6ImportNamedImportParsingError_0"' has no default export or export assignment. ~~~~ !!! error TS1005: '{' expected. import , { a } from "es6ImportNamedImportParsingError_0"; diff --git a/tests/baselines/reference/es6MemberScoping.js b/tests/baselines/reference/es6MemberScoping.js index 85f76a93934..7e70045ceb3 100644 --- a/tests/baselines/reference/es6MemberScoping.js +++ b/tests/baselines/reference/es6MemberScoping.js @@ -30,8 +30,6 @@ var Foo = (function () { var Foo2 = (function () { function Foo2() { } - Foo2.Foo2 = function () { - return 0; - }; // should not be an error + Foo2.Foo2 = function () { return 0; }; // should not be an error return Foo2; })(); diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.js b/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.js index 291bcfcb68f..707801dc4ee 100644 --- a/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.js +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.js @@ -59,9 +59,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -70,9 +68,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); var aNumber = 9.9; diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.js b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.js index 7191aef20bf..40e45bf7ec0 100644 --- a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.js +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.js @@ -65,12 +65,8 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} -function F2(x) { - return x < 42; -} +function F(x) { return 42; } +function F2(x) { return x < 42; } var M; (function (M) { var A = (function () { @@ -79,9 +75,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); var N; @@ -92,9 +86,7 @@ var N; return A; })(); N.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } N.F2 = F2; })(N || (N = {})); var aNumber = 'this is a string'; diff --git a/tests/baselines/reference/everyTypeWithInitializer.js b/tests/baselines/reference/everyTypeWithInitializer.js index 74904a5ea30..aae0a9fe291 100644 --- a/tests/baselines/reference/everyTypeWithInitializer.js +++ b/tests/baselines/reference/everyTypeWithInitializer.js @@ -60,9 +60,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -71,9 +69,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); var aNumber = 9.9; diff --git a/tests/baselines/reference/exportAssignmentFunction.js b/tests/baselines/reference/exportAssignmentFunction.js index 6d4336bd4bd..825d0f983ea 100644 --- a/tests/baselines/reference/exportAssignmentFunction.js +++ b/tests/baselines/reference/exportAssignmentFunction.js @@ -12,9 +12,7 @@ var n: number = fooFunc(); //// [exportAssignmentFunction_A.js] define(["require", "exports"], function (require, exports) { - function foo() { - return 0; - } + function foo() { return 0; } return foo; }); //// [exportAssignmentFunction_B.js] diff --git a/tests/baselines/reference/exportImportMultipleFiles.js b/tests/baselines/reference/exportImportMultipleFiles.js index 225b605f689..10909808ffc 100644 --- a/tests/baselines/reference/exportImportMultipleFiles.js +++ b/tests/baselines/reference/exportImportMultipleFiles.js @@ -14,9 +14,7 @@ lib.math.add(3, 4); // Shouldnt be error //// [exportImportMultipleFiles_math.js] define(["require", "exports"], function (require, exports) { - function add(a, b) { - return a + b; - } + function add(a, b) { return a + b; } exports.add = add; }); //// [exportImportMultipleFiles_library.js] diff --git a/tests/baselines/reference/exportPrivateType.js b/tests/baselines/reference/exportPrivateType.js index 96acc83edb5..11ccc037ef6 100644 --- a/tests/baselines/reference/exportPrivateType.js +++ b/tests/baselines/reference/exportPrivateType.js @@ -41,9 +41,7 @@ var foo; var C2 = (function () { function C2() { } - C2.prototype.test = function () { - return true; - }; + C2.prototype.test = function () { return true; }; return C2; })(); // None of the types are exported, so per section 10.3, should all be errors diff --git a/tests/baselines/reference/fatArrowfunctionAsType.js b/tests/baselines/reference/fatArrowfunctionAsType.js index bd2dc4310d9..894267580c6 100644 --- a/tests/baselines/reference/fatArrowfunctionAsType.js +++ b/tests/baselines/reference/fatArrowfunctionAsType.js @@ -7,7 +7,5 @@ b = c; //// [fatArrowfunctionAsType.js] -var c = function (x) { - return 42; -}; +var c = function (x) { return 42; }; b = c; diff --git a/tests/baselines/reference/fatarrowfunctions.js b/tests/baselines/reference/fatarrowfunctions.js index 1ad00820990..eb57d1a9817 100644 --- a/tests/baselines/reference/fatarrowfunctions.js +++ b/tests/baselines/reference/fatarrowfunctions.js @@ -49,56 +49,30 @@ var messenger = { function foo(x) { return x(); } -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function () { - return 0; -}); foo(function (x, y, z) { return x + y + z; }); foo(function (x, y, z) { return x + y + z; }); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function () { - return 0; -}); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function () { return 0; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function () { return 0; }); foo((function (x) { return x; })); foo(function (x) { return x * x; }); var y = function (x) { return x * x; }; var z = function (x) { return x * x; }; var w = function () { return 3; }; function ternaryTest(isWhile) { - var f = isWhile ? function (n) { - return n > 0; - } : function (n) { - return n === 0; - }; + var f = isWhile ? function (n) { return n > 0; } : function (n) { return n === 0; }; } var messenger = { message: "Hello World", start: function () { var _this = this; - setTimeout(function () { - _this.message.toString(); - }, 3000); + setTimeout(function () { _this.message.toString(); }, 3000); } }; diff --git a/tests/baselines/reference/fatarrowfunctionsErrors.js b/tests/baselines/reference/fatarrowfunctionsErrors.js index 59baa802c9f..7b7a8f30f05 100644 --- a/tests/baselines/reference/fatarrowfunctionsErrors.js +++ b/tests/baselines/reference/fatarrowfunctionsErrors.js @@ -21,9 +21,7 @@ foo(function () { return 0; }); foo((1), { return: 0 }); -foo(function (x) { - return x; -}); +foo(function (x) { return x; }); foo(function (x) { if (x === void 0) { x = 0; } return x; diff --git a/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js b/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js index 6d6e3013fbb..9052b894337 100644 --- a/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js +++ b/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js @@ -208,9 +208,7 @@ foo( return 28; }); // in multiple paren -((((function (arg) { - return 32; -})))); +((((function (arg) { return 32; })))); // in ternary exression false ? function () { return 41; } : null; false ? function (arg) { return 42; } : null; @@ -275,17 +273,9 @@ false ? null : function () { return 68; }; // nested ternary expressions -(function (a) { - return a; -}) ? function (b) { - return b; -} : function (c) { - return c; -}; +(function (a) { return a; }) ? function (b) { return b; } : function (c) { return c; }; //multiple levels -(function (a) { - return a; -}); +(function (a) { return a; }); (function (b) { return function (c) { return 81; }; }); (function (c) { return function (d) { return 82; }; }); // In Expressions diff --git a/tests/baselines/reference/fieldAndGetterWithSameName.js b/tests/baselines/reference/fieldAndGetterWithSameName.js index 64129ff9365..ddd95b9e8f2 100644 --- a/tests/baselines/reference/fieldAndGetterWithSameName.js +++ b/tests/baselines/reference/fieldAndGetterWithSameName.js @@ -10,9 +10,7 @@ define(["require", "exports"], function (require, exports) { function C() { } Object.defineProperty(C.prototype, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/for-inStatements.js b/tests/baselines/reference/for-inStatements.js index 00f1a64a8d6..32e1389232d 100644 --- a/tests/baselines/reference/for-inStatements.js +++ b/tests/baselines/reference/for-inStatements.js @@ -106,9 +106,7 @@ for (var x in '' ? c : d) { } for (var x in 42 ? d[x] : c[x]) { } for (var x in c[d]) { } for (var x in (function (x) { return x; })) { } -for (var x in function (x, y) { - return x + y; -}) { } +for (var x in function (x, y) { return x + y; }) { } var A = (function () { function A() { } diff --git a/tests/baselines/reference/for-inStatementsInvalid.js b/tests/baselines/reference/for-inStatementsInvalid.js index fc43665e99e..6d42a550a01 100644 --- a/tests/baselines/reference/for-inStatementsInvalid.js +++ b/tests/baselines/reference/for-inStatementsInvalid.js @@ -87,9 +87,7 @@ for (var x in '' ? c : d) { } for (var x in 42 ? d[x] : c[x]) { } for (var x in c[23]) { } for (var x in (function (x) { return x; })) { } -for (var x in function (x, y) { - return x + y; -}) { } +for (var x in function (x, y) { return x + y; }) { } var A = (function () { function A() { } diff --git a/tests/baselines/reference/forStatements.js b/tests/baselines/reference/forStatements.js index 1755ff51fdc..39fdb6c8871 100644 --- a/tests/baselines/reference/forStatements.js +++ b/tests/baselines/reference/forStatements.js @@ -57,9 +57,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -68,9 +66,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); for (var aNumber = 9.9;;) { } diff --git a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js index 5c856398be2..2282136be3a 100644 --- a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js +++ b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js @@ -77,9 +77,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -88,9 +86,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); // all of these are errors diff --git a/tests/baselines/reference/forStatementsMultipleValidDecl.js b/tests/baselines/reference/forStatementsMultipleValidDecl.js index 76571ce1ff4..e95e37d63ac 100644 --- a/tests/baselines/reference/forStatementsMultipleValidDecl.js +++ b/tests/baselines/reference/forStatementsMultipleValidDecl.js @@ -49,9 +49,7 @@ for (var p = { x: 1, y: undefined };;) { } for (var p = { x: 1, y: 2 };;) { } for (var p = { x: 0, y: undefined };;) { } for (var p;;) { } -for (var fn = function (s) { - return 42; -};;) { } +for (var fn = function (s) { return 42; };;) { } for (var fn = function (s) { return 3; };;) { } for (var fn;;) { } for (var fn;;) { } diff --git a/tests/baselines/reference/functionAssignment.js b/tests/baselines/reference/functionAssignment.js index 5a3e07c9e8d..3237f53bf9a 100644 --- a/tests/baselines/reference/functionAssignment.js +++ b/tests/baselines/reference/functionAssignment.js @@ -53,6 +53,4 @@ f2(function () { function f3(a) { } f3({ a: 0, b: 0 }); function callb(a) { } -callb(function (a) { - a.length; -}); +callb(function (a) { a.length; }); diff --git a/tests/baselines/reference/functionAssignmentError.js b/tests/baselines/reference/functionAssignmentError.js index e19547096b8..dd35ccb271a 100644 --- a/tests/baselines/reference/functionAssignmentError.js +++ b/tests/baselines/reference/functionAssignmentError.js @@ -3,9 +3,5 @@ var func = function (){return "ONE";}; func = function (){return "ONE";}; //// [functionAssignmentError.js] -var func = function () { - return "ONE"; -}; -func = function () { - return "ONE"; -}; +var func = function () { return "ONE"; }; +func = function () { return "ONE"; }; diff --git a/tests/baselines/reference/functionCall1.js b/tests/baselines/reference/functionCall1.js index 8025ad5a6f5..cb8c1a46a23 100644 --- a/tests/baselines/reference/functionCall1.js +++ b/tests/baselines/reference/functionCall1.js @@ -3,8 +3,6 @@ function foo():any{return ""}; var x = foo(); //// [functionCall1.js] -function foo() { - return ""; -} +function foo() { return ""; } ; var x = foo(); diff --git a/tests/baselines/reference/functionCall2.js b/tests/baselines/reference/functionCall2.js index 5b6da378103..5351dc116ff 100644 --- a/tests/baselines/reference/functionCall2.js +++ b/tests/baselines/reference/functionCall2.js @@ -3,8 +3,6 @@ function foo():number{return 1}; var x = foo(); //// [functionCall2.js] -function foo() { - return 1; -} +function foo() { return 1; } ; var x = foo(); diff --git a/tests/baselines/reference/functionCall3.js b/tests/baselines/reference/functionCall3.js index db29b44db7a..74540c2ccf6 100644 --- a/tests/baselines/reference/functionCall3.js +++ b/tests/baselines/reference/functionCall3.js @@ -3,7 +3,5 @@ function foo():any[]{return [1];} var x = foo(); //// [functionCall3.js] -function foo() { - return [1]; -} +function foo() { return [1]; } var x = foo(); diff --git a/tests/baselines/reference/functionCall4.js b/tests/baselines/reference/functionCall4.js index 05021c33563..0f937337d49 100644 --- a/tests/baselines/reference/functionCall4.js +++ b/tests/baselines/reference/functionCall4.js @@ -4,12 +4,8 @@ function bar():()=>any{return foo}; var x = bar(); //// [functionCall4.js] -function foo() { - return ""; -} +function foo() { return ""; } ; -function bar() { - return foo; -} +function bar() { return foo; } ; var x = bar(); diff --git a/tests/baselines/reference/functionCall5.js b/tests/baselines/reference/functionCall5.js index e6b0e049ef6..dc7db4a9959 100644 --- a/tests/baselines/reference/functionCall5.js +++ b/tests/baselines/reference/functionCall5.js @@ -13,8 +13,6 @@ var m1; })(); m1.c1 = c1; })(m1 || (m1 = {})); -function foo() { - return new m1.c1(); -} +function foo() { return new m1.c1(); } ; var x = foo(); diff --git a/tests/baselines/reference/functionCall7.js b/tests/baselines/reference/functionCall7.js index b32c21b5892..cb30e5d8b24 100644 --- a/tests/baselines/reference/functionCall7.js +++ b/tests/baselines/reference/functionCall7.js @@ -18,9 +18,7 @@ var m1; })(); m1.c1 = c1; })(m1 || (m1 = {})); -function foo(a) { - a.a = 1; -} +function foo(a) { a.a = 1; } ; var myC = new m1.c1(); foo(myC); diff --git a/tests/baselines/reference/functionConstraintSatisfaction.js b/tests/baselines/reference/functionConstraintSatisfaction.js index a16f4d1ed36..b8741456178 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction.js +++ b/tests/baselines/reference/functionConstraintSatisfaction.js @@ -63,9 +63,7 @@ function foo2(x: T, y: U) { //// [functionConstraintSatisfaction.js] // satisfaction of a constraint to Function, no errors expected -function foo(x) { - return x; -} +function foo(x) { return x; } var i; var C = (function () { function C() { @@ -78,12 +76,8 @@ var c; var r = foo(new Function()); var r1 = foo(function (x) { return x; }); var r2 = foo(function (x) { return x; }); -var r3 = foo(function (x) { - return x; -}); -var r4 = foo(function (x) { - return x; -}); +var r3 = foo(function (x) { return x; }); +var r4 = foo(function (x) { return x; }); var r5 = foo(i); var r6 = foo(C); var r7 = foo(b); @@ -98,9 +92,7 @@ var a2; var b2; var c2; var r9 = foo(function (x) { return x; }); -var r10 = foo(function (x) { - return x; -}); +var r10 = foo(function (x) { return x; }); var r11 = foo(function (x) { return x; }); var r12 = foo(function (x, y) { return x; }); var r13 = foo(i2); diff --git a/tests/baselines/reference/functionConstraintSatisfaction2.js b/tests/baselines/reference/functionConstraintSatisfaction2.js index 982dcb37a49..9e70a508ccd 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction2.js +++ b/tests/baselines/reference/functionConstraintSatisfaction2.js @@ -42,15 +42,11 @@ function fff(x: T, y: U) { //// [functionConstraintSatisfaction2.js] // satisfaction of a constraint to Function, all of these invocations are errors unless otherwise noted -function foo(x) { - return x; -} +function foo(x) { return x; } foo(1); foo(function () { }, 1); foo(1, function () { }); -function foo2(x) { - return x; -} +function foo2(x) { return x; } var C = (function () { function C() { } diff --git a/tests/baselines/reference/functionConstraintSatisfaction3.js b/tests/baselines/reference/functionConstraintSatisfaction3.js index 4738cecedab..2c1bfa4d399 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction3.js +++ b/tests/baselines/reference/functionConstraintSatisfaction3.js @@ -43,9 +43,7 @@ var r15 = foo(c2); //// [functionConstraintSatisfaction3.js] // satisfaction of a constraint to Function, no errors expected -function foo(x) { - return x; -} +function foo(x) { return x; } var i; var C = (function () { function C() { @@ -57,12 +55,8 @@ var b; var c; var r1 = foo(function (x) { return x; }); var r2 = foo(function (x) { return x; }); -var r3 = foo(function (x) { - return x; -}); -var r4 = foo(function (x) { - return x; -}); +var r3 = foo(function (x) { return x; }); +var r4 = foo(function (x) { return x; }); var r5 = foo(i); var r8 = foo(c); var i2; @@ -74,9 +68,7 @@ var C2 = (function () { var a2; var b2; var c2; -var r9 = foo(function (x) { - return x; -}); +var r9 = foo(function (x) { return x; }); var r10 = foo(function (x) { return x; }); var r12 = foo(i2); var r15 = foo(c2); diff --git a/tests/baselines/reference/functionExpressionReturningItself.js b/tests/baselines/reference/functionExpressionReturningItself.js index 8553d2da867..9485100164e 100644 --- a/tests/baselines/reference/functionExpressionReturningItself.js +++ b/tests/baselines/reference/functionExpressionReturningItself.js @@ -2,9 +2,7 @@ var x = function somefn() { return somefn; }; //// [functionExpressionReturningItself.js] -var x = function somefn() { - return somefn; -}; +var x = function somefn() { return somefn; }; //// [functionExpressionReturningItself.d.ts] diff --git a/tests/baselines/reference/functionOverloadAmbiguity1.js b/tests/baselines/reference/functionOverloadAmbiguity1.js index f2fa78e1c14..2833ccbcdc3 100644 --- a/tests/baselines/reference/functionOverloadAmbiguity1.js +++ b/tests/baselines/reference/functionOverloadAmbiguity1.js @@ -12,10 +12,6 @@ callb2((a) => { a.length; } ); // ok, chose first overload //// [functionOverloadAmbiguity1.js] function callb(a) { } -callb(function (a) { - a.length; -}); // error, chose first overload +callb(function (a) { a.length; }); // error, chose first overload function callb2(a) { } -callb2(function (a) { - a.length; -}); // ok, chose first overload +callb2(function (a) { a.length; }); // ok, chose first overload diff --git a/tests/baselines/reference/functionOverloads.js b/tests/baselines/reference/functionOverloads.js index 5504b286628..7e38b8fe993 100644 --- a/tests/baselines/reference/functionOverloads.js +++ b/tests/baselines/reference/functionOverloads.js @@ -5,8 +5,6 @@ function foo(bar?: string): any { return "" }; var x = foo(5); //// [functionOverloads.js] -function foo(bar) { - return ""; -} +function foo(bar) { return ""; } ; var x = foo(5); diff --git a/tests/baselines/reference/functionOverloads1.js b/tests/baselines/reference/functionOverloads1.js index 695a9c37808..5b4acabd02c 100644 --- a/tests/baselines/reference/functionOverloads1.js +++ b/tests/baselines/reference/functionOverloads1.js @@ -5,6 +5,4 @@ function foo():string { return "a" } //// [functionOverloads1.js] 1 + 1; -function foo() { - return "a"; -} +function foo() { return "a"; } diff --git a/tests/baselines/reference/functionOverloads11.js b/tests/baselines/reference/functionOverloads11.js index efc9c793125..8d85b0ffb7b 100644 --- a/tests/baselines/reference/functionOverloads11.js +++ b/tests/baselines/reference/functionOverloads11.js @@ -4,6 +4,4 @@ function foo():string { return "" } //// [functionOverloads11.js] -function foo() { - return ""; -} +function foo() { return ""; } diff --git a/tests/baselines/reference/functionOverloads12.js b/tests/baselines/reference/functionOverloads12.js index ff789083eeb..4681e43ee5b 100644 --- a/tests/baselines/reference/functionOverloads12.js +++ b/tests/baselines/reference/functionOverloads12.js @@ -5,9 +5,7 @@ function foo():any { if (true) return ""; else return 0;} //// [functionOverloads12.js] -function foo() { - if (true) - return ""; - else - return 0; -} +function foo() { if (true) + return ""; +else + return 0; } diff --git a/tests/baselines/reference/functionOverloads13.js b/tests/baselines/reference/functionOverloads13.js index f9eb4d59e47..ff43c85e3df 100644 --- a/tests/baselines/reference/functionOverloads13.js +++ b/tests/baselines/reference/functionOverloads13.js @@ -5,6 +5,4 @@ function foo(bar?:number):any { return "" } //// [functionOverloads13.js] -function foo(bar) { - return ""; -} +function foo(bar) { return ""; } diff --git a/tests/baselines/reference/functionOverloads14.js b/tests/baselines/reference/functionOverloads14.js index f9a08ecf952..826b096290a 100644 --- a/tests/baselines/reference/functionOverloads14.js +++ b/tests/baselines/reference/functionOverloads14.js @@ -5,6 +5,4 @@ function foo():{a:any;} { return {a:1} } //// [functionOverloads14.js] -function foo() { - return { a: 1 }; -} +function foo() { return { a: 1 }; } diff --git a/tests/baselines/reference/functionOverloads15.js b/tests/baselines/reference/functionOverloads15.js index 2b80df6630c..fe0c90f82af 100644 --- a/tests/baselines/reference/functionOverloads15.js +++ b/tests/baselines/reference/functionOverloads15.js @@ -5,6 +5,4 @@ function foo(foo:{a:string; b?:number;}):any { return "" } //// [functionOverloads15.js] -function foo(foo) { - return ""; -} +function foo(foo) { return ""; } diff --git a/tests/baselines/reference/functionOverloads16.js b/tests/baselines/reference/functionOverloads16.js index ebf82febd16..a0fdaa88894 100644 --- a/tests/baselines/reference/functionOverloads16.js +++ b/tests/baselines/reference/functionOverloads16.js @@ -5,6 +5,4 @@ function foo(foo:{a:string; b?:number;}):any { return "" } //// [functionOverloads16.js] -function foo(foo) { - return ""; -} +function foo(foo) { return ""; } diff --git a/tests/baselines/reference/functionOverloads17.js b/tests/baselines/reference/functionOverloads17.js index d9fa54b744b..3a5dcd81914 100644 --- a/tests/baselines/reference/functionOverloads17.js +++ b/tests/baselines/reference/functionOverloads17.js @@ -4,6 +4,4 @@ function foo():{a:string;} { return {a:""} } //// [functionOverloads17.js] -function foo() { - return { a: "" }; -} +function foo() { return { a: "" }; } diff --git a/tests/baselines/reference/functionOverloads18.js b/tests/baselines/reference/functionOverloads18.js index e1061a32c09..8c196831e48 100644 --- a/tests/baselines/reference/functionOverloads18.js +++ b/tests/baselines/reference/functionOverloads18.js @@ -4,6 +4,4 @@ function foo(bar:{a:string;}) { return {a:""} } //// [functionOverloads18.js] -function foo(bar) { - return { a: "" }; -} +function foo(bar) { return { a: "" }; } diff --git a/tests/baselines/reference/functionOverloads19.js b/tests/baselines/reference/functionOverloads19.js index 6b383225dd0..4183f6a48b8 100644 --- a/tests/baselines/reference/functionOverloads19.js +++ b/tests/baselines/reference/functionOverloads19.js @@ -5,6 +5,4 @@ function foo(bar:{a:any;}) { return {a:""} } //// [functionOverloads19.js] -function foo(bar) { - return { a: "" }; -} +function foo(bar) { return { a: "" }; } diff --git a/tests/baselines/reference/functionOverloads2.js b/tests/baselines/reference/functionOverloads2.js index 7e9eb45d236..39a58663cf4 100644 --- a/tests/baselines/reference/functionOverloads2.js +++ b/tests/baselines/reference/functionOverloads2.js @@ -5,8 +5,6 @@ function foo(bar: any): any { return bar }; var x = foo(true); //// [functionOverloads2.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } ; var x = foo(true); diff --git a/tests/baselines/reference/functionOverloads20.js b/tests/baselines/reference/functionOverloads20.js index 012f2ce09cd..4f259a88538 100644 --- a/tests/baselines/reference/functionOverloads20.js +++ b/tests/baselines/reference/functionOverloads20.js @@ -5,6 +5,4 @@ function foo(bar:{a:any;}): string {return ""} //// [functionOverloads20.js] -function foo(bar) { - return ""; -} +function foo(bar) { return ""; } diff --git a/tests/baselines/reference/functionOverloads21.js b/tests/baselines/reference/functionOverloads21.js index 78fb1fe011f..6e69169efbf 100644 --- a/tests/baselines/reference/functionOverloads21.js +++ b/tests/baselines/reference/functionOverloads21.js @@ -5,6 +5,4 @@ function foo(bar:{a:any; b?:string;}[]) { return 0 } //// [functionOverloads21.js] -function foo(bar) { - return 0; -} +function foo(bar) { return 0; } diff --git a/tests/baselines/reference/functionOverloads22.js b/tests/baselines/reference/functionOverloads22.js index 531c37770b1..54b745d96dd 100644 --- a/tests/baselines/reference/functionOverloads22.js +++ b/tests/baselines/reference/functionOverloads22.js @@ -5,6 +5,4 @@ function foo(bar:any):{a:any;b?:any;}[] { return [{a:""}] } //// [functionOverloads22.js] -function foo(bar) { - return [{ a: "" }]; -} +function foo(bar) { return [{ a: "" }]; } diff --git a/tests/baselines/reference/functionOverloads23.js b/tests/baselines/reference/functionOverloads23.js index d8cac7eb8ee..aa3a7172ada 100644 --- a/tests/baselines/reference/functionOverloads23.js +++ b/tests/baselines/reference/functionOverloads23.js @@ -5,6 +5,4 @@ function foo(bar:(a?)=>void) { return 0 } //// [functionOverloads23.js] -function foo(bar) { - return 0; -} +function foo(bar) { return 0; } diff --git a/tests/baselines/reference/functionOverloads24.js b/tests/baselines/reference/functionOverloads24.js index c7255063174..8fcc3c81902 100644 --- a/tests/baselines/reference/functionOverloads24.js +++ b/tests/baselines/reference/functionOverloads24.js @@ -5,6 +5,4 @@ function foo(bar:any):(a)=>void { return function(){} } //// [functionOverloads24.js] -function foo(bar) { - return function () { }; -} +function foo(bar) { return function () { }; } diff --git a/tests/baselines/reference/functionOverloads25.js b/tests/baselines/reference/functionOverloads25.js index bbaef498926..d466aa82d21 100644 --- a/tests/baselines/reference/functionOverloads25.js +++ b/tests/baselines/reference/functionOverloads25.js @@ -6,8 +6,6 @@ var x = foo(); //// [functionOverloads25.js] -function foo(bar) { - return ''; -} +function foo(bar) { return ''; } ; var x = foo(); diff --git a/tests/baselines/reference/functionOverloads26.js b/tests/baselines/reference/functionOverloads26.js index 088c06147ba..bc4d017b9bb 100644 --- a/tests/baselines/reference/functionOverloads26.js +++ b/tests/baselines/reference/functionOverloads26.js @@ -6,7 +6,5 @@ var x = foo('baz'); //// [functionOverloads26.js] -function foo(bar) { - return ''; -} +function foo(bar) { return ''; } var x = foo('baz'); diff --git a/tests/baselines/reference/functionOverloads27.js b/tests/baselines/reference/functionOverloads27.js index 2b11b1f6c4e..199905d8219 100644 --- a/tests/baselines/reference/functionOverloads27.js +++ b/tests/baselines/reference/functionOverloads27.js @@ -6,7 +6,5 @@ var x = foo(5); //// [functionOverloads27.js] -function foo(bar) { - return ''; -} +function foo(bar) { return ''; } var x = foo(5); diff --git a/tests/baselines/reference/functionOverloads28.js b/tests/baselines/reference/functionOverloads28.js index 566972ee25d..d10ef52e2b2 100644 --- a/tests/baselines/reference/functionOverloads28.js +++ b/tests/baselines/reference/functionOverloads28.js @@ -6,8 +6,6 @@ var t:any; var x = foo(t); //// [functionOverloads28.js] -function foo(bar) { - return ''; -} +function foo(bar) { return ''; } var t; var x = foo(t); diff --git a/tests/baselines/reference/functionOverloads29.js b/tests/baselines/reference/functionOverloads29.js index c828bb95917..edc1ea178bc 100644 --- a/tests/baselines/reference/functionOverloads29.js +++ b/tests/baselines/reference/functionOverloads29.js @@ -6,7 +6,5 @@ var x = foo(); //// [functionOverloads29.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo(); diff --git a/tests/baselines/reference/functionOverloads30.js b/tests/baselines/reference/functionOverloads30.js index 27b1436b6fb..bc7593a0771 100644 --- a/tests/baselines/reference/functionOverloads30.js +++ b/tests/baselines/reference/functionOverloads30.js @@ -6,7 +6,5 @@ var x = foo('bar'); //// [functionOverloads30.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo('bar'); diff --git a/tests/baselines/reference/functionOverloads31.js b/tests/baselines/reference/functionOverloads31.js index 01cee2c342b..2c2a15821a7 100644 --- a/tests/baselines/reference/functionOverloads31.js +++ b/tests/baselines/reference/functionOverloads31.js @@ -6,7 +6,5 @@ var x = foo(5); //// [functionOverloads31.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo(5); diff --git a/tests/baselines/reference/functionOverloads32.js b/tests/baselines/reference/functionOverloads32.js index 4e0efa98b09..a5557042dfb 100644 --- a/tests/baselines/reference/functionOverloads32.js +++ b/tests/baselines/reference/functionOverloads32.js @@ -6,8 +6,6 @@ var baz:number; var x = foo(baz); //// [functionOverloads32.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var baz; var x = foo(baz); diff --git a/tests/baselines/reference/functionOverloads33.js b/tests/baselines/reference/functionOverloads33.js index 0c01cd54d1e..98bcc09b8b4 100644 --- a/tests/baselines/reference/functionOverloads33.js +++ b/tests/baselines/reference/functionOverloads33.js @@ -6,7 +6,5 @@ var x = foo(5); //// [functionOverloads33.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo(5); diff --git a/tests/baselines/reference/functionOverloads34.js b/tests/baselines/reference/functionOverloads34.js index 48ac2b5fc59..3d4311e4193 100644 --- a/tests/baselines/reference/functionOverloads34.js +++ b/tests/baselines/reference/functionOverloads34.js @@ -6,7 +6,5 @@ var x = foo(); //// [functionOverloads34.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo(); diff --git a/tests/baselines/reference/functionOverloads35.js b/tests/baselines/reference/functionOverloads35.js index fa373a9ee52..b25ac6c3c5f 100644 --- a/tests/baselines/reference/functionOverloads35.js +++ b/tests/baselines/reference/functionOverloads35.js @@ -6,7 +6,5 @@ var x = foo({a:1}); //// [functionOverloads35.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo({ a: 1 }); diff --git a/tests/baselines/reference/functionOverloads36.js b/tests/baselines/reference/functionOverloads36.js index 33f6156c66b..4e790917d93 100644 --- a/tests/baselines/reference/functionOverloads36.js +++ b/tests/baselines/reference/functionOverloads36.js @@ -6,7 +6,5 @@ var x = foo({a:'foo'}); //// [functionOverloads36.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo({ a: 'foo' }); diff --git a/tests/baselines/reference/functionOverloads37.js b/tests/baselines/reference/functionOverloads37.js index f9e6130dbd9..c4e0d4fd18b 100644 --- a/tests/baselines/reference/functionOverloads37.js +++ b/tests/baselines/reference/functionOverloads37.js @@ -6,7 +6,5 @@ var x = foo(); //// [functionOverloads37.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo(); diff --git a/tests/baselines/reference/functionOverloads38.js b/tests/baselines/reference/functionOverloads38.js index 410b4358ede..c973cbe7b67 100644 --- a/tests/baselines/reference/functionOverloads38.js +++ b/tests/baselines/reference/functionOverloads38.js @@ -6,7 +6,5 @@ var x = foo([{a:1}]); //// [functionOverloads38.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo([{ a: 1 }]); diff --git a/tests/baselines/reference/functionOverloads39.js b/tests/baselines/reference/functionOverloads39.js index 771a3148036..ad4ded394d8 100644 --- a/tests/baselines/reference/functionOverloads39.js +++ b/tests/baselines/reference/functionOverloads39.js @@ -6,7 +6,5 @@ var x = foo([{a:true}]); //// [functionOverloads39.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo([{ a: true }]); diff --git a/tests/baselines/reference/functionOverloads4.js b/tests/baselines/reference/functionOverloads4.js index b428f6938b4..3a1ff2ced33 100644 --- a/tests/baselines/reference/functionOverloads4.js +++ b/tests/baselines/reference/functionOverloads4.js @@ -3,6 +3,4 @@ function foo():number; function foo():string { return "a" } //// [functionOverloads4.js] -function foo() { - return "a"; -} +function foo() { return "a"; } diff --git a/tests/baselines/reference/functionOverloads40.js b/tests/baselines/reference/functionOverloads40.js index f718f0a8847..11edff26a4b 100644 --- a/tests/baselines/reference/functionOverloads40.js +++ b/tests/baselines/reference/functionOverloads40.js @@ -6,7 +6,5 @@ var x = foo([{a:'bar'}]); //// [functionOverloads40.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo([{ a: 'bar' }]); diff --git a/tests/baselines/reference/functionOverloads41.js b/tests/baselines/reference/functionOverloads41.js index 566ef21424f..dd730e25b31 100644 --- a/tests/baselines/reference/functionOverloads41.js +++ b/tests/baselines/reference/functionOverloads41.js @@ -6,7 +6,5 @@ var x = foo([{}]); //// [functionOverloads41.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo([{}]); diff --git a/tests/baselines/reference/functionOverloads42.js b/tests/baselines/reference/functionOverloads42.js index fcca395581c..979bfa86d62 100644 --- a/tests/baselines/reference/functionOverloads42.js +++ b/tests/baselines/reference/functionOverloads42.js @@ -6,7 +6,5 @@ var x = foo([{a:'s'}]); //// [functionOverloads42.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo([{ a: 's' }]); diff --git a/tests/baselines/reference/functionOverloads7.js b/tests/baselines/reference/functionOverloads7.js index 52cac83af72..540abf9eb8c 100644 --- a/tests/baselines/reference/functionOverloads7.js +++ b/tests/baselines/reference/functionOverloads7.js @@ -14,9 +14,7 @@ class foo { var foo = (function () { function foo() { } - foo.prototype.bar = function (foo) { - return "foo"; - }; + foo.prototype.bar = function (foo) { return "foo"; }; foo.prototype.n = function () { var foo = this.bar(); foo = this.bar("test"); diff --git a/tests/baselines/reference/functionOverloads8.js b/tests/baselines/reference/functionOverloads8.js index 08c2c0b65a1..55539a61659 100644 --- a/tests/baselines/reference/functionOverloads8.js +++ b/tests/baselines/reference/functionOverloads8.js @@ -5,6 +5,4 @@ function foo(foo?:any){ return '' } //// [functionOverloads8.js] -function foo(foo) { - return ''; -} +function foo(foo) { return ''; } diff --git a/tests/baselines/reference/functionOverloads9.js b/tests/baselines/reference/functionOverloads9.js index 53cc0385a59..9d2ae21f4fa 100644 --- a/tests/baselines/reference/functionOverloads9.js +++ b/tests/baselines/reference/functionOverloads9.js @@ -5,8 +5,6 @@ var x = foo('foo'); //// [functionOverloads9.js] -function foo(foo) { - return ''; -} +function foo(foo) { return ''; } ; var x = foo('foo'); diff --git a/tests/baselines/reference/functionReturn.js b/tests/baselines/reference/functionReturn.js index fbb889589a0..c433eec190d 100644 --- a/tests/baselines/reference/functionReturn.js +++ b/tests/baselines/reference/functionReturn.js @@ -20,9 +20,7 @@ function f1() { var n = f0(); } function f2() { } -function f3() { - return; -} +function f3() { return; } function f4() { return ''; return; diff --git a/tests/baselines/reference/generatedContextualTyping.js b/tests/baselines/reference/generatedContextualTyping.js index 68cc22ff45e..0337ab8f1a1 100644 --- a/tests/baselines/reference/generatedContextualTyping.js +++ b/tests/baselines/reference/generatedContextualTyping.js @@ -382,30 +382,17 @@ var Derived2 = (function (_super) { })(Base); var b = new Base(), d1 = new Derived1(), d2 = new Derived2(); var x1 = function () { return [d1, d2]; }; -var x2 = function () { - return [d1, d2]; -}; -var x3 = function named() { - return [d1, d2]; -}; +var x2 = function () { return [d1, d2]; }; +var x3 = function named() { return [d1, d2]; }; var x4 = function () { return [d1, d2]; }; -var x5 = function () { - return [d1, d2]; -}; -var x6 = function named() { - return [d1, d2]; -}; +var x5 = function () { return [d1, d2]; }; +var x6 = function named() { return [d1, d2]; }; var x7 = [d1, d2]; var x8 = [d1, d2]; var x9 = [d1, d2]; var x10 = { n: [d1, d2] }; -var x11 = function (n) { - var n; - return null; -}; -var x12 = { func: function (n) { - return [d1, d2]; -} }; +var x11 = function (n) { var n; return null; }; +var x12 = { func: function (n) { return [d1, d2]; } }; var x13 = (function () { function x13() { this.member = function () { return [d1, d2]; }; @@ -414,17 +401,13 @@ var x13 = (function () { })(); var x14 = (function () { function x14() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x14; })(); var x15 = (function () { function x15() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x15; })(); @@ -436,17 +419,13 @@ var x16 = (function () { })(); var x17 = (function () { function x17() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x17; })(); var x18 = (function () { function x18() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x18; })(); @@ -476,18 +455,13 @@ var x22 = (function () { })(); var x23 = (function () { function x23() { - this.member = function (n) { - var n; - return null; - }; + this.member = function (n) { var n; return null; }; } return x23; })(); var x24 = (function () { function x24() { - this.member = { func: function (n) { - return [d1, d2]; - } }; + this.member = { func: function (n) { return [d1, d2]; } }; } return x24; })(); @@ -499,17 +473,13 @@ var x25 = (function () { })(); var x26 = (function () { function x26() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x26; })(); var x27 = (function () { function x27() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x27; })(); @@ -521,17 +491,13 @@ var x28 = (function () { })(); var x29 = (function () { function x29() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x29; })(); var x30 = (function () { function x30() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x30; })(); @@ -561,18 +527,13 @@ var x34 = (function () { })(); var x35 = (function () { function x35() { - this.member = function (n) { - var n; - return null; - }; + this.member = function (n) { var n; return null; }; } return x35; })(); var x36 = (function () { function x36() { - this.member = { func: function (n) { - return [d1, d2]; - } }; + this.member = { func: function (n) { return [d1, d2]; } }; } return x36; })(); @@ -584,17 +545,13 @@ var x37 = (function () { })(); var x38 = (function () { function x38() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x38; })(); var x39 = (function () { function x39() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x39; })(); @@ -606,17 +563,13 @@ var x40 = (function () { })(); var x41 = (function () { function x41() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x41; })(); var x42 = (function () { function x42() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x42; })(); @@ -646,18 +599,13 @@ var x46 = (function () { })(); var x47 = (function () { function x47() { - this.member = function (n) { - var n; - return null; - }; + this.member = function (n) { var n; return null; }; } return x47; })(); var x48 = (function () { function x48() { - this.member = { func: function (n) { - return [d1, d2]; - } }; + this.member = { func: function (n) { return [d1, d2]; } }; } return x48; })(); @@ -670,17 +618,13 @@ var x49 = (function () { var x50 = (function () { function x50() { } - x50.member = function () { - return [d1, d2]; - }; + x50.member = function () { return [d1, d2]; }; return x50; })(); var x51 = (function () { function x51() { } - x51.member = function named() { - return [d1, d2]; - }; + x51.member = function named() { return [d1, d2]; }; return x51; })(); var x52 = (function () { @@ -692,17 +636,13 @@ var x52 = (function () { var x53 = (function () { function x53() { } - x53.member = function () { - return [d1, d2]; - }; + x53.member = function () { return [d1, d2]; }; return x53; })(); var x54 = (function () { function x54() { } - x54.member = function named() { - return [d1, d2]; - }; + x54.member = function named() { return [d1, d2]; }; return x54; })(); var x55 = (function () { @@ -732,18 +672,13 @@ var x58 = (function () { var x59 = (function () { function x59() { } - x59.member = function (n) { - var n; - return null; - }; + x59.member = function (n) { var n; return null; }; return x59; })(); var x60 = (function () { function x60() { } - x60.member = { func: function (n) { - return [d1, d2]; - } }; + x60.member = { func: function (n) { return [d1, d2]; } }; return x60; })(); var x61 = (function () { @@ -755,17 +690,13 @@ var x61 = (function () { var x62 = (function () { function x62() { } - x62.member = function () { - return [d1, d2]; - }; + x62.member = function () { return [d1, d2]; }; return x62; })(); var x63 = (function () { function x63() { } - x63.member = function named() { - return [d1, d2]; - }; + x63.member = function named() { return [d1, d2]; }; return x63; })(); var x64 = (function () { @@ -777,17 +708,13 @@ var x64 = (function () { var x65 = (function () { function x65() { } - x65.member = function () { - return [d1, d2]; - }; + x65.member = function () { return [d1, d2]; }; return x65; })(); var x66 = (function () { function x66() { } - x66.member = function named() { - return [d1, d2]; - }; + x66.member = function named() { return [d1, d2]; }; return x66; })(); var x67 = (function () { @@ -817,18 +744,13 @@ var x70 = (function () { var x71 = (function () { function x71() { } - x71.member = function (n) { - var n; - return null; - }; + x71.member = function (n) { var n; return null; }; return x71; })(); var x72 = (function () { function x72() { } - x72.member = { func: function (n) { - return [d1, d2]; - } }; + x72.member = { func: function (n) { return [d1, d2]; } }; return x72; })(); var x73 = (function () { @@ -840,17 +762,13 @@ var x73 = (function () { var x74 = (function () { function x74() { } - x74.member = function () { - return [d1, d2]; - }; + x74.member = function () { return [d1, d2]; }; return x74; })(); var x75 = (function () { function x75() { } - x75.member = function named() { - return [d1, d2]; - }; + x75.member = function named() { return [d1, d2]; }; return x75; })(); var x76 = (function () { @@ -862,17 +780,13 @@ var x76 = (function () { var x77 = (function () { function x77() { } - x77.member = function () { - return [d1, d2]; - }; + x77.member = function () { return [d1, d2]; }; return x77; })(); var x78 = (function () { function x78() { } - x78.member = function named() { - return [d1, d2]; - }; + x78.member = function named() { return [d1, d2]; }; return x78; })(); var x79 = (function () { @@ -902,18 +816,13 @@ var x82 = (function () { var x83 = (function () { function x83() { } - x83.member = function (n) { - var n; - return null; - }; + x83.member = function (n) { var n; return null; }; return x83; })(); var x84 = (function () { function x84() { } - x84.member = { func: function (n) { - return [d1, d2]; - } }; + x84.member = { func: function (n) { return [d1, d2]; } }; return x84; })(); var x85 = (function () { @@ -924,17 +833,13 @@ var x85 = (function () { })(); var x86 = (function () { function x86(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } } return x86; })(); var x87 = (function () { function x87(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } } return x87; })(); @@ -946,17 +851,13 @@ var x88 = (function () { })(); var x89 = (function () { function x89(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } } return x89; })(); var x90 = (function () { function x90(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } } return x90; })(); @@ -986,18 +887,13 @@ var x94 = (function () { })(); var x95 = (function () { function x95(parm) { - if (parm === void 0) { parm = function (n) { - var n; - return null; - }; } + if (parm === void 0) { parm = function (n) { var n; return null; }; } } return x95; })(); var x96 = (function () { function x96(parm) { - if (parm === void 0) { parm = { func: function (n) { - return [d1, d2]; - } }; } + if (parm === void 0) { parm = { func: function (n) { return [d1, d2]; } }; } } return x96; })(); @@ -1010,18 +906,14 @@ var x97 = (function () { })(); var x98 = (function () { function x98(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } this.parm = parm; } return x98; })(); var x99 = (function () { function x99(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } this.parm = parm; } return x99; @@ -1035,18 +927,14 @@ var x100 = (function () { })(); var x101 = (function () { function x101(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } this.parm = parm; } return x101; })(); var x102 = (function () { function x102(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } this.parm = parm; } return x102; @@ -1081,19 +969,14 @@ var x106 = (function () { })(); var x107 = (function () { function x107(parm) { - if (parm === void 0) { parm = function (n) { - var n; - return null; - }; } + if (parm === void 0) { parm = function (n) { var n; return null; }; } this.parm = parm; } return x107; })(); var x108 = (function () { function x108(parm) { - if (parm === void 0) { parm = { func: function (n) { - return [d1, d2]; - } }; } + if (parm === void 0) { parm = { func: function (n) { return [d1, d2]; } }; } this.parm = parm; } return x108; @@ -1107,18 +990,14 @@ var x109 = (function () { })(); var x110 = (function () { function x110(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } this.parm = parm; } return x110; })(); var x111 = (function () { function x111(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } this.parm = parm; } return x111; @@ -1132,18 +1011,14 @@ var x112 = (function () { })(); var x113 = (function () { function x113(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } this.parm = parm; } return x113; })(); var x114 = (function () { function x114(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } this.parm = parm; } return x114; @@ -1178,19 +1053,14 @@ var x118 = (function () { })(); var x119 = (function () { function x119(parm) { - if (parm === void 0) { parm = function (n) { - var n; - return null; - }; } + if (parm === void 0) { parm = function (n) { var n; return null; }; } this.parm = parm; } return x119; })(); var x120 = (function () { function x120(parm) { - if (parm === void 0) { parm = { func: function (n) { - return [d1, d2]; - } }; } + if (parm === void 0) { parm = { func: function (n) { return [d1, d2]; } }; } this.parm = parm; } return x120; @@ -1207,242 +1077,65 @@ function x129(parm) { } function x130(parm) { } function x131(parm) { } function x132(parm) { } -function x133() { - return function () { return [d1, d2]; }; -} -function x134() { - return function () { - return [d1, d2]; - }; -} -function x135() { - return function named() { - return [d1, d2]; - }; -} -function x136() { - return function () { return [d1, d2]; }; -} -function x137() { - return function () { - return [d1, d2]; - }; -} -function x138() { - return function named() { - return [d1, d2]; - }; -} -function x139() { - return [d1, d2]; -} -function x140() { - return [d1, d2]; -} -function x141() { - return [d1, d2]; -} -function x142() { - return { n: [d1, d2] }; -} -function x143() { - return function (n) { - var n; - return null; - }; -} -function x144() { - return { func: function (n) { - return [d1, d2]; - } }; -} -function x145() { - return function () { return [d1, d2]; }; - return function () { return [d1, d2]; }; -} -function x146() { - return function () { - return [d1, d2]; - }; - return function () { - return [d1, d2]; - }; -} -function x147() { - return function named() { - return [d1, d2]; - }; - return function named() { - return [d1, d2]; - }; -} -function x148() { - return function () { return [d1, d2]; }; - return function () { return [d1, d2]; }; -} -function x149() { - return function () { - return [d1, d2]; - }; - return function () { - return [d1, d2]; - }; -} -function x150() { - return function named() { - return [d1, d2]; - }; - return function named() { - return [d1, d2]; - }; -} -function x151() { - return [d1, d2]; - return [d1, d2]; -} -function x152() { - return [d1, d2]; - return [d1, d2]; -} -function x153() { - return [d1, d2]; - return [d1, d2]; -} -function x154() { - return { n: [d1, d2] }; - return { n: [d1, d2] }; -} -function x155() { - return function (n) { - var n; - return null; - }; - return function (n) { - var n; - return null; - }; -} -function x156() { - return { func: function (n) { - return [d1, d2]; - } }; - return { func: function (n) { - return [d1, d2]; - } }; -} -var x157 = function () { - return function () { return [d1, d2]; }; -}; -var x158 = function () { - return function () { - return [d1, d2]; - }; -}; -var x159 = function () { - return function named() { - return [d1, d2]; - }; -}; -var x160 = function () { - return function () { return [d1, d2]; }; -}; -var x161 = function () { - return function () { - return [d1, d2]; - }; -}; -var x162 = function () { - return function named() { - return [d1, d2]; - }; -}; -var x163 = function () { - return [d1, d2]; -}; -var x164 = function () { - return [d1, d2]; -}; -var x165 = function () { - return [d1, d2]; -}; -var x166 = function () { - return { n: [d1, d2] }; -}; -var x167 = function () { - return function (n) { - var n; - return null; - }; -}; -var x168 = function () { - return { func: function (n) { - return [d1, d2]; - } }; -}; -var x169 = function () { - return function () { return [d1, d2]; }; -}; -var x170 = function () { - return function () { - return [d1, d2]; - }; -}; -var x171 = function () { - return function named() { - return [d1, d2]; - }; -}; -var x172 = function () { - return function () { return [d1, d2]; }; -}; -var x173 = function () { - return function () { - return [d1, d2]; - }; -}; -var x174 = function () { - return function named() { - return [d1, d2]; - }; -}; -var x175 = function () { - return [d1, d2]; -}; -var x176 = function () { - return [d1, d2]; -}; -var x177 = function () { - return [d1, d2]; -}; -var x178 = function () { - return { n: [d1, d2] }; -}; -var x179 = function () { - return function (n) { - var n; - return null; - }; -}; -var x180 = function () { - return { func: function (n) { - return [d1, d2]; - } }; -}; +function x133() { return function () { return [d1, d2]; }; } +function x134() { return function () { return [d1, d2]; }; } +function x135() { return function named() { return [d1, d2]; }; } +function x136() { return function () { return [d1, d2]; }; } +function x137() { return function () { return [d1, d2]; }; } +function x138() { return function named() { return [d1, d2]; }; } +function x139() { return [d1, d2]; } +function x140() { return [d1, d2]; } +function x141() { return [d1, d2]; } +function x142() { return { n: [d1, d2] }; } +function x143() { return function (n) { var n; return null; }; } +function x144() { return { func: function (n) { return [d1, d2]; } }; } +function x145() { return function () { return [d1, d2]; }; return function () { return [d1, d2]; }; } +function x146() { return function () { return [d1, d2]; }; return function () { return [d1, d2]; }; } +function x147() { return function named() { return [d1, d2]; }; return function named() { return [d1, d2]; }; } +function x148() { return function () { return [d1, d2]; }; return function () { return [d1, d2]; }; } +function x149() { return function () { return [d1, d2]; }; return function () { return [d1, d2]; }; } +function x150() { return function named() { return [d1, d2]; }; return function named() { return [d1, d2]; }; } +function x151() { return [d1, d2]; return [d1, d2]; } +function x152() { return [d1, d2]; return [d1, d2]; } +function x153() { return [d1, d2]; return [d1, d2]; } +function x154() { return { n: [d1, d2] }; return { n: [d1, d2] }; } +function x155() { return function (n) { var n; return null; }; return function (n) { var n; return null; }; } +function x156() { return { func: function (n) { return [d1, d2]; } }; return { func: function (n) { return [d1, d2]; } }; } +var x157 = function () { return function () { return [d1, d2]; }; }; +var x158 = function () { return function () { return [d1, d2]; }; }; +var x159 = function () { return function named() { return [d1, d2]; }; }; +var x160 = function () { return function () { return [d1, d2]; }; }; +var x161 = function () { return function () { return [d1, d2]; }; }; +var x162 = function () { return function named() { return [d1, d2]; }; }; +var x163 = function () { return [d1, d2]; }; +var x164 = function () { return [d1, d2]; }; +var x165 = function () { return [d1, d2]; }; +var x166 = function () { return { n: [d1, d2] }; }; +var x167 = function () { return function (n) { var n; return null; }; }; +var x168 = function () { return { func: function (n) { return [d1, d2]; } }; }; +var x169 = function () { return function () { return [d1, d2]; }; }; +var x170 = function () { return function () { return [d1, d2]; }; }; +var x171 = function () { return function named() { return [d1, d2]; }; }; +var x172 = function () { return function () { return [d1, d2]; }; }; +var x173 = function () { return function () { return [d1, d2]; }; }; +var x174 = function () { return function named() { return [d1, d2]; }; }; +var x175 = function () { return [d1, d2]; }; +var x176 = function () { return [d1, d2]; }; +var x177 = function () { return [d1, d2]; }; +var x178 = function () { return { n: [d1, d2] }; }; +var x179 = function () { return function (n) { var n; return null; }; }; +var x180 = function () { return { func: function (n) { return [d1, d2]; } }; }; var x181; (function (x181) { var t = function () { return [d1, d2]; }; })(x181 || (x181 = {})); var x182; (function (x182) { - var t = function () { - return [d1, d2]; - }; + var t = function () { return [d1, d2]; }; })(x182 || (x182 = {})); var x183; (function (x183) { - var t = function named() { - return [d1, d2]; - }; + var t = function named() { return [d1, d2]; }; })(x183 || (x183 = {})); var x184; (function (x184) { @@ -1450,15 +1143,11 @@ var x184; })(x184 || (x184 = {})); var x185; (function (x185) { - var t = function () { - return [d1, d2]; - }; + var t = function () { return [d1, d2]; }; })(x185 || (x185 = {})); var x186; (function (x186) { - var t = function named() { - return [d1, d2]; - }; + var t = function named() { return [d1, d2]; }; })(x186 || (x186 = {})); var x187; (function (x187) { @@ -1478,16 +1167,11 @@ var x190; })(x190 || (x190 = {})); var x191; (function (x191) { - var t = function (n) { - var n; - return null; - }; + var t = function (n) { var n; return null; }; })(x191 || (x191 = {})); var x192; (function (x192) { - var t = { func: function (n) { - return [d1, d2]; - } }; + var t = { func: function (n) { return [d1, d2]; } }; })(x192 || (x192 = {})); var x193; (function (x193) { @@ -1495,15 +1179,11 @@ var x193; })(x193 || (x193 = {})); var x194; (function (x194) { - x194.t = function () { - return [d1, d2]; - }; + x194.t = function () { return [d1, d2]; }; })(x194 || (x194 = {})); var x195; (function (x195) { - x195.t = function named() { - return [d1, d2]; - }; + x195.t = function named() { return [d1, d2]; }; })(x195 || (x195 = {})); var x196; (function (x196) { @@ -1511,15 +1191,11 @@ var x196; })(x196 || (x196 = {})); var x197; (function (x197) { - x197.t = function () { - return [d1, d2]; - }; + x197.t = function () { return [d1, d2]; }; })(x197 || (x197 = {})); var x198; (function (x198) { - x198.t = function named() { - return [d1, d2]; - }; + x198.t = function named() { return [d1, d2]; }; })(x198 || (x198 = {})); var x199; (function (x199) { @@ -1539,48 +1215,25 @@ var x202; })(x202 || (x202 = {})); var x203; (function (x203) { - x203.t = function (n) { - var n; - return null; - }; + x203.t = function (n) { var n; return null; }; })(x203 || (x203 = {})); var x204; (function (x204) { - x204.t = { func: function (n) { - return [d1, d2]; - } }; + x204.t = { func: function (n) { return [d1, d2]; } }; })(x204 || (x204 = {})); -var x206 = function () { - return [d1, d2]; -}; -var x207 = function named() { - return [d1, d2]; -}; -var x209 = function () { - return [d1, d2]; -}; -var x210 = function named() { - return [d1, d2]; -}; +var x206 = function () { return [d1, d2]; }; +var x207 = function named() { return [d1, d2]; }; +var x209 = function () { return [d1, d2]; }; +var x210 = function named() { return [d1, d2]; }; var x211 = [d1, d2]; var x212 = [d1, d2]; var x213 = [d1, d2]; var x214 = { n: [d1, d2] }; -var x216 = { func: function (n) { - return [d1, d2]; -} }; -var x217 = undefined || function () { - return [d1, d2]; -}; -var x218 = undefined || function named() { - return [d1, d2]; -}; -var x219 = undefined || function () { - return [d1, d2]; -}; -var x220 = undefined || function named() { - return [d1, d2]; -}; +var x216 = { func: function (n) { return [d1, d2]; } }; +var x217 = undefined || function () { return [d1, d2]; }; +var x218 = undefined || function named() { return [d1, d2]; }; +var x219 = undefined || function () { return [d1, d2]; }; +var x220 = undefined || function named() { return [d1, d2]; }; var x221 = undefined || [d1, d2]; var x222 = undefined || [d1, d2]; var x223 = undefined || [d1, d2]; @@ -1588,23 +1241,15 @@ var x224 = undefined || { n: [d1, d2] }; var x225; x225 = function () { return [d1, d2]; }; var x226; -x226 = function () { - return [d1, d2]; -}; +x226 = function () { return [d1, d2]; }; var x227; -x227 = function named() { - return [d1, d2]; -}; +x227 = function named() { return [d1, d2]; }; var x228; x228 = function () { return [d1, d2]; }; var x229; -x229 = function () { - return [d1, d2]; -}; +x229 = function () { return [d1, d2]; }; var x230; -x230 = function named() { - return [d1, d2]; -}; +x230 = function named() { return [d1, d2]; }; var x231; x231 = [d1, d2]; var x232; @@ -1614,223 +1259,107 @@ x233 = [d1, d2]; var x234; x234 = { n: [d1, d2] }; var x235; -x235 = function (n) { - var n; - return null; -}; +x235 = function (n) { var n; return null; }; var x236; -x236 = { func: function (n) { - return [d1, d2]; -} }; +x236 = { func: function (n) { return [d1, d2]; } }; var x237 = { n: function () { return [d1, d2]; } }; -var x238 = { n: function () { - return [d1, d2]; -} }; -var x239 = { n: function named() { - return [d1, d2]; -} }; +var x238 = { n: function () { return [d1, d2]; } }; +var x239 = { n: function named() { return [d1, d2]; } }; var x240 = { n: function () { return [d1, d2]; } }; -var x241 = { n: function () { - return [d1, d2]; -} }; -var x242 = { n: function named() { - return [d1, d2]; -} }; +var x241 = { n: function () { return [d1, d2]; } }; +var x242 = { n: function named() { return [d1, d2]; } }; var x243 = { n: [d1, d2] }; var x244 = { n: [d1, d2] }; var x245 = { n: [d1, d2] }; var x246 = { n: { n: [d1, d2] } }; -var x247 = { n: function (n) { - var n; - return null; -} }; -var x248 = { n: { func: function (n) { - return [d1, d2]; -} } }; +var x247 = { n: function (n) { var n; return null; } }; +var x248 = { n: { func: function (n) { return [d1, d2]; } } }; var x252 = [function () { return [d1, d2]; }]; -var x253 = [function () { - return [d1, d2]; -}]; -var x254 = [function named() { - return [d1, d2]; -}]; +var x253 = [function () { return [d1, d2]; }]; +var x254 = [function named() { return [d1, d2]; }]; var x255 = [[d1, d2]]; var x256 = [[d1, d2]]; var x257 = [[d1, d2]]; var x258 = [{ n: [d1, d2] }]; -var x260 = [{ func: function (n) { - return [d1, d2]; -} }]; -var x261 = function () { - return [d1, d2]; -} || undefined; -var x262 = function named() { - return [d1, d2]; -} || undefined; -var x263 = function () { - return [d1, d2]; -} || undefined; -var x264 = function named() { - return [d1, d2]; -} || undefined; +var x260 = [{ func: function (n) { return [d1, d2]; } }]; +var x261 = function () { return [d1, d2]; } || undefined; +var x262 = function named() { return [d1, d2]; } || undefined; +var x263 = function () { return [d1, d2]; } || undefined; +var x264 = function named() { return [d1, d2]; } || undefined; var x265 = [d1, d2] || undefined; var x266 = [d1, d2] || undefined; var x267 = [d1, d2] || undefined; var x268 = { n: [d1, d2] } || undefined; -var x269 = undefined || function () { - return [d1, d2]; -}; -var x270 = undefined || function named() { - return [d1, d2]; -}; -var x271 = undefined || function () { - return [d1, d2]; -}; -var x272 = undefined || function named() { - return [d1, d2]; -}; +var x269 = undefined || function () { return [d1, d2]; }; +var x270 = undefined || function named() { return [d1, d2]; }; +var x271 = undefined || function () { return [d1, d2]; }; +var x272 = undefined || function named() { return [d1, d2]; }; var x273 = undefined || [d1, d2]; var x274 = undefined || [d1, d2]; var x275 = undefined || [d1, d2]; var x276 = undefined || { n: [d1, d2] }; -var x277 = function () { - return [d1, d2]; -} || function () { - return [d1, d2]; -}; -var x278 = function named() { - return [d1, d2]; -} || function named() { - return [d1, d2]; -}; -var x279 = function () { - return [d1, d2]; -} || function () { - return [d1, d2]; -}; -var x280 = function named() { - return [d1, d2]; -} || function named() { - return [d1, d2]; -}; +var x277 = function () { return [d1, d2]; } || function () { return [d1, d2]; }; +var x278 = function named() { return [d1, d2]; } || function named() { return [d1, d2]; }; +var x279 = function () { return [d1, d2]; } || function () { return [d1, d2]; }; +var x280 = function named() { return [d1, d2]; } || function named() { return [d1, d2]; }; var x281 = [d1, d2] || [d1, d2]; var x282 = [d1, d2] || [d1, d2]; var x283 = [d1, d2] || [d1, d2]; var x284 = { n: [d1, d2] } || { n: [d1, d2] }; var x285 = true ? function () { return [d1, d2]; } : function () { return [d1, d2]; }; -var x286 = true ? function () { - return [d1, d2]; -} : function () { - return [d1, d2]; -}; -var x287 = true ? function named() { - return [d1, d2]; -} : function named() { - return [d1, d2]; -}; +var x286 = true ? function () { return [d1, d2]; } : function () { return [d1, d2]; }; +var x287 = true ? function named() { return [d1, d2]; } : function named() { return [d1, d2]; }; var x288 = true ? function () { return [d1, d2]; } : function () { return [d1, d2]; }; -var x289 = true ? function () { - return [d1, d2]; -} : function () { - return [d1, d2]; -}; -var x290 = true ? function named() { - return [d1, d2]; -} : function named() { - return [d1, d2]; -}; +var x289 = true ? function () { return [d1, d2]; } : function () { return [d1, d2]; }; +var x290 = true ? function named() { return [d1, d2]; } : function named() { return [d1, d2]; }; var x291 = true ? [d1, d2] : [d1, d2]; var x292 = true ? [d1, d2] : [d1, d2]; var x293 = true ? [d1, d2] : [d1, d2]; var x294 = true ? { n: [d1, d2] } : { n: [d1, d2] }; -var x295 = true ? function (n) { - var n; - return null; -} : function (n) { - var n; - return null; -}; -var x296 = true ? { func: function (n) { - return [d1, d2]; -} } : { func: function (n) { - return [d1, d2]; -} }; +var x295 = true ? function (n) { var n; return null; } : function (n) { var n; return null; }; +var x296 = true ? { func: function (n) { return [d1, d2]; } } : { func: function (n) { return [d1, d2]; } }; var x297 = true ? undefined : function () { return [d1, d2]; }; -var x298 = true ? undefined : function () { - return [d1, d2]; -}; -var x299 = true ? undefined : function named() { - return [d1, d2]; -}; +var x298 = true ? undefined : function () { return [d1, d2]; }; +var x299 = true ? undefined : function named() { return [d1, d2]; }; var x300 = true ? undefined : function () { return [d1, d2]; }; -var x301 = true ? undefined : function () { - return [d1, d2]; -}; -var x302 = true ? undefined : function named() { - return [d1, d2]; -}; +var x301 = true ? undefined : function () { return [d1, d2]; }; +var x302 = true ? undefined : function named() { return [d1, d2]; }; var x303 = true ? undefined : [d1, d2]; var x304 = true ? undefined : [d1, d2]; var x305 = true ? undefined : [d1, d2]; var x306 = true ? undefined : { n: [d1, d2] }; -var x307 = true ? undefined : function (n) { - var n; - return null; -}; -var x308 = true ? undefined : { func: function (n) { - return [d1, d2]; -} }; +var x307 = true ? undefined : function (n) { var n; return null; }; +var x308 = true ? undefined : { func: function (n) { return [d1, d2]; } }; var x309 = true ? function () { return [d1, d2]; } : undefined; -var x310 = true ? function () { - return [d1, d2]; -} : undefined; -var x311 = true ? function named() { - return [d1, d2]; -} : undefined; +var x310 = true ? function () { return [d1, d2]; } : undefined; +var x311 = true ? function named() { return [d1, d2]; } : undefined; var x312 = true ? function () { return [d1, d2]; } : undefined; -var x313 = true ? function () { - return [d1, d2]; -} : undefined; -var x314 = true ? function named() { - return [d1, d2]; -} : undefined; +var x313 = true ? function () { return [d1, d2]; } : undefined; +var x314 = true ? function named() { return [d1, d2]; } : undefined; var x315 = true ? [d1, d2] : undefined; var x316 = true ? [d1, d2] : undefined; var x317 = true ? [d1, d2] : undefined; var x318 = true ? { n: [d1, d2] } : undefined; -var x319 = true ? function (n) { - var n; - return null; -} : undefined; -var x320 = true ? { func: function (n) { - return [d1, d2]; -} } : undefined; +var x319 = true ? function (n) { var n; return null; } : undefined; +var x320 = true ? { func: function (n) { return [d1, d2]; } } : undefined; function x321(n) { } ; x321(function () { return [d1, d2]; }); function x322(n) { } ; -x322(function () { - return [d1, d2]; -}); +x322(function () { return [d1, d2]; }); function x323(n) { } ; -x323(function named() { - return [d1, d2]; -}); +x323(function named() { return [d1, d2]; }); function x324(n) { } ; x324(function () { return [d1, d2]; }); function x325(n) { } ; -x325(function () { - return [d1, d2]; -}); +x325(function () { return [d1, d2]; }); function x326(n) { } ; -x326(function named() { - return [d1, d2]; -}); +x326(function named() { return [d1, d2]; }); function x327(n) { } ; x327([d1, d2]); @@ -1845,35 +1374,22 @@ function x330(n) { } x330({ n: [d1, d2] }); function x331(n) { } ; -x331(function (n) { - var n; - return null; -}); +x331(function (n) { var n; return null; }); function x332(n) { } ; -x332({ func: function (n) { - return [d1, d2]; -} }); +x332({ func: function (n) { return [d1, d2]; } }); var x333 = function (n) { return n; }; x333(function () { return [d1, d2]; }); var x334 = function (n) { return n; }; -x334(function () { - return [d1, d2]; -}); +x334(function () { return [d1, d2]; }); var x335 = function (n) { return n; }; -x335(function named() { - return [d1, d2]; -}); +x335(function named() { return [d1, d2]; }); var x336 = function (n) { return n; }; x336(function () { return [d1, d2]; }); var x337 = function (n) { return n; }; -x337(function () { - return [d1, d2]; -}); +x337(function () { return [d1, d2]; }); var x338 = function (n) { return n; }; -x338(function named() { - return [d1, d2]; -}); +x338(function named() { return [d1, d2]; }); var x339 = function (n) { return n; }; x339([d1, d2]); var x340 = function (n) { return n; }; @@ -1883,34 +1399,21 @@ x341([d1, d2]); var x342 = function (n) { return n; }; x342({ n: [d1, d2] }); var x343 = function (n) { return n; }; -x343(function (n) { - var n; - return null; -}); +x343(function (n) { var n; return null; }); var x344 = function (n) { return n; }; -x344({ func: function (n) { - return [d1, d2]; -} }); +x344({ func: function (n) { return [d1, d2]; } }); var x345 = function (n) { }; x345(function () { return [d1, d2]; }); var x346 = function (n) { }; -x346(function () { - return [d1, d2]; -}); +x346(function () { return [d1, d2]; }); var x347 = function (n) { }; -x347(function named() { - return [d1, d2]; -}); +x347(function named() { return [d1, d2]; }); var x348 = function (n) { }; x348(function () { return [d1, d2]; }); var x349 = function (n) { }; -x349(function () { - return [d1, d2]; -}); +x349(function () { return [d1, d2]; }); var x350 = function (n) { }; -x350(function named() { - return [d1, d2]; -}); +x350(function named() { return [d1, d2]; }); var x351 = function (n) { }; x351([d1, d2]); var x352 = function (n) { }; @@ -1920,11 +1423,6 @@ x353([d1, d2]); var x354 = function (n) { }; x354({ n: [d1, d2] }); var x355 = function (n) { }; -x355(function (n) { - var n; - return null; -}); +x355(function (n) { var n; return null; }); var x356 = function (n) { }; -x356({ func: function (n) { - return [d1, d2]; -} }); +x356({ func: function (n) { return [d1, d2]; } }); diff --git a/tests/baselines/reference/genericAndNonGenericInheritedSignature1.errors.txt b/tests/baselines/reference/genericAndNonGenericInheritedSignature1.errors.txt index 63ff9d9313e..7180dc7c25b 100644 --- a/tests/baselines/reference/genericAndNonGenericInheritedSignature1.errors.txt +++ b/tests/baselines/reference/genericAndNonGenericInheritedSignature1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/genericAndNonGenericInheritedSignature1.ts(7,11): error TS2320: Interface 'Hello' cannot simultaneously extend types 'Foo' and 'Bar'. - Named properties 'f' of types 'Foo' and 'Bar' are not identical. + Named property 'f' of types 'Foo' and 'Bar' are not identical. ==== tests/cases/compiler/genericAndNonGenericInheritedSignature1.ts (1 errors) ==== @@ -12,6 +12,6 @@ tests/cases/compiler/genericAndNonGenericInheritedSignature1.ts(7,11): error TS2 interface Hello extends Foo, Bar { ~~~~~ !!! error TS2320: Interface 'Hello' cannot simultaneously extend types 'Foo' and 'Bar'. -!!! error TS2320: Named properties 'f' of types 'Foo' and 'Bar' are not identical. +!!! error TS2320: Named property 'f' of types 'Foo' and 'Bar' are not identical. } \ No newline at end of file diff --git a/tests/baselines/reference/genericAndNonGenericInheritedSignature2.errors.txt b/tests/baselines/reference/genericAndNonGenericInheritedSignature2.errors.txt index 05fdd68319e..158fd447923 100644 --- a/tests/baselines/reference/genericAndNonGenericInheritedSignature2.errors.txt +++ b/tests/baselines/reference/genericAndNonGenericInheritedSignature2.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/genericAndNonGenericInheritedSignature2.ts(7,11): error TS2320: Interface 'Hello' cannot simultaneously extend types 'Bar' and 'Foo'. - Named properties 'f' of types 'Bar' and 'Foo' are not identical. + Named property 'f' of types 'Bar' and 'Foo' are not identical. ==== tests/cases/compiler/genericAndNonGenericInheritedSignature2.ts (1 errors) ==== @@ -12,6 +12,6 @@ tests/cases/compiler/genericAndNonGenericInheritedSignature2.ts(7,11): error TS2 interface Hello extends Bar, Foo { ~~~~~ !!! error TS2320: Interface 'Hello' cannot simultaneously extend types 'Bar' and 'Foo'. -!!! error TS2320: Named properties 'f' of types 'Bar' and 'Foo' are not identical. +!!! error TS2320: Named property 'f' of types 'Bar' and 'Foo' are not identical. } \ No newline at end of file diff --git a/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.js b/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.js index 7abeeda445a..70f70ae07ba 100644 --- a/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.js +++ b/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.js @@ -23,9 +23,7 @@ var a4: I = >z; var A = (function () { function A() { } - A.prototype.compareTo = function (other) { - return 1; - }; + A.prototype.compareTo = function (other) { return 1; }; return A; })(); var z = { x: new A() }; diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments.js b/tests/baselines/reference/genericCallWithFunctionTypedArguments.js index fed1d4ca990..30d4ed353ff 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments.js +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments.js @@ -48,25 +48,19 @@ var r3 = foo(function (x) { return ''; }); // {} function foo2(x, cb) { return cb(x); } -var r4 = foo2(1, function (a) { - return ''; -}); // string, contextual signature instantiation is applied to generic functions +var r4 = foo2(1, function (a) { return ''; }); // string, contextual signature instantiation is applied to generic functions var r5 = foo2(1, function (a) { return ''; }); // string var r6 = foo2('', function (a) { return 1; }); function foo3(x, cb, y) { return cb(x); } var r7 = foo3(1, function (a) { return ''; }, ''); // string -var r8 = foo3(1, function (a) { - return ''; -}, 1); // error +var r8 = foo3(1, function (a) { return ''; }, 1); // error var r9 = foo3(1, function (a) { return ''; }, ''); // string function other(t, u) { var r10 = foo2(1, function (x) { return ''; }); // error var r10 = foo2(1, function (x) { return ''; }); // string var r11 = foo3(1, function (x) { return ''; }, ''); // error var r11b = foo3(1, function (x) { return ''; }, 1); // error - var r12 = foo3(1, function (a) { - return ''; - }, 1); // error + var r12 = foo3(1, function (a) { return ''; }, 1); // error } diff --git a/tests/baselines/reference/genericCallWithObjectLiteralArguments1.js b/tests/baselines/reference/genericCallWithObjectLiteralArguments1.js index c289ce3de14..f140caaac61 100644 --- a/tests/baselines/reference/genericCallWithObjectLiteralArguments1.js +++ b/tests/baselines/reference/genericCallWithObjectLiteralArguments1.js @@ -8,9 +8,7 @@ var x4 = foo({ x: "", y: 4 }, ""); var x5 = foo({ x: "", y: 4 }, ""); //// [genericCallWithObjectLiteralArguments1.js] -function foo(n, m) { - return m; -} +function foo(n, m) { return m; } // these are all errors var x = foo({ x: 3, y: "" }, 4); var x2 = foo({ x: 3, y: "" }, 4); diff --git a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.js b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.js index 25001bd86bb..b4f96f67942 100644 --- a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.js +++ b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.js @@ -46,10 +46,7 @@ var NonGenericParameter; function foo4(cb) { return cb; } - var r3 = foo4(function (x) { - var r; - return r; - }); // ok + var r3 = foo4(function (x) { var r; return r; }); // ok })(NonGenericParameter || (NonGenericParameter = {})); var GenericParameter; (function (GenericParameter) { diff --git a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js index 5aa2c716986..4f26e35d1b0 100644 --- a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js +++ b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js @@ -92,9 +92,7 @@ var Portal; function Validator(message) { } Validator.prototype.destroy = function () { }; - Validator.prototype._validate = function (value) { - return 0; - }; + Validator.prototype._validate = function (value) { return 0; }; return Validator; })(); Validators.Validator = Validator; diff --git a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.js b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.js index 7ec25949534..5156c4d6b12 100644 --- a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.js +++ b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.js @@ -104,9 +104,7 @@ var WithCandidates; return C; })(); var c; - var r4 = c.foo2(1, function (a) { - return ''; - }); // string, contextual signature instantiation is applied to generic functions + var r4 = c.foo2(1, function (a) { return ''; }); // string, contextual signature instantiation is applied to generic functions var r5 = c.foo2(1, function (a) { return ''; }); // string var r6 = c.foo2('', function (a) { return 1; }); // number var C2 = (function () { @@ -119,9 +117,7 @@ var WithCandidates; })(); var c2; var r7 = c2.foo3(1, function (a) { return ''; }, ''); // string - var r8 = c2.foo3(1, function (a) { - return ''; - }, ''); // string + var r8 = c2.foo3(1, function (a) { return ''; }, ''); // string var C3 = (function () { function C3() { } @@ -136,8 +132,6 @@ var WithCandidates; var r10 = c.foo2(1, function (x) { return ''; }); // string var r11 = c3.foo3(1, function (x) { return ''; }, ''); // error var r11b = c3.foo3(1, function (x) { return ''; }, 1); // error - var r12 = c3.foo3(1, function (a) { - return ''; - }, 1); // error + var r12 = c3.foo3(1, function (a) { return ''; }, 1); // error } })(WithCandidates || (WithCandidates = {})); diff --git a/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.js b/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.js index 2fd410756b6..4caeacd19e2 100644 --- a/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.js +++ b/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.js @@ -28,8 +28,6 @@ var Foo = (function () { Foo.a = function (n) { }; Foo.c = []; Foo.d = false || (function (x) { return x || undefined; })(null); - Foo.e = function (x) { - return null; - }; + Foo.e = function (x) { return null; }; return Foo; })(); diff --git a/tests/baselines/reference/genericCombinators2.js b/tests/baselines/reference/genericCombinators2.js index af11f056197..a23f163a906 100644 --- a/tests/baselines/reference/genericCombinators2.js +++ b/tests/baselines/reference/genericCombinators2.js @@ -19,10 +19,6 @@ var r5b = _.map(c2, rf1); //// [genericCombinators2.js] var _; var c2; -var rf1 = function (x, y) { - return x.toFixed(); -}; -var r5a = _.map(c2, function (x, y) { - return x.toFixed(); -}); +var rf1 = function (x, y) { return x.toFixed(); }; +var r5a = _.map(c2, function (x, y) { return x.toFixed(); }); var r5b = _.map(c2, rf1); diff --git a/tests/baselines/reference/genericConstraintDeclaration.js b/tests/baselines/reference/genericConstraintDeclaration.js index cdf93d676d0..6e3f8d5ff8b 100644 --- a/tests/baselines/reference/genericConstraintDeclaration.js +++ b/tests/baselines/reference/genericConstraintDeclaration.js @@ -12,9 +12,7 @@ class List{ var List = (function () { function List() { } - List.empty = function () { - return null; - }; + List.empty = function () { return null; }; return List; })(); diff --git a/tests/baselines/reference/genericFunctions0.js b/tests/baselines/reference/genericFunctions0.js index 408abdb9ce0..b52f0583524 100644 --- a/tests/baselines/reference/genericFunctions0.js +++ b/tests/baselines/reference/genericFunctions0.js @@ -4,9 +4,7 @@ function foo (x: T) { return x; } var x = foo(5); // 'x' should be number //// [genericFunctions0.js] -function foo(x) { - return x; -} +function foo(x) { return x; } var x = foo(5); // 'x' should be number diff --git a/tests/baselines/reference/genericFunctions1.js b/tests/baselines/reference/genericFunctions1.js index 25cc91820b8..d9bb3413890 100644 --- a/tests/baselines/reference/genericFunctions1.js +++ b/tests/baselines/reference/genericFunctions1.js @@ -4,9 +4,7 @@ function foo (x: T) { return x; } var x = foo(5); // 'x' should be number //// [genericFunctions1.js] -function foo(x) { - return x; -} +function foo(x) { return x; } var x = foo(5); // 'x' should be number diff --git a/tests/baselines/reference/genericFunctionsWithOptionalParameters3.js b/tests/baselines/reference/genericFunctionsWithOptionalParameters3.js index d2e1a5ecc37..9ad885a899a 100644 --- a/tests/baselines/reference/genericFunctionsWithOptionalParameters3.js +++ b/tests/baselines/reference/genericFunctionsWithOptionalParameters3.js @@ -24,20 +24,8 @@ var Collection = (function () { })(); var utils; var c = new Collection(); -var r3 = utils.mapReduce(c, function (x) { - return 1; -}, function (y) { - return new Date(); -}); -var r4 = utils.mapReduce(c, function (x) { - return 1; -}, function (y) { - return new Date(); -}); -var f1 = function (x) { - return 1; -}; -var f2 = function (y) { - return new Date(); -}; +var r3 = utils.mapReduce(c, function (x) { return 1; }, function (y) { return new Date(); }); +var r4 = utils.mapReduce(c, function (x) { return 1; }, function (y) { return new Date(); }); +var f1 = function (x) { return 1; }; +var f2 = function (y) { return new Date(); }; var r5 = utils.mapReduce(c, f1, f2); diff --git a/tests/baselines/reference/genericFunduleInModule.js b/tests/baselines/reference/genericFunduleInModule.js index 5a85a46a395..95700edecab 100644 --- a/tests/baselines/reference/genericFunduleInModule.js +++ b/tests/baselines/reference/genericFunduleInModule.js @@ -12,9 +12,7 @@ A.B(1); //// [genericFunduleInModule.js] var A; (function (A) { - function B(x) { - return x; - } + function B(x) { return x; } A.B = B; var B; (function (B) { diff --git a/tests/baselines/reference/genericFunduleInModule2.js b/tests/baselines/reference/genericFunduleInModule2.js index 6b5a0a74e23..956e9129ec7 100644 --- a/tests/baselines/reference/genericFunduleInModule2.js +++ b/tests/baselines/reference/genericFunduleInModule2.js @@ -15,9 +15,7 @@ A.B(1); //// [genericFunduleInModule2.js] var A; (function (A) { - function B(x) { - return x; - } + function B(x) { return x; } A.B = B; })(A || (A = {})); var A; diff --git a/tests/baselines/reference/genericImplements.js b/tests/baselines/reference/genericImplements.js index 17d3d2c0d20..b8d295153a4 100644 --- a/tests/baselines/reference/genericImplements.js +++ b/tests/baselines/reference/genericImplements.js @@ -37,26 +37,20 @@ var B = (function () { var X = (function () { function X() { } - X.prototype.f = function () { - return undefined; - }; + X.prototype.f = function () { return undefined; }; return X; })(); // { f: () => { b; } } // OK var Y = (function () { function Y() { } - Y.prototype.f = function () { - return undefined; - }; + Y.prototype.f = function () { return undefined; }; return Y; })(); // { f: () => { a; } } // OK var Z = (function () { function Z() { } - Z.prototype.f = function () { - return undefined; - }; + Z.prototype.f = function () { return undefined; }; return Z; })(); // { f: () => T } diff --git a/tests/baselines/reference/genericLambaArgWithoutTypeArguments.js b/tests/baselines/reference/genericLambaArgWithoutTypeArguments.js index f57f6713c9f..e1cc5cadbd5 100644 --- a/tests/baselines/reference/genericLambaArgWithoutTypeArguments.js +++ b/tests/baselines/reference/genericLambaArgWithoutTypeArguments.js @@ -12,6 +12,4 @@ foo((arg: Foo) => { return arg.x; }); function foo(a) { return null; } -foo(function (arg) { - return arg.x; -}); +foo(function (arg) { return arg.x; }); diff --git a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js index 5d4ecdc0838..9b0fbf4bcad 100644 --- a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js +++ b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js @@ -7,9 +7,7 @@ module foo { //// [genericMergedDeclarationUsingTypeParameter.js] -function foo(y, z) { - return y; -} +function foo(y, z) { return y; } var foo; (function (foo) { foo.x; diff --git a/tests/baselines/reference/genericObjectLitReturnType.js b/tests/baselines/reference/genericObjectLitReturnType.js index 5191f17796b..826f5233b55 100644 --- a/tests/baselines/reference/genericObjectLitReturnType.js +++ b/tests/baselines/reference/genericObjectLitReturnType.js @@ -15,9 +15,7 @@ t1.a = 5; // Should not error: t1 should have type {a: number}, instead has type var X = (function () { function X() { } - X.prototype.f = function (t) { - return { a: t }; - }; + X.prototype.f = function (t) { return { a: t }; }; return X; })(); var x; diff --git a/tests/baselines/reference/genericOfACloduleType1.js b/tests/baselines/reference/genericOfACloduleType1.js index 85629db765b..1f115aa486a 100644 --- a/tests/baselines/reference/genericOfACloduleType1.js +++ b/tests/baselines/reference/genericOfACloduleType1.js @@ -16,9 +16,7 @@ var g2 = new G() // was: error Type reference cannot refer to container 'M. var G = (function () { function G() { } - G.prototype.bar = function (x) { - return x; - }; + G.prototype.bar = function (x) { return x; }; return G; })(); var M; diff --git a/tests/baselines/reference/genericOfACloduleType2.js b/tests/baselines/reference/genericOfACloduleType2.js index 0b10451bf2c..1d671289cb2 100644 --- a/tests/baselines/reference/genericOfACloduleType2.js +++ b/tests/baselines/reference/genericOfACloduleType2.js @@ -19,9 +19,7 @@ module N { var G = (function () { function G() { } - G.prototype.bar = function (x) { - return x; - }; + G.prototype.bar = function (x) { return x; }; return G; })(); var M; diff --git a/tests/baselines/reference/genericParameterAssignability1.js b/tests/baselines/reference/genericParameterAssignability1.js index 844c8f9a988..a6a465b4089 100644 --- a/tests/baselines/reference/genericParameterAssignability1.js +++ b/tests/baselines/reference/genericParameterAssignability1.js @@ -4,8 +4,6 @@ var r = (x: T) => x; r = f; // should be allowed //// [genericParameterAssignability1.js] -function f(x) { - return null; -} +function f(x) { return null; } var r = function (x) { return x; }; r = f; // should be allowed diff --git a/tests/baselines/reference/genericPrototypeProperty.js b/tests/baselines/reference/genericPrototypeProperty.js index c38cdb753a7..fb6f9b78848 100644 --- a/tests/baselines/reference/genericPrototypeProperty.js +++ b/tests/baselines/reference/genericPrototypeProperty.js @@ -13,9 +13,7 @@ var r3 = r.foo(null); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var r = C.prototype; diff --git a/tests/baselines/reference/genericReturnTypeFromGetter1.js b/tests/baselines/reference/genericReturnTypeFromGetter1.js index 208b12308e1..741c7218345 100644 --- a/tests/baselines/reference/genericReturnTypeFromGetter1.js +++ b/tests/baselines/reference/genericReturnTypeFromGetter1.js @@ -14,9 +14,7 @@ define(["require", "exports"], function (require, exports) { function DbSet() { } Object.defineProperty(DbSet.prototype, "entityType", { - get: function () { - return this._entityType; - } // used to ICE without return type annotation + get: function () { return this._entityType; } // used to ICE without return type annotation , enumerable: true, configurable: true diff --git a/tests/baselines/reference/genericReversingTypeParameters.js b/tests/baselines/reference/genericReversingTypeParameters.js index 0e51b0256ea..2a52c2e9ba6 100644 --- a/tests/baselines/reference/genericReversingTypeParameters.js +++ b/tests/baselines/reference/genericReversingTypeParameters.js @@ -14,12 +14,8 @@ var r2b = i.get(1); var BiMap = (function () { function BiMap() { } - BiMap.prototype.get = function (key) { - return null; - }; - BiMap.prototype.inverse = function () { - return null; - }; + BiMap.prototype.get = function (key) { return null; }; + BiMap.prototype.inverse = function () { return null; }; return BiMap; })(); var b = new BiMap(); diff --git a/tests/baselines/reference/genericReversingTypeParameters2.js b/tests/baselines/reference/genericReversingTypeParameters2.js index eb904f4a2ed..4f4bc564f89 100644 --- a/tests/baselines/reference/genericReversingTypeParameters2.js +++ b/tests/baselines/reference/genericReversingTypeParameters2.js @@ -13,12 +13,8 @@ var r2b = i.get(1); var BiMap = (function () { function BiMap() { } - BiMap.prototype.get = function (key) { - return null; - }; - BiMap.prototype.inverse = function () { - return null; - }; + BiMap.prototype.get = function (key) { return null; }; + BiMap.prototype.inverse = function () { return null; }; return BiMap; })(); var b = new BiMap(); diff --git a/tests/baselines/reference/genericSpecializations1.js b/tests/baselines/reference/genericSpecializations1.js index 3df2c5581b9..3e59fceff97 100644 --- a/tests/baselines/reference/genericSpecializations1.js +++ b/tests/baselines/reference/genericSpecializations1.js @@ -19,24 +19,18 @@ class StringFoo3 implements IFoo { var IntFooBad = (function () { function IntFooBad() { } - IntFooBad.prototype.foo = function (x) { - return null; - }; + IntFooBad.prototype.foo = function (x) { return null; }; return IntFooBad; })(); var StringFoo2 = (function () { function StringFoo2() { } - StringFoo2.prototype.foo = function (x) { - return null; - }; + StringFoo2.prototype.foo = function (x) { return null; }; return StringFoo2; })(); var StringFoo3 = (function () { function StringFoo3() { } - StringFoo3.prototype.foo = function (x) { - return null; - }; + StringFoo3.prototype.foo = function (x) { return null; }; return StringFoo3; })(); diff --git a/tests/baselines/reference/genericSpecializations2.js b/tests/baselines/reference/genericSpecializations2.js index 666ea43eeba..8497d2db8b4 100644 --- a/tests/baselines/reference/genericSpecializations2.js +++ b/tests/baselines/reference/genericSpecializations2.js @@ -31,24 +31,18 @@ var IFoo = (function () { var IntFooBad = (function () { function IntFooBad() { } - IntFooBad.prototype.foo = function (x) { - return null; - }; + IntFooBad.prototype.foo = function (x) { return null; }; return IntFooBad; })(); var StringFoo2 = (function () { function StringFoo2() { } - StringFoo2.prototype.foo = function (x) { - return null; - }; + StringFoo2.prototype.foo = function (x) { return null; }; return StringFoo2; })(); var StringFoo3 = (function () { function StringFoo3() { } - StringFoo3.prototype.foo = function (x) { - return null; - }; + StringFoo3.prototype.foo = function (x) { return null; }; return StringFoo3; })(); diff --git a/tests/baselines/reference/genericSpecializations3.js b/tests/baselines/reference/genericSpecializations3.js index 8d157761160..3c582ae31fd 100644 --- a/tests/baselines/reference/genericSpecializations3.js +++ b/tests/baselines/reference/genericSpecializations3.js @@ -41,27 +41,21 @@ iFoo.foo(1); var IntFooBad = (function () { function IntFooBad() { } - IntFooBad.prototype.foo = function (x) { - return null; - }; + IntFooBad.prototype.foo = function (x) { return null; }; return IntFooBad; })(); var intFooBad; var IntFoo = (function () { function IntFoo() { } - IntFoo.prototype.foo = function (x) { - return null; - }; + IntFoo.prototype.foo = function (x) { return null; }; return IntFoo; })(); var intFoo; var StringFoo2 = (function () { function StringFoo2() { } - StringFoo2.prototype.foo = function (x) { - return null; - }; + StringFoo2.prototype.foo = function (x) { return null; }; return StringFoo2; })(); var stringFoo2; @@ -71,9 +65,7 @@ stringFoo2 = intFoo; // error var StringFoo3 = (function () { function StringFoo3() { } - StringFoo3.prototype.foo = function (x) { - return null; - }; + StringFoo3.prototype.foo = function (x) { return null; }; return StringFoo3; })(); var stringFoo3; diff --git a/tests/baselines/reference/genericStaticAnyTypeFunction.js b/tests/baselines/reference/genericStaticAnyTypeFunction.js index 055e6b4f683..6816afec910 100644 --- a/tests/baselines/reference/genericStaticAnyTypeFunction.js +++ b/tests/baselines/reference/genericStaticAnyTypeFunction.js @@ -25,9 +25,7 @@ var A = (function () { A.one = function (source, value) { return source; }; - A.goo = function () { - return 0; - }; + A.goo = function () { return 0; }; A.two = function (source) { return this.one(source, 42); // should not error }; diff --git a/tests/baselines/reference/genericTypeAssertions3.js b/tests/baselines/reference/genericTypeAssertions3.js index 19a477c142c..b67a277654f 100644 --- a/tests/baselines/reference/genericTypeAssertions3.js +++ b/tests/baselines/reference/genericTypeAssertions3.js @@ -4,9 +4,5 @@ var s = < (x: T) => T > ((x: any) => { return null; }); // no error //// [genericTypeAssertions3.js] -var r = (function (x) { - return null; -}); // bug was 'could not find dotted symbol T' on x's annotation in the type assertion instead of no error -var s = (function (x) { - return null; -}); // no error +var r = (function (x) { return null; }); // bug was 'could not find dotted symbol T' on x's annotation in the type assertion instead of no error +var s = (function (x) { return null; }); // no error diff --git a/tests/baselines/reference/genericTypeAssertions4.js b/tests/baselines/reference/genericTypeAssertions4.js index d04b6cbe104..a607fb07428 100644 --- a/tests/baselines/reference/genericTypeAssertions4.js +++ b/tests/baselines/reference/genericTypeAssertions4.js @@ -35,9 +35,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ""; - }; + A.prototype.foo = function () { return ""; }; return A; })(); var B = (function (_super) { @@ -45,9 +43,7 @@ var B = (function (_super) { function B() { _super.apply(this, arguments); } - B.prototype.bar = function () { - return 1; - }; + B.prototype.bar = function () { return 1; }; return B; })(A); var C = (function (_super) { @@ -55,9 +51,7 @@ var C = (function (_super) { function C() { _super.apply(this, arguments); } - C.prototype.baz = function () { - return 1; - }; + C.prototype.baz = function () { return 1; }; return C; })(A); var a; diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js index 1b41116732a..4be1cce27a9 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js @@ -55,18 +55,9 @@ var c; var a; var b; var d; -var e = function (x) { - var y; - return y; -}; -function f(x) { - var y; - return y; -} -var g = function f(x) { - var y; - return y; -}; +var e = function (x) { var y; return y; }; +function f(x) { var y; return y; } +var g = function f(x) { var y; return y; }; var D = (function (_super) { __extends(D, _super); function D() { diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js index f96e25301be..803d499705a 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js @@ -50,18 +50,9 @@ var c; var a; var b; var d; -var e = function (x) { - var y; - return y; -}; -function f(x) { - var y; - return y; -} -var g = function f(x) { - var y; - return y; -}; +var e = function (x) { var y; return y; }; +function f(x) { var y; return y; } +var g = function f(x) { var y; return y; }; var D = (function (_super) { __extends(D, _super); function D() { diff --git a/tests/baselines/reference/genericTypeReferencesRequireTypeArgs.js b/tests/baselines/reference/genericTypeReferencesRequireTypeArgs.js index 69bc1c372b3..90ad9e1ff93 100644 --- a/tests/baselines/reference/genericTypeReferencesRequireTypeArgs.js +++ b/tests/baselines/reference/genericTypeReferencesRequireTypeArgs.js @@ -15,9 +15,7 @@ var i2: I; // should be an error var C = (function () { function C() { } - C.prototype.foo = function () { - return null; - }; + C.prototype.foo = function () { return null; }; return C; })(); var c1; // error diff --git a/tests/baselines/reference/genericWithOpenTypeParameters1.js b/tests/baselines/reference/genericWithOpenTypeParameters1.js index afdce73cb11..90202767012 100644 --- a/tests/baselines/reference/genericWithOpenTypeParameters1.js +++ b/tests/baselines/reference/genericWithOpenTypeParameters1.js @@ -15,22 +15,12 @@ var f4 = (x: B) => { return x.foo(1); } // no error var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var x; x.foo(1); // no error -var f = function (x) { - return x.foo(1); -}; // error -var f2 = function (x) { - return x.foo(1); -}; // error -var f3 = function (x) { - return x.foo(1); -}; // error -var f4 = function (x) { - return x.foo(1); -}; // no error +var f = function (x) { return x.foo(1); }; // error +var f2 = function (x) { return x.foo(1); }; // error +var f3 = function (x) { return x.foo(1); }; // error +var f4 = function (x) { return x.foo(1); }; // no error diff --git a/tests/baselines/reference/genericsAndHigherOrderFunctions.js b/tests/baselines/reference/genericsAndHigherOrderFunctions.js index 1086bd78c54..f2e6ef58f22 100644 --- a/tests/baselines/reference/genericsAndHigherOrderFunctions.js +++ b/tests/baselines/reference/genericsAndHigherOrderFunctions.js @@ -19,5 +19,13 @@ var foo: (g: (x: K) => N) => //// [genericsAndHigherOrderFunctions.js] // no errors expected -var combine = function (f) { return function (g) { return function (x) { return f(g(x)); }; }; }; -var foo = function (g) { return function (h) { return function (f) { return h(combine(f)(g)); }; }; }; +var combine = function (f) { + return function (g) { + return function (x) { return f(g(x)); }; + }; +}; +var foo = function (g) { + return function (h) { + return function (f) { return h(combine(f)(g)); }; + }; +}; diff --git a/tests/baselines/reference/genericsManyTypeParameters.js b/tests/baselines/reference/genericsManyTypeParameters.js index 19a5117cb6b..491f0c41168 100644 --- a/tests/baselines/reference/genericsManyTypeParameters.js +++ b/tests/baselines/reference/genericsManyTypeParameters.js @@ -61,5 +61,22 @@ function Foo< //// [genericsManyTypeParameters.js] function Foo(x1, y1, z1, a1, b1, c1, x2, y2, z2, a2, b2, c2, x3, y3, z3, a3, b3, c3, x4, y4, z4, a4, b4, c4, x5, y5, z5, a5, b5, c5, x6, y6, z6, a6, b6, c6, x7, y7, z7, a7, b7, c7, x8, y8, z8, a8, b8, c8, x9, y9, z9, a9, b9, c9, x10, y12, z10, a10, b10, c10, x11, y13, z11, a11, b11, c11, x12, y14, z12, a12, b12, c12, x13, y15, z13, a13, b13, c13, x14, y16, z14, a14, b14, c14, x15, y17, z15, a15, b15, c15, x16, y18, z16, a16, b16, c16, x17, y19, z17, a17, b17, c17, x18, y10, z18, a18, b18, c18) { - return [x1, y1, z1, a1, b1, c1, x2, y2, z2, a2, b2, c2, x3, y3, z3, a3, b3, c3, x4, y4, z4, a4, b4, c4, x5, y5, z5, a5, b5, c5, x6, y6, z6, a6, b6, c6, x7, y7, z7, a7, b7, c7, x8, y8, z8, a8, b8, c8, x9, y9, z9, a9, b9, c9, x10, y12, z10, a10, b10, c10, x11, y13, z11, a11, b11, c11, x12, y14, z12, a12, b12, c12, x13, y15, z13, a13, b13, c13, x14, y16, z14, a14, b14, c14, x15, y17, z15, a15, b15, c15, x16, y18, z16, a16, b16, c16, x17, y19, z17, a17, b17, c17, x18, y10, z18, a18, b18, c18]; + return [x1, y1, z1, a1, b1, c1, + x2, y2, z2, a2, b2, c2, + x3, y3, z3, a3, b3, c3, + x4, y4, z4, a4, b4, c4, + x5, y5, z5, a5, b5, c5, + x6, y6, z6, a6, b6, c6, + x7, y7, z7, a7, b7, c7, + x8, y8, z8, a8, b8, c8, + x9, y9, z9, a9, b9, c9, + x10, y12, z10, a10, b10, c10, + x11, y13, z11, a11, b11, c11, + x12, y14, z12, a12, b12, c12, + x13, y15, z13, a13, b13, c13, + x14, y16, z14, a14, b14, c14, + x15, y17, z15, a15, b15, c15, + x16, y18, z16, a16, b16, c16, + x17, y19, z17, a17, b17, c17, + x18, y10, z18, a18, b18, c18]; } diff --git a/tests/baselines/reference/genericsWithDuplicateTypeParameters1.js b/tests/baselines/reference/genericsWithDuplicateTypeParameters1.js index f01f01dbf21..72eeb1ab683 100644 --- a/tests/baselines/reference/genericsWithDuplicateTypeParameters1.js +++ b/tests/baselines/reference/genericsWithDuplicateTypeParameters1.js @@ -18,21 +18,15 @@ var m = { //// [genericsWithDuplicateTypeParameters1.js] function f() { } -function f2(a, b) { - return null; -} +function f2(a, b) { return null; } var C = (function () { function C() { } C.prototype.f = function () { }; - C.prototype.f2 = function (a, b) { - return null; - }; + C.prototype.f2 = function (a, b) { return null; }; return C; })(); var m = { a: function f() { }, - b: function f2(a, b) { - return null; - } + b: function f2(a, b) { return null; } }; diff --git a/tests/baselines/reference/genericsWithoutTypeParameters1.js b/tests/baselines/reference/genericsWithoutTypeParameters1.js index 8446d40cb11..41abffcb854 100644 --- a/tests/baselines/reference/genericsWithoutTypeParameters1.js +++ b/tests/baselines/reference/genericsWithoutTypeParameters1.js @@ -37,9 +37,7 @@ function f(x: T): A { var C = (function () { function C() { } - C.prototype.foo = function () { - return null; - }; + C.prototype.foo = function () { return null; }; return C; })(); var c1; @@ -49,9 +47,7 @@ var i2; function foo(x, y) { } function foo2(x, y) { } var x = { a: new C() }; -var x2 = { a: { bar: function () { - return 1; -} } }; +var x2 = { a: { bar: function () { return 1; } } }; var D = (function () { function D() { } diff --git a/tests/baselines/reference/getAndSetAsMemberNames.js b/tests/baselines/reference/getAndSetAsMemberNames.js index 41a89e6ec37..8b036cd0f73 100644 --- a/tests/baselines/reference/getAndSetAsMemberNames.js +++ b/tests/baselines/reference/getAndSetAsMemberNames.js @@ -49,13 +49,9 @@ var C4 = (function () { })(); var C5 = (function () { function C5() { - this.set = function () { - return true; - }; + this.set = function () { return true; }; } - C5.prototype.get = function () { - return true; - }; + C5.prototype.get = function () { return true; }; Object.defineProperty(C5.prototype, "t", { set: function (x) { }, enumerable: true, diff --git a/tests/baselines/reference/getsetReturnTypes.js b/tests/baselines/reference/getsetReturnTypes.js index 55d7e9285b0..27b6fc52fe5 100644 --- a/tests/baselines/reference/getsetReturnTypes.js +++ b/tests/baselines/reference/getsetReturnTypes.js @@ -10,9 +10,7 @@ var y: number = makePoint(2).x; //// [getsetReturnTypes.js] function makePoint(x) { return { - get x() { - return x; - } + get x() { return x; } }; } ; diff --git a/tests/baselines/reference/getterSetterNonAccessor.js b/tests/baselines/reference/getterSetterNonAccessor.js index e32c62c497e..c28337ff7b4 100644 --- a/tests/baselines/reference/getterSetterNonAccessor.js +++ b/tests/baselines/reference/getterSetterNonAccessor.js @@ -10,9 +10,7 @@ Object.defineProperty({}, "0", ({ //// [getterSetterNonAccessor.js] -function getFunc() { - return 0; -} +function getFunc() { return 0; } function setFunc(v) { } Object.defineProperty({}, "0", ({ get: getFunc, diff --git a/tests/baselines/reference/gettersAndSetters.js b/tests/baselines/reference/gettersAndSetters.js index 6fb9518cfdb..92f959e5988 100644 --- a/tests/baselines/reference/gettersAndSetters.js +++ b/tests/baselines/reference/gettersAndSetters.js @@ -50,25 +50,17 @@ var C = (function () { this.set = function () { }; // ok } Object.defineProperty(C.prototype, "Foo", { - get: function () { - return this.fooBack; - } // ok + get: function () { return this.fooBack; } // ok , - set: function (foo) { - this.fooBack = foo; - } // ok + set: function (foo) { this.fooBack = foo; } // ok , enumerable: true, configurable: true }); Object.defineProperty(C, "Bar", { - get: function () { - return C.barBack; - } // ok + get: function () { return C.barBack; } // ok , - set: function (bar) { - C.barBack = bar; - } // ok + set: function (bar) { C.barBack = bar; } // ok , enumerable: true, configurable: true @@ -84,13 +76,7 @@ C.Bar = "barv"; var baz = c.Baz; c.Baz = "bazv"; // The Foo accessors' return and param types should be contextually typed to the Foo field -var o = { get Foo() { - return 0; -}, set Foo(val) { - val; -} }; // o +var o = { get Foo() { return 0; }, set Foo(val) { val; } }; // o var ofg = o.Foo; o.Foo = 0; -var i = function (n) { - return n; -}; +var i = function (n) { return n; }; diff --git a/tests/baselines/reference/gettersAndSettersAccessibility.js b/tests/baselines/reference/gettersAndSettersAccessibility.js index f472fa36a98..e0cfa3d17c5 100644 --- a/tests/baselines/reference/gettersAndSettersAccessibility.js +++ b/tests/baselines/reference/gettersAndSettersAccessibility.js @@ -10,9 +10,7 @@ var C99 = (function () { function C99() { } Object.defineProperty(C99.prototype, "Baz", { - get: function () { - return 0; - }, + get: function () { return 0; }, set: function (n) { } // error - accessors do not agree in visibility , enumerable: true, diff --git a/tests/baselines/reference/gettersAndSettersErrors.js b/tests/baselines/reference/gettersAndSettersErrors.js index 545517facea..d92f0d833f5 100644 --- a/tests/baselines/reference/gettersAndSettersErrors.js +++ b/tests/baselines/reference/gettersAndSettersErrors.js @@ -22,9 +22,7 @@ var C = (function () { this.Foo = 0; // error - duplicate identifier Foo - confirmed } Object.defineProperty(C.prototype, "Foo", { - get: function () { - return "foo"; - } // ok + get: function () { return "foo"; } // ok , set: function (foo) { } // ok , @@ -32,9 +30,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, "Goo", { - get: function (v) { - return null; - } // error - getters must not have a parameter + get: function (v) { return null; } // error - getters must not have a parameter , set: function (v) { } // error - setters must not specify a return type , @@ -47,9 +43,7 @@ var E = (function () { function E() { } Object.defineProperty(E.prototype, "Baz", { - get: function () { - return 0; - }, + get: function () { return 0; }, set: function (n) { } // error - accessors do not agree in visibility , enumerable: true, diff --git a/tests/baselines/reference/gettersAndSettersTypesAgree.js b/tests/baselines/reference/gettersAndSettersTypesAgree.js index c291c457613..91d3d844981 100644 --- a/tests/baselines/reference/gettersAndSettersTypesAgree.js +++ b/tests/baselines/reference/gettersAndSettersTypesAgree.js @@ -15,9 +15,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "Foo", { - get: function () { - return "foo"; - } // ok + get: function () { return "foo"; } // ok , set: function (foo) { } // ok - type inferred from getter return statement , @@ -25,9 +23,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, "Bar", { - get: function () { - return "foo"; - } // ok + get: function () { return "foo"; } // ok , set: function (bar) { } // ok - type must be declared , @@ -36,9 +32,5 @@ var C = (function () { }); return C; })(); -var o1 = { get Foo() { - return 0; -}, set Foo(val) { } }; // ok - types agree (inference) -var o2 = { get Foo() { - return 0; -}, set Foo(val) { } }; // ok - types agree +var o1 = { get Foo() { return 0; }, set Foo(val) { } }; // ok - types agree (inference) +var o2 = { get Foo() { return 0; }, set Foo(val) { } }; // ok - types agree diff --git a/tests/baselines/reference/giant.errors.txt b/tests/baselines/reference/giant.errors.txt index e8c574d2115..1d623870d63 100644 --- a/tests/baselines/reference/giant.errors.txt +++ b/tests/baselines/reference/giant.errors.txt @@ -16,7 +16,7 @@ tests/cases/compiler/giant.ts(34,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(35,12): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(36,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(36,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(61,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(61,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(61,6): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(62,5): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(63,6): error TS1096: An index signature must have exactly one parameter. @@ -39,7 +39,7 @@ tests/cases/compiler/giant.ts(98,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(99,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(100,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(100,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(125,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(125,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(125,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(126,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(127,10): error TS1096: An index signature must have exactly one parameter. @@ -63,7 +63,7 @@ tests/cases/compiler/giant.ts(177,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(178,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(179,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(179,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(204,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(204,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(204,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(205,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(206,10): error TS1096: An index signature must have exactly one parameter. @@ -119,7 +119,7 @@ tests/cases/compiler/giant.ts(292,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(293,12): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(294,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(294,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(319,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(319,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(319,6): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(320,5): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(321,6): error TS1096: An index signature must have exactly one parameter. @@ -142,7 +142,7 @@ tests/cases/compiler/giant.ts(356,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(357,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(358,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(358,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(383,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(383,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(383,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(384,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(385,10): error TS1096: An index signature must have exactly one parameter. @@ -166,7 +166,7 @@ tests/cases/compiler/giant.ts(435,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(436,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(437,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(437,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(462,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(462,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(462,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(463,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(464,10): error TS1096: An index signature must have exactly one parameter. @@ -238,7 +238,7 @@ tests/cases/compiler/giant.ts(556,21): error TS1036: Statements are not allowed tests/cases/compiler/giant.ts(558,24): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(561,21): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(563,21): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(587,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(587,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(587,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(588,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(589,10): error TS1096: An index signature must have exactly one parameter. @@ -255,7 +255,7 @@ tests/cases/compiler/giant.ts(621,26): error TS1184: An implementation cannot be tests/cases/compiler/giant.ts(623,24): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(626,21): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(628,21): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(653,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(653,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(653,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(654,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(655,10): error TS1096: An index signature must have exactly one parameter. @@ -364,7 +364,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -474,7 +474,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -601,7 +601,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -828,7 +828,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -938,7 +938,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -1065,7 +1065,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -1334,7 +1334,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -1434,7 +1434,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; diff --git a/tests/baselines/reference/giant.js b/tests/baselines/reference/giant.js index 7f2c2453b0f..a5109b6e113 100644 --- a/tests/baselines/reference/giant.js +++ b/tests/baselines/reference/giant.js @@ -706,44 +706,38 @@ define(["require", "exports"], function (require, exports) { C.prototype.rF = function () { }; C.prototype.pgF = function () { }; Object.defineProperty(C.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.psF = function (param) { }; Object.defineProperty(C.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.prototype.rgF = function () { }; Object.defineProperty(C.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.rsF = function (param) { }; Object.defineProperty(C.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tF = function () { }; C.tsF = function (param) { }; Object.defineProperty(C, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tgF = function () { }; Object.defineProperty(C, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); @@ -761,44 +755,38 @@ define(["require", "exports"], function (require, exports) { C.prototype.rF = function () { }; C.prototype.pgF = function () { }; Object.defineProperty(C.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.psF = function (param) { }; Object.defineProperty(C.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.prototype.rgF = function () { }; Object.defineProperty(C.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.rsF = function (param) { }; Object.defineProperty(C.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tF = function () { }; C.tsF = function (param) { }; Object.defineProperty(C, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tgF = function () { }; Object.defineProperty(C, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); @@ -845,44 +833,38 @@ define(["require", "exports"], function (require, exports) { eC.prototype.rF = function () { }; eC.prototype.pgF = function () { }; Object.defineProperty(eC.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.psF = function (param) { }; Object.defineProperty(eC.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.prototype.rgF = function () { }; Object.defineProperty(eC.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.rsF = function (param) { }; Object.defineProperty(eC.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tF = function () { }; eC.tsF = function (param) { }; Object.defineProperty(eC, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tgF = function () { }; Object.defineProperty(eC, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); @@ -932,44 +914,38 @@ define(["require", "exports"], function (require, exports) { eC.prototype.rF = function () { }; eC.prototype.pgF = function () { }; Object.defineProperty(eC.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.psF = function (param) { }; Object.defineProperty(eC.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.prototype.rgF = function () { }; Object.defineProperty(eC.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.rsF = function (param) { }; Object.defineProperty(eC.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tF = function () { }; eC.tsF = function (param) { }; Object.defineProperty(eC, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tgF = function () { }; Object.defineProperty(eC, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); @@ -988,44 +964,38 @@ define(["require", "exports"], function (require, exports) { C.prototype.rF = function () { }; C.prototype.pgF = function () { }; Object.defineProperty(C.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.psF = function (param) { }; Object.defineProperty(C.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.prototype.rgF = function () { }; Object.defineProperty(C.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.rsF = function (param) { }; Object.defineProperty(C.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tF = function () { }; C.tsF = function (param) { }; Object.defineProperty(C, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tgF = function () { }; Object.defineProperty(C, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); @@ -1072,44 +1042,38 @@ define(["require", "exports"], function (require, exports) { eC.prototype.rF = function () { }; eC.prototype.pgF = function () { }; Object.defineProperty(eC.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.psF = function (param) { }; Object.defineProperty(eC.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.prototype.rgF = function () { }; Object.defineProperty(eC.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.rsF = function (param) { }; Object.defineProperty(eC.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tF = function () { }; eC.tsF = function (param) { }; Object.defineProperty(eC, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tgF = function () { }; Object.defineProperty(eC, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/grammarAmbiguities.js b/tests/baselines/reference/grammarAmbiguities.js index ee81d947ff6..f603bd1023f 100644 --- a/tests/baselines/reference/grammarAmbiguities.js +++ b/tests/baselines/reference/grammarAmbiguities.js @@ -12,12 +12,8 @@ f(g < A, B > +(7)); // Should error //// [grammarAmbiguities.js] -function f(n) { - return null; -} -function g(x) { - return null; -} +function f(n) { return null; } +function g(x) { return null; } var A, B; f(g(7)); f(g < A, B > 7); // Should error diff --git a/tests/baselines/reference/grammarAmbiguities1.js b/tests/baselines/reference/grammarAmbiguities1.js index 6ee64527bcc..1917acb7128 100644 --- a/tests/baselines/reference/grammarAmbiguities1.js +++ b/tests/baselines/reference/grammarAmbiguities1.js @@ -23,12 +23,8 @@ var B = (function () { B.prototype.bar = function () { }; return B; })(); -function f(x) { - return x; -} -function g(x) { - return f(x); -} +function f(x) { return x; } +function g(x) { return f(x); } g(7); f(g(7)); f(g < A, B > 7); diff --git a/tests/baselines/reference/ifDoWhileStatements.js b/tests/baselines/reference/ifDoWhileStatements.js index c7f6ead6b28..793094584bf 100644 --- a/tests/baselines/reference/ifDoWhileStatements.js +++ b/tests/baselines/reference/ifDoWhileStatements.js @@ -186,12 +186,8 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} -function F2(x) { - return x < 42; -} +function F(x) { return 42; } +function F2(x) { return x < 42; } var M; (function (M) { var A = (function () { @@ -200,9 +196,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); var N; @@ -213,9 +207,7 @@ var N; return A; })(); N.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } N.F2 = F2; })(N || (N = {})); // literals @@ -306,9 +298,7 @@ var k = { x: 1, y: 'a' }; if (k) { } while (k) { } do { } while (k); -function fn(x) { - return null; -} +function fn(x) { return null; } if (fn()) { } while (fn()) { } do { } while (fn()); diff --git a/tests/baselines/reference/illegalSuperCallsInConstructor.js b/tests/baselines/reference/illegalSuperCallsInConstructor.js index b978af1a609..0bdcebed9c5 100644 --- a/tests/baselines/reference/illegalSuperCallsInConstructor.js +++ b/tests/baselines/reference/illegalSuperCallsInConstructor.js @@ -36,12 +36,8 @@ var Derived = (function (_super) { __extends(Derived, _super); function Derived() { var r2 = function () { return _super.call(this); }; - var r3 = function () { - _super.call(this); - }; - var r4 = function () { - _super.call(this); - }; + var r3 = function () { _super.call(this); }; + var r4 = function () { _super.call(this); }; var r5 = { get foo() { _super.call(this); diff --git a/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.js b/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.js index df1c4d51e74..9bfad713d82 100644 --- a/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.js +++ b/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.js @@ -22,26 +22,12 @@ var lambda10 = function temp1() { return 5; } var lambda = function (l1) { }; // Error at "l1" var lambd2 = function (ll1, ll2) { }; // Error at "ll1" var lamda3 = function myLambda3(myParam) { }; -var lamda4 = function () { - return null; -}; +var lamda4 = function () { return null; }; // these should be error for implicit any return type -var lambda5 = function temp() { - return null; -}; -var lambda6 = function () { - return null; -}; -var lambda7 = function temp() { - return undefined; -}; -var lambda8 = function () { - return undefined; -}; +var lambda5 = function temp() { return null; }; +var lambda6 = function () { return null; }; +var lambda7 = function temp() { return undefined; }; +var lambda8 = function () { return undefined; }; // this shouldn't be an error -var lambda9 = function () { - return 5; -}; -var lambda10 = function temp1() { - return 5; -}; +var lambda9 = function () { return 5; }; +var lambda10 = function temp1() { return 5; }; diff --git a/tests/baselines/reference/implicitAnyFromCircularInference.js b/tests/baselines/reference/implicitAnyFromCircularInference.js index d97b8420ebf..d818ea17105 100644 --- a/tests/baselines/reference/implicitAnyFromCircularInference.js +++ b/tests/baselines/reference/implicitAnyFromCircularInference.js @@ -58,13 +58,9 @@ var b; var c; // Error expected var d; -function f() { - return f; -} +function f() { return f; } // Error expected -function g() { - return g(); -} +function g() { return g(); } // Error expected var f1 = function () { return f1(); @@ -78,9 +74,7 @@ function h() { return h() || "hello"; } } -function foo(x) { - return "abc"; -} +function foo(x) { return "abc"; } var C = (function () { function C() { // Error expected diff --git a/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.js b/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.js index 699b57603eb..82eb56fbde6 100644 --- a/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.js +++ b/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.js @@ -26,12 +26,8 @@ undefinedWidenFunction(); //// [implicitAnyFunctionReturnNullOrUndefined.js] // this should be an error -function nullWidenFunction() { - return null; -} // error at "nullWidenFunction" -function undefinedWidenFunction() { - return undefined; -} // error at "undefinedWidenFunction" +function nullWidenFunction() { return null; } // error at "nullWidenFunction" +function undefinedWidenFunction() { return undefined; } // error at "undefinedWidenFunction" var C = (function () { function C() { } @@ -44,18 +40,10 @@ var C = (function () { return C; })(); // this should not be an error -function foo1() { - return null; -} -function bar1() { - return undefined; -} -function fooBar() { - return 1; -} -function fooFoo() { - return 5; -} +function foo1() { return null; } +function bar1() { return undefined; } +function fooBar() { return 1; } +function fooFoo() { return 5; } // this should not be an error as the error is raised by expr above nullWidenFunction(); undefinedWidenFunction(); diff --git a/tests/baselines/reference/implicitAnyGenericTypeInference.js b/tests/baselines/reference/implicitAnyGenericTypeInference.js index 2679ae8285c..583ab7f0b01 100644 --- a/tests/baselines/reference/implicitAnyGenericTypeInference.js +++ b/tests/baselines/reference/implicitAnyGenericTypeInference.js @@ -10,7 +10,5 @@ var r = c.compareTo(1, ''); //// [implicitAnyGenericTypeInference.js] var c; -c = { compareTo: function (x, y) { - return y; -} }; +c = { compareTo: function (x, y) { return y; } }; var r = c.compareTo(1, ''); diff --git a/tests/baselines/reference/implicitAnyGenerics.js b/tests/baselines/reference/implicitAnyGenerics.js index a5c98590a8f..daea0dfe54c 100644 --- a/tests/baselines/reference/implicitAnyGenerics.js +++ b/tests/baselines/reference/implicitAnyGenerics.js @@ -46,9 +46,7 @@ var d2 = new D(1); var d3 = new D(1); var d4 = new D(1); var d5 = new D(null); -function foo() { - return null; -} +function foo() { return null; } ; foo(); foo(); diff --git a/tests/baselines/reference/implicitAnyNewExprLackConstructorSignature.js b/tests/baselines/reference/implicitAnyNewExprLackConstructorSignature.js index 4218d9a9a21..9e558122b15 100644 --- a/tests/baselines/reference/implicitAnyNewExprLackConstructorSignature.js +++ b/tests/baselines/reference/implicitAnyNewExprLackConstructorSignature.js @@ -3,7 +3,5 @@ function Point() { this.x = 3; } var x: any = new Point(); // error at "new" //// [implicitAnyNewExprLackConstructorSignature.js] -function Point() { - this.x = 3; -} +function Point() { this.x = 3; } var x = new Point(); // error at "new" diff --git a/tests/baselines/reference/importAsBaseClass.js b/tests/baselines/reference/importAsBaseClass.js index 9e52c4dd067..8114e88ca4b 100644 --- a/tests/baselines/reference/importAsBaseClass.js +++ b/tests/baselines/reference/importAsBaseClass.js @@ -14,9 +14,7 @@ class Hello extends Greeter { } var Greeter = (function () { function Greeter() { } - Greeter.prototype.greet = function () { - return 'greet'; - }; + Greeter.prototype.greet = function () { return 'greet'; }; return Greeter; })(); exports.Greeter = Greeter; diff --git a/tests/baselines/reference/importDecl.js b/tests/baselines/reference/importDecl.js index d6f2855908e..9d4839e5e7c 100644 --- a/tests/baselines/reference/importDecl.js +++ b/tests/baselines/reference/importDecl.js @@ -89,9 +89,7 @@ var d = (function () { })(); exports.d = d; exports.x; -function foo() { - return null; -} +function foo() { return null; } exports.foo = foo; //// [importDecl_require1.js] var d = (function () { @@ -101,9 +99,7 @@ var d = (function () { })(); exports.d = d; var x; -function foo() { - return null; -} +function foo() { return null; } exports.foo = foo; //// [importDecl_require2.js] var d = (function () { @@ -113,9 +109,7 @@ var d = (function () { })(); exports.d = d; exports.x; -function foo() { - return null; -} +function foo() { return null; } exports.foo = foo; //// [importDecl_require3.js] var d = (function () { @@ -125,14 +119,10 @@ var d = (function () { })(); exports.d = d; exports.x; -function foo() { - return null; -} +function foo() { return null; } exports.foo = foo; //// [importDecl_require4.js] -function foo2() { - return null; -} +function foo2() { return null; } exports.foo2 = foo2; //// [importDecl_1.js] /// diff --git a/tests/baselines/reference/importedModuleAddToGlobal.js b/tests/baselines/reference/importedModuleAddToGlobal.js index 6685bec69e3..dd7dfcd5fc9 100644 --- a/tests/baselines/reference/importedModuleAddToGlobal.js +++ b/tests/baselines/reference/importedModuleAddToGlobal.js @@ -28,7 +28,5 @@ var B; })(B || (B = {})); var C; (function (C) { - function hello() { - return null; - } + function hello() { return null; } })(C || (C = {})); diff --git a/tests/baselines/reference/inOperatorWithFunction.js b/tests/baselines/reference/inOperatorWithFunction.js index 8daeb5a30fb..bc293ca2c43 100644 --- a/tests/baselines/reference/inOperatorWithFunction.js +++ b/tests/baselines/reference/inOperatorWithFunction.js @@ -4,7 +4,5 @@ fn("a" in { "a": true }); //// [inOperatorWithFunction.js] -var fn = function (val) { - return val; -}; +var fn = function (val) { return val; }; fn("a" in { "a": true }); diff --git a/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt b/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt index 9df5357767f..0985157e0da 100644 --- a/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt +++ b/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(12,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(13,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(14,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(16,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(17,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(19,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(20,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(12,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(13,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(14,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(16,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(17,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(19,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(20,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(30,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(31,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(32,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter @@ -15,7 +15,7 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(37,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(38,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(39,17): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,17): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter @@ -33,27 +33,27 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv var ra1 = a1 in x; ~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra2 = a2 in x; ~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra3 = a3 in x; ~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra4 = a4 in x; var ra5 = null in x; ~~~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra6 = undefined in x; ~~~~~~~~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra7 = E.a in x; var ra8 = false in x; ~~~~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra9 = {} in x; ~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. // invalid right operands // the right operand is required to be of type Any, an object type, or a type parameter type @@ -98,6 +98,6 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv // both operands are invalid var rc1 = {} in ''; ~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. ~~ !!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter \ No newline at end of file diff --git a/tests/baselines/reference/incompatibleTypes.js b/tests/baselines/reference/incompatibleTypes.js index 2f804f2efa1..7e24afecf5f 100644 --- a/tests/baselines/reference/incompatibleTypes.js +++ b/tests/baselines/reference/incompatibleTypes.js @@ -106,9 +106,7 @@ function if1(a) { } var c1; var c2; if1(c1); -function of1(a) { - return null; -} +function of1(a) { return null; } of1({ e: 0, f: 0 }); function foo(fn) { } diff --git a/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js b/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js index 564516ead64..eb9cd949280 100644 --- a/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js +++ b/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js @@ -50,15 +50,11 @@ foo()++; // ++ operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -72,14 +68,10 @@ var ResultIsNumber2 = NUMBER1++; // number type literal var ResultIsNumber3 = ++1; var ResultIsNumber4 = ++{ x: 1, y: 2 }; -var ResultIsNumber5 = ++{ x: 1, y: function (n) { - return n; -} }; +var ResultIsNumber5 = ++{ x: 1, y: function (n) { return n; } }; var ResultIsNumber6 = 1++; var ResultIsNumber7 = { x: 1, y: 2 }++; -var ResultIsNumber8 = { x: 1, y: function (n) { - return n; -} }++; +var ResultIsNumber8 = { x: 1, y: function (n) { return n; } }++; // number type expressions var ResultIsNumber9 = ++foo(); var ResultIsNumber10 = ++A.foo(); diff --git a/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js b/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js index 6c0775b520f..6a974443f7b 100644 --- a/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js +++ b/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js @@ -57,15 +57,11 @@ objA.a++, M.n++; //// [incrementOperatorWithUnsupportedBooleanType.js] // ++ operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return true; - }; + A.foo = function () { return true; }; return A; })(); var M; @@ -79,14 +75,10 @@ var ResultIsNumber2 = BOOLEAN++; // boolean type literal var ResultIsNumber3 = ++true; var ResultIsNumber4 = ++{ x: true, y: false }; -var ResultIsNumber5 = ++{ x: true, y: function (n) { - return n; -} }; +var ResultIsNumber5 = ++{ x: true, y: function (n) { return n; } }; var ResultIsNumber6 = true++; var ResultIsNumber7 = { x: true, y: false }++; -var ResultIsNumber8 = { x: true, y: function (n) { - return n; -} }++; +var ResultIsNumber8 = { x: true, y: function (n) { return n; } }++; // boolean type expressions var ResultIsNumber9 = ++objA.a; var ResultIsNumber10 = ++M.n; diff --git a/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js b/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js index 065cf6ed5eb..82bf03cd83a 100644 --- a/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js +++ b/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js @@ -69,15 +69,11 @@ objA.a++, M.n++; // ++ operator on string type var STRING; var STRING1 = ["", ""]; -function foo() { - return ""; -} +function foo() { return ""; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -93,14 +89,10 @@ var ResultIsNumber4 = STRING1++; // string type literal var ResultIsNumber5 = ++""; var ResultIsNumber6 = ++{ x: "", y: "" }; -var ResultIsNumber7 = ++{ x: "", y: function (s) { - return s; -} }; +var ResultIsNumber7 = ++{ x: "", y: function (s) { return s; } }; var ResultIsNumber8 = ""++; var ResultIsNumber9 = { x: "", y: "" }++; -var ResultIsNumber10 = { x: "", y: function (s) { - return s; -} }++; +var ResultIsNumber10 = { x: "", y: function (s) { return s; } }++; // string type expressions var ResultIsNumber11 = ++objA.a; var ResultIsNumber12 = ++M.n; diff --git a/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt index 82e96bf3846..88e09d7746b 100644 --- a/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt +++ b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,6): error TS2304: Cannot find name 'x'. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(4,5): error TS1021: An index signature must have a type annotation. -tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,6): error TS2304: Cannot find name 'x'. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(14,5): error TS1021: An index signature must have a type annotation. @@ -11,7 +11,7 @@ tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(14,5): error TS1021 // Used to be indexer, now it is a computed property [x]: string; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'x'. [x: string]; @@ -23,7 +23,7 @@ tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(14,5): error TS1021 // Used to be indexer, now it is a computed property [x]: string ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'x'. diff --git a/tests/baselines/reference/indexSignatureWithInitializer.errors.txt b/tests/baselines/reference/indexSignatureWithInitializer.errors.txt index d6f547a25cb..4a49de69393 100644 --- a/tests/baselines/reference/indexSignatureWithInitializer.errors.txt +++ b/tests/baselines/reference/indexSignatureWithInitializer.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/indexSignatureWithInitializer.ts(3,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/indexSignatureWithInitializer.ts(3,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/indexSignatureWithInitializer.ts(3,6): error TS2304: Cannot find name 'x'. -tests/cases/compiler/indexSignatureWithInitializer.ts(7,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/compiler/indexSignatureWithInitializer.ts(7,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/compiler/indexSignatureWithInitializer.ts(7,6): error TS2304: Cannot find name 'x'. @@ -9,7 +9,7 @@ tests/cases/compiler/indexSignatureWithInitializer.ts(7,6): error TS2304: Cannot interface I { [x = '']: string; ~~~~~~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'x'. } @@ -17,7 +17,7 @@ tests/cases/compiler/indexSignatureWithInitializer.ts(7,6): error TS2304: Cannot class C { [x = 0]: string ~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'x'. } \ No newline at end of file diff --git a/tests/baselines/reference/indexSignaturesInferentialTyping.js b/tests/baselines/reference/indexSignaturesInferentialTyping.js index d8200338b62..53636be716c 100644 --- a/tests/baselines/reference/indexSignaturesInferentialTyping.js +++ b/tests/baselines/reference/indexSignaturesInferentialTyping.js @@ -9,12 +9,8 @@ var x4 = bar({ zero: 0, one: 1 }); // type should be number //// [indexSignaturesInferentialTyping.js] -function foo(items) { - return undefined; -} -function bar(items) { - return undefined; -} +function foo(items) { return undefined; } +function bar(items) { return undefined; } var x1 = foo({ 0: 0, 1: 1 }); // type should be number var x2 = foo({ zero: 0, one: 1 }); var x3 = bar({ 0: 0, 1: 1 }); diff --git a/tests/baselines/reference/indexTypeCheck.errors.txt b/tests/baselines/reference/indexTypeCheck.errors.txt index 03d0e2ce8ed..9f4b403ca2e 100644 --- a/tests/baselines/reference/indexTypeCheck.errors.txt +++ b/tests/baselines/reference/indexTypeCheck.errors.txt @@ -5,7 +5,7 @@ tests/cases/compiler/indexTypeCheck.ts(22,2): error TS2413: Numeric index type ' tests/cases/compiler/indexTypeCheck.ts(27,2): error TS2413: Numeric index type 'number' is not assignable to string index type 'string'. tests/cases/compiler/indexTypeCheck.ts(32,3): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be 'string' or 'number'. -tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. ==== tests/cases/compiler/indexTypeCheck.ts (8 errors) ==== @@ -75,7 +75,7 @@ tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression yellow[blue]; // error ~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. var x:number[]; x[0]; diff --git a/tests/baselines/reference/indexWithoutParamType2.errors.txt b/tests/baselines/reference/indexWithoutParamType2.errors.txt index 468368b5f23..7e72b7804e2 100644 --- a/tests/baselines/reference/indexWithoutParamType2.errors.txt +++ b/tests/baselines/reference/indexWithoutParamType2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/indexWithoutParamType2.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/compiler/indexWithoutParamType2.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/compiler/indexWithoutParamType2.ts(3,6): error TS2304: Cannot find name 'x'. @@ -7,7 +7,7 @@ tests/cases/compiler/indexWithoutParamType2.ts(3,6): error TS2304: Cannot find n // Used to be indexer, now it is a computed property [x]: string ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'x'. } \ No newline at end of file diff --git a/tests/baselines/reference/inferentialTypingWithFunctionTypeNested.js b/tests/baselines/reference/inferentialTypingWithFunctionTypeNested.js index 6b6a47405ad..aeb9a840773 100644 --- a/tests/baselines/reference/inferentialTypingWithFunctionTypeNested.js +++ b/tests/baselines/reference/inferentialTypingWithFunctionTypeNested.js @@ -5,6 +5,4 @@ declare function identity(y: V): V; var s = map("", () => { return { x: identity }; }); //// [inferentialTypingWithFunctionTypeNested.js] -var s = map("", function () { - return { x: identity }; -}); +var s = map("", function () { return { x: identity }; }); diff --git a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromDifferentOrigins.errors.txt b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromDifferentOrigins.errors.txt index 555349cc251..e8c47e95fe9 100644 --- a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromDifferentOrigins.errors.txt +++ b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromDifferentOrigins.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/inheritSameNamePrivatePropertiesFromDifferentOrigins.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. - Named properties 'x' of types 'C' and 'C2' are not identical. + Named property 'x' of types 'C' and 'C2' are not identical. ==== tests/cases/compiler/inheritSameNamePrivatePropertiesFromDifferentOrigins.ts (1 errors) ==== @@ -14,6 +14,6 @@ tests/cases/compiler/inheritSameNamePrivatePropertiesFromDifferentOrigins.ts(9,1 interface A extends C, C2 { // error ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. -!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical. y: string; } \ No newline at end of file diff --git a/tests/baselines/reference/inheritSameNamePropertiesWithDifferentOptionality.errors.txt b/tests/baselines/reference/inheritSameNamePropertiesWithDifferentOptionality.errors.txt index 3f9c4a3bae0..f6debbde7ec 100644 --- a/tests/baselines/reference/inheritSameNamePropertiesWithDifferentOptionality.errors.txt +++ b/tests/baselines/reference/inheritSameNamePropertiesWithDifferentOptionality.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/inheritSameNamePropertiesWithDifferentOptionality.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. - Named properties 'x' of types 'C' and 'C2' are not identical. + Named property 'x' of types 'C' and 'C2' are not identical. ==== tests/cases/compiler/inheritSameNamePropertiesWithDifferentOptionality.ts (1 errors) ==== @@ -14,6 +14,6 @@ tests/cases/compiler/inheritSameNamePropertiesWithDifferentOptionality.ts(9,11): interface A extends C, C2 { // error ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. -!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical. y: string; } \ No newline at end of file diff --git a/tests/baselines/reference/inheritSameNamePropertiesWithDifferentVisibility.errors.txt b/tests/baselines/reference/inheritSameNamePropertiesWithDifferentVisibility.errors.txt index 9864b4a4792..1865e9f6b78 100644 --- a/tests/baselines/reference/inheritSameNamePropertiesWithDifferentVisibility.errors.txt +++ b/tests/baselines/reference/inheritSameNamePropertiesWithDifferentVisibility.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/inheritSameNamePropertiesWithDifferentVisibility.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. - Named properties 'x' of types 'C' and 'C2' are not identical. + Named property 'x' of types 'C' and 'C2' are not identical. ==== tests/cases/compiler/inheritSameNamePropertiesWithDifferentVisibility.ts (1 errors) ==== @@ -14,6 +14,6 @@ tests/cases/compiler/inheritSameNamePropertiesWithDifferentVisibility.ts(9,11): interface A extends C, C2 { // error ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. -!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical. y: string; } \ No newline at end of file diff --git a/tests/baselines/reference/inheritance.js b/tests/baselines/reference/inheritance.js index 1fca887a9b1..f7a274b1990 100644 --- a/tests/baselines/reference/inheritance.js +++ b/tests/baselines/reference/inheritance.js @@ -79,13 +79,9 @@ var ND = (function (_super) { })(N); var Good = (function () { function Good() { - this.f = function () { - return 0; - }; + this.f = function () { return 0; }; } - Good.prototype.g = function () { - return 0; - }; + Good.prototype.g = function () { return 0; }; return Good; })(); var Baad = (function (_super) { @@ -93,11 +89,7 @@ var Baad = (function (_super) { function Baad() { _super.apply(this, arguments); } - Baad.prototype.f = function () { - return 0; - }; - Baad.prototype.g = function (n) { - return 0; - }; + Baad.prototype.f = function () { return 0; }; + Baad.prototype.g = function (n) { return 0; }; return Baad; })(Good); diff --git a/tests/baselines/reference/inheritedFunctionAssignmentCompatibility.js b/tests/baselines/reference/inheritedFunctionAssignmentCompatibility.js index 3ea0e6e1594..85801ca704f 100644 --- a/tests/baselines/reference/inheritedFunctionAssignmentCompatibility.js +++ b/tests/baselines/reference/inheritedFunctionAssignmentCompatibility.js @@ -11,6 +11,4 @@ fn(function (a, b) { return true; }) //// [inheritedFunctionAssignmentCompatibility.js] function fn(cb) { } fn(function (a, b) { return true; }); -fn(function (a, b) { - return true; -}); +fn(function (a, b) { return true; }); diff --git a/tests/baselines/reference/innerFunc.js b/tests/baselines/reference/innerFunc.js index 1676d0789d1..c790c09e271 100644 --- a/tests/baselines/reference/innerFunc.js +++ b/tests/baselines/reference/innerFunc.js @@ -14,17 +14,13 @@ module M { //// [innerFunc.js] function salt() { - function pepper() { - return 5; - } + function pepper() { return 5; } return pepper(); } var M; (function (M) { function tungsten() { - function oxygen() { - return 6; - } + function oxygen() { return 6; } ; return oxygen(); } diff --git a/tests/baselines/reference/innerModExport1.js b/tests/baselines/reference/innerModExport1.js index d61e79f2396..cbeced37046 100644 --- a/tests/baselines/reference/innerModExport1.js +++ b/tests/baselines/reference/innerModExport1.js @@ -28,18 +28,12 @@ var Outer; { var non_export_var = 0; Outer.export_var = 1; - function NonExportFunc() { - return 0; - } - function ExportFunc() { - return 0; - } + function NonExportFunc() { return 0; } + function ExportFunc() { return 0; } Outer.ExportFunc = ExportFunc; } Outer.outer_var_export = 0; - function outerFuncExport() { - return 0; - } + function outerFuncExport() { return 0; } Outer.outerFuncExport = outerFuncExport; })(Outer || (Outer = {})); Outer.ExportFunc(); diff --git a/tests/baselines/reference/innerModExport2.js b/tests/baselines/reference/innerModExport2.js index 26399879e6d..a1526daf6f3 100644 --- a/tests/baselines/reference/innerModExport2.js +++ b/tests/baselines/reference/innerModExport2.js @@ -29,19 +29,13 @@ var Outer; { var non_export_var = 0; Outer.export_var = 1; - function NonExportFunc() { - return 0; - } - function ExportFunc() { - return 0; - } + function NonExportFunc() { return 0; } + function ExportFunc() { return 0; } Outer.ExportFunc = ExportFunc; } var export_var; Outer.outer_var_export = 0; - function outerFuncExport() { - return 0; - } + function outerFuncExport() { return 0; } Outer.outerFuncExport = outerFuncExport; })(Outer || (Outer = {})); Outer.NonExportFunc(); diff --git a/tests/baselines/reference/innerOverloads.js b/tests/baselines/reference/innerOverloads.js index 184b644406e..19e3fa78909 100644 --- a/tests/baselines/reference/innerOverloads.js +++ b/tests/baselines/reference/innerOverloads.js @@ -14,9 +14,7 @@ var x = outer(); // should work //// [innerOverloads.js] function outer() { - function inner(a) { - return a; - } + function inner(a) { return a; } return inner(0); } var x = outer(); // should work diff --git a/tests/baselines/reference/instanceAndStaticDeclarations1.js b/tests/baselines/reference/instanceAndStaticDeclarations1.js index 1396e2bcfa8..7dbd6dcbe7d 100644 --- a/tests/baselines/reference/instanceAndStaticDeclarations1.js +++ b/tests/baselines/reference/instanceAndStaticDeclarations1.js @@ -24,9 +24,7 @@ var Point = (function () { var dy = this.y - p.y; return Math.sqrt(dx * dx + dy * dy); }; - Point.distance = function (p1, p2) { - return p1.distance(p2); - }; + Point.distance = function (p1, p2) { return p1.distance(p2); }; Point.origin = new Point(0, 0); return Point; })(); diff --git a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js index 32507e8209e..7ab3b4a0aa3 100644 --- a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js +++ b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js @@ -64,9 +64,7 @@ var NonGeneric; enumerable: true, configurable: true }); - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; return C; })(); var D = (function (_super) { @@ -98,9 +96,7 @@ var Generic; enumerable: true, configurable: true }); - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; return C; })(); var D = (function (_super) { diff --git a/tests/baselines/reference/instancePropertyInClassType.js b/tests/baselines/reference/instancePropertyInClassType.js index ac89621b7b9..863f18de323 100644 --- a/tests/baselines/reference/instancePropertyInClassType.js +++ b/tests/baselines/reference/instancePropertyInClassType.js @@ -54,9 +54,7 @@ var NonGeneric; enumerable: true, configurable: true }); - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; return C; })(); var c = new C(1, 2); @@ -81,9 +79,7 @@ var Generic; enumerable: true, configurable: true }); - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; return C; })(); var c = new C(1, ''); diff --git a/tests/baselines/reference/intTypeCheck.js b/tests/baselines/reference/intTypeCheck.js index ab62168007e..fbbe1bb5d03 100644 --- a/tests/baselines/reference/intTypeCheck.js +++ b/tests/baselines/reference/intTypeCheck.js @@ -219,15 +219,9 @@ var anyVar; var obj0; var obj1 = { p: null, - p3: function () { - return 0; - }, - p6: function (pa1) { - return 0; - }, - p7: function (pa1, pa2) { - return 0; - } + p3: function () { return 0; }, + p6: function (pa1) { return 0; }, + p7: function (pa1, pa2) { return 0; } }; var obj2 = new Object(); var obj3 = new obj0; @@ -247,9 +241,7 @@ var obj13 = new Object(); var obj14 = new obj11; var obj15 = new Base; var obj16 = null; -var obj17 = function () { - return 0; -}; +var obj17 = function () { return 0; }; //var obj18: i2 = function foo() { }; var obj19 = anyVar; var obj20 = new < i2 > anyVar; diff --git a/tests/baselines/reference/interfaceDeclaration1.errors.txt b/tests/baselines/reference/interfaceDeclaration1.errors.txt index 1e8cc0c1e68..b73cfef75df 100644 --- a/tests/baselines/reference/interfaceDeclaration1.errors.txt +++ b/tests/baselines/reference/interfaceDeclaration1.errors.txt @@ -7,7 +7,7 @@ tests/cases/compiler/interfaceDeclaration1.ts(35,7): error TS2420: Class 'C1' in Property 'prototype' is missing in type 'C1'. tests/cases/compiler/interfaceDeclaration1.ts(41,11): error TS2310: Type 'i8' recursively references itself as a base type. tests/cases/compiler/interfaceDeclaration1.ts(52,11): error TS2320: Interface 'i12' cannot simultaneously extend types 'i10' and 'i11'. - Named properties 'foo' of types 'i10' and 'i11' are not identical. + Named property 'foo' of types 'i10' and 'i11' are not identical. ==== tests/cases/compiler/interfaceDeclaration1.ts (8 errors) ==== @@ -80,5 +80,5 @@ tests/cases/compiler/interfaceDeclaration1.ts(52,11): error TS2320: Interface 'i interface i12 extends i10, i11 { } ~~~ !!! error TS2320: Interface 'i12' cannot simultaneously extend types 'i10' and 'i11'. -!!! error TS2320: Named properties 'foo' of types 'i10' and 'i11' are not identical. +!!! error TS2320: Named property 'foo' of types 'i10' and 'i11' are not identical. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt b/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt index c9be8471e8c..7850c10fe26 100644 --- a/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt +++ b/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(9,11): error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'. - Named properties 'x' of types 'Foo' and 'Bar' are not identical. + Named property 'x' of types 'Foo' and 'Bar' are not identical. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Bar'. Property 'x' is private in type 'Bar' but not in type 'I4'. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Foo'. @@ -20,7 +20,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending interface I3 extends Foo, Bar { // error ~~ !!! error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'. -!!! error TS2320: Named properties 'x' of types 'Foo' and 'Bar' are not identical. +!!! error TS2320: Named property 'x' of types 'Foo' and 'Bar' are not identical. } interface I4 extends Foo, Bar { // error diff --git a/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt b/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt index a63dfd6efca..48e3b7d7e6c 100644 --- a/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt +++ b/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(9,11): error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'. - Named properties 'x' of types 'Foo' and 'Bar' are not identical. + Named property 'x' of types 'Foo' and 'Bar' are not identical. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Bar'. Property 'x' is protected but type 'I4' is not a class derived from 'Bar'. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Foo'. @@ -20,7 +20,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending interface I3 extends Foo, Bar { // error ~~ !!! error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'. -!!! error TS2320: Named properties 'x' of types 'Foo' and 'Bar' are not identical. +!!! error TS2320: Named property 'x' of types 'Foo' and 'Bar' are not identical. } interface I4 extends Foo, Bar { // error diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js index a230318dcc9..521a71199ad 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js @@ -38,9 +38,7 @@ var C = (function () { function C() { this.x = 1; } - C.prototype.foo = function (x) { - return x; - }; + C.prototype.foo = function (x) { return x; }; return C; })(); var D = (function (_super) { @@ -48,12 +46,8 @@ var D = (function (_super) { function D() { _super.apply(this, arguments); } - D.prototype.foo = function (x) { - return x; - }; - D.prototype.other = function (x) { - return x; - }; + D.prototype.foo = function (x) { return x; }; + D.prototype.other = function (x) { return x; }; D.prototype.bar = function () { }; return D; })(C); diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js index b55c6207661..c177f2e7a90 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js @@ -34,9 +34,7 @@ var C = (function () { function C() { this.x = 1; } - C.prototype.foo = function (x) { - return x; - }; + C.prototype.foo = function (x) { return x; }; return C; })(); var D = (function (_super) { @@ -46,12 +44,8 @@ var D = (function (_super) { this.x = 2; this.y = 3; } - D.prototype.foo = function (x) { - return x; - }; - D.prototype.other = function (x) { - return x; - }; + D.prototype.foo = function (x) { return x; }; + D.prototype.other = function (x) { return x; }; D.prototype.bar = function () { }; return D; })(C); @@ -61,12 +55,8 @@ var D2 = (function (_super) { _super.apply(this, arguments); this.x = ""; } - D2.prototype.foo = function (x) { - return x; - }; - D2.prototype.other = function (x) { - return x; - }; + D2.prototype.foo = function (x) { return x; }; + D2.prototype.other = function (x) { return x; }; D2.prototype.bar = function () { }; return D2; })(C); diff --git a/tests/baselines/reference/interfaceImplementation5.js b/tests/baselines/reference/interfaceImplementation5.js index 1edfdeb8294..c710eda84f5 100644 --- a/tests/baselines/reference/interfaceImplementation5.js +++ b/tests/baselines/reference/interfaceImplementation5.js @@ -36,9 +36,7 @@ var C1 = (function () { function C1() { } Object.defineProperty(C1.prototype, "getset1", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); @@ -58,9 +56,7 @@ var C3 = (function () { function C3() { } Object.defineProperty(C3.prototype, "getset1", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (baz) { }, enumerable: true, configurable: true @@ -71,10 +67,7 @@ var C4 = (function () { function C4() { } Object.defineProperty(C4.prototype, "getset1", { - get: function () { - var x; - return x; - }, + get: function () { var x; return x; }, enumerable: true, configurable: true }); @@ -94,10 +87,7 @@ var C6 = (function () { function C6() { } Object.defineProperty(C6.prototype, "getset1", { - get: function () { - var x; - return x; - }, + get: function () { var x; return x; }, set: function (baz) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/interfaceImplementation7.errors.txt b/tests/baselines/reference/interfaceImplementation7.errors.txt index ff1118e5c69..b297015dfbe 100644 --- a/tests/baselines/reference/interfaceImplementation7.errors.txt +++ b/tests/baselines/reference/interfaceImplementation7.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/interfaceImplementation7.ts(4,11): error TS2320: Interface 'i3' cannot simultaneously extend types 'i1' and 'i2'. - Named properties 'name' of types 'i1' and 'i2' are not identical. + Named property 'name' of types 'i1' and 'i2' are not identical. tests/cases/compiler/interfaceImplementation7.ts(7,7): error TS2420: Class 'C1' incorrectly implements interface 'i4'. Types of property 'name' are incompatible. Type '() => string' is not assignable to type '() => { s: string; n: number; }'. @@ -14,7 +14,7 @@ tests/cases/compiler/interfaceImplementation7.ts(7,7): error TS2420: Class 'C1' interface i3 extends i1, i2 { } ~~ !!! error TS2320: Interface 'i3' cannot simultaneously extend types 'i1' and 'i2'. -!!! error TS2320: Named properties 'name' of types 'i1' and 'i2' are not identical. +!!! error TS2320: Named property 'name' of types 'i1' and 'i2' are not identical. interface i4 extends i1, i2 { name(): { s: string; n: number; }; } class C1 implements i4 { diff --git a/tests/baselines/reference/interfaceImplementation7.js b/tests/baselines/reference/interfaceImplementation7.js index 6345fe93a33..2813d7ee0fe 100644 --- a/tests/baselines/reference/interfaceImplementation7.js +++ b/tests/baselines/reference/interfaceImplementation7.js @@ -14,8 +14,6 @@ class C1 implements i4 { var C1 = (function () { function C1() { } - C1.prototype.name = function () { - return ""; - }; + C1.prototype.name = function () { return ""; }; return C1; })(); diff --git a/tests/baselines/reference/interfacePropertiesWithSameName2.errors.txt b/tests/baselines/reference/interfacePropertiesWithSameName2.errors.txt index a7df9c15e59..82301d9ae16 100644 --- a/tests/baselines/reference/interfacePropertiesWithSameName2.errors.txt +++ b/tests/baselines/reference/interfacePropertiesWithSameName2.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/interfacePropertiesWithSameName2.ts(10,11): error TS2320: Interface 'MoverShaker' cannot simultaneously extend types 'Mover' and 'Shaker'. - Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical. + Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical. tests/cases/compiler/interfacePropertiesWithSameName2.ts(26,11): error TS2320: Interface 'MoverShaker2' cannot simultaneously extend types 'Mover' and 'Shaker'. - Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical. + Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical. ==== tests/cases/compiler/interfacePropertiesWithSameName2.ts (2 errors) ==== @@ -17,7 +17,7 @@ tests/cases/compiler/interfacePropertiesWithSameName2.ts(26,11): error TS2320: I interface MoverShaker extends Mover, Shaker { ~~~~~~~~~~~ !!! error TS2320: Interface 'MoverShaker' cannot simultaneously extend types 'Mover' and 'Shaker'. -!!! error TS2320: Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical. +!!! error TS2320: Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical. } @@ -36,7 +36,7 @@ tests/cases/compiler/interfacePropertiesWithSameName2.ts(26,11): error TS2320: I interface MoverShaker2 extends MoversAndShakers.Mover, MoversAndShakers.Shaker { } // error ~~~~~~~~~~~~ !!! error TS2320: Interface 'MoverShaker2' cannot simultaneously extend types 'Mover' and 'Shaker'. -!!! error TS2320: Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical. +!!! error TS2320: Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical. interface MoverShaker3 extends MoversAndShakers.Mover, MoversAndShakers.Shaker { getStatus(): { speed: number; frequency: number; }; // ok because this getStatus overrides the conflicting ones above diff --git a/tests/baselines/reference/interfacePropertiesWithSameName3.errors.txt b/tests/baselines/reference/interfacePropertiesWithSameName3.errors.txt index b7dfdffc79e..cc333e0e054 100644 --- a/tests/baselines/reference/interfacePropertiesWithSameName3.errors.txt +++ b/tests/baselines/reference/interfacePropertiesWithSameName3.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/interfacePropertiesWithSameName3.ts(3,11): error TS2320: Interface 'F' cannot simultaneously extend types 'E' and 'D'. - Named properties 'a' of types 'E' and 'D' are not identical. + Named property 'a' of types 'E' and 'D' are not identical. tests/cases/compiler/interfacePropertiesWithSameName3.ts(7,11): error TS2320: Interface 'F2' cannot simultaneously extend types 'E2' and 'D2'. - Named properties 'a' of types 'E2' and 'D2' are not identical. + Named property 'a' of types 'E2' and 'D2' are not identical. ==== tests/cases/compiler/interfacePropertiesWithSameName3.ts (2 errors) ==== @@ -10,12 +10,12 @@ tests/cases/compiler/interfacePropertiesWithSameName3.ts(7,11): error TS2320: In interface F extends E, D { } // error ~ !!! error TS2320: Interface 'F' cannot simultaneously extend types 'E' and 'D'. -!!! error TS2320: Named properties 'a' of types 'E' and 'D' are not identical. +!!! error TS2320: Named property 'a' of types 'E' and 'D' are not identical. class D2 { a: number; } class E2 { a: string; } interface F2 extends E2, D2 { } // error ~~ !!! error TS2320: Interface 'F2' cannot simultaneously extend types 'E2' and 'D2'. -!!! error TS2320: Named properties 'a' of types 'E2' and 'D2' are not identical. +!!! error TS2320: Named property 'a' of types 'E2' and 'D2' are not identical. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceSubtyping.js b/tests/baselines/reference/interfaceSubtyping.js index 840ce79d869..43004985782 100644 --- a/tests/baselines/reference/interfaceSubtyping.js +++ b/tests/baselines/reference/interfaceSubtyping.js @@ -14,8 +14,6 @@ var Camera = (function () { function Camera(str) { this.str = str; } - Camera.prototype.foo = function () { - return "s"; - }; + Camera.prototype.foo = function () { return "s"; }; return Camera; })(); diff --git a/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt b/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt index 1562e16df4d..95adbbf6717 100644 --- a/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt +++ b/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt @@ -4,7 +4,7 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBa Types of property 'b' are incompatible. Type 'number' is not assignable to type 'string'. tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(52,15): error TS2320: Interface 'Derived3' cannot simultaneously extend types 'Base1' and 'Base2'. - Named properties 'x' of types 'Base1' and 'Base2' are not identical. + Named property 'x' of types 'Base1' and 'Base2' are not identical. tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(54,15): error TS2430: Interface 'Derived4' incorrectly extends interface 'Base1'. Types of property 'x' are incompatible. Type '{ a: T; b: T; }' is not assignable to type '{ a: number; }'. @@ -86,7 +86,7 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBa interface Derived3 extends Base1, Base2 { } // error ~~~~~~~~ !!! error TS2320: Interface 'Derived3' cannot simultaneously extend types 'Base1' and 'Base2'. -!!! error TS2320: Named properties 'x' of types 'Base1' and 'Base2' are not identical. +!!! error TS2320: Named property 'x' of types 'Base1' and 'Base2' are not identical. interface Derived4 extends Base1, Base2 { // error ~~~~~~~~ diff --git a/tests/baselines/reference/invalidMultipleVariableDeclarations.js b/tests/baselines/reference/invalidMultipleVariableDeclarations.js index fe3d62c4ba5..824bee92227 100644 --- a/tests/baselines/reference/invalidMultipleVariableDeclarations.js +++ b/tests/baselines/reference/invalidMultipleVariableDeclarations.js @@ -77,9 +77,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -88,9 +86,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); // all of these are errors diff --git a/tests/baselines/reference/invalidReturnStatements.js b/tests/baselines/reference/invalidReturnStatements.js index 9dc30431326..d637158780a 100644 --- a/tests/baselines/reference/invalidReturnStatements.js +++ b/tests/baselines/reference/invalidReturnStatements.js @@ -46,9 +46,5 @@ var D = (function (_super) { } return D; })(C); -function fn10() { - return { id: 12 }; -} -function fn11() { - return new C(); -} +function fn10() { return { id: 12 }; } +function fn11() { return new C(); } diff --git a/tests/baselines/reference/invalidStaticField.js b/tests/baselines/reference/invalidStaticField.js index 5521af05c83..620c019fc18 100644 --- a/tests/baselines/reference/invalidStaticField.js +++ b/tests/baselines/reference/invalidStaticField.js @@ -6,9 +6,7 @@ class B { static NOT_NULL = new B(); } var A = (function () { function A() { } - A.prototype.foo = function () { - return B.NULL; - }; + A.prototype.foo = function () { return B.NULL; }; return A; })(); var B = (function () { diff --git a/tests/baselines/reference/ipromise4.js b/tests/baselines/reference/ipromise4.js index bb8a3f12e0b..98660aa5824 100644 --- a/tests/baselines/reference/ipromise4.js +++ b/tests/baselines/reference/ipromise4.js @@ -19,8 +19,4 @@ p.then(function (x) { return "hello"; } ).then(function (x) { return x } ); // s //// [ipromise4.js] var p = null; p.then(function (x) { }); // should not error -p.then(function (x) { - return "hello"; -}).then(function (x) { - return x; -}); // should not error +p.then(function (x) { return "hello"; }).then(function (x) { return x; }); // should not error diff --git a/tests/baselines/reference/lambdaASIEmit.js b/tests/baselines/reference/lambdaASIEmit.js index 551aa5f93dd..49672b75c7c 100644 --- a/tests/baselines/reference/lambdaASIEmit.js +++ b/tests/baselines/reference/lambdaASIEmit.js @@ -12,4 +12,7 @@ Foo(() => //// [lambdaASIEmit.js] function Foo(x) { } -Foo(function () { return 127; }); +Foo(function () { + // do something + return 127; +}); diff --git a/tests/baselines/reference/letAndVarRedeclaration.errors.txt b/tests/baselines/reference/letAndVarRedeclaration.errors.txt new file mode 100644 index 00000000000..48704f61040 --- /dev/null +++ b/tests/baselines/reference/letAndVarRedeclaration.errors.txt @@ -0,0 +1,118 @@ +tests/cases/compiler/letAndVarRedeclaration.ts(2,5): error TS2451: Cannot redeclare block-scoped variable 'e0'. +tests/cases/compiler/letAndVarRedeclaration.ts(3,5): error TS2451: Cannot redeclare block-scoped variable 'e0'. +tests/cases/compiler/letAndVarRedeclaration.ts(4,10): error TS2451: Cannot redeclare block-scoped variable 'e0'. +tests/cases/compiler/letAndVarRedeclaration.ts(7,9): error TS2451: Cannot redeclare block-scoped variable 'x1'. +tests/cases/compiler/letAndVarRedeclaration.ts(8,9): error TS2451: Cannot redeclare block-scoped variable 'x1'. +tests/cases/compiler/letAndVarRedeclaration.ts(9,14): error TS2451: Cannot redeclare block-scoped variable 'x1'. +tests/cases/compiler/letAndVarRedeclaration.ts(13,9): error TS2451: Cannot redeclare block-scoped variable 'x'. +tests/cases/compiler/letAndVarRedeclaration.ts(15,13): error TS2451: Cannot redeclare block-scoped variable 'x'. +tests/cases/compiler/letAndVarRedeclaration.ts(18,18): error TS2451: Cannot redeclare block-scoped variable 'x'. +tests/cases/compiler/letAndVarRedeclaration.ts(23,9): error TS2451: Cannot redeclare block-scoped variable 'x2'. +tests/cases/compiler/letAndVarRedeclaration.ts(24,9): error TS2451: Cannot redeclare block-scoped variable 'x2'. +tests/cases/compiler/letAndVarRedeclaration.ts(25,14): error TS2451: Cannot redeclare block-scoped variable 'x2'. +tests/cases/compiler/letAndVarRedeclaration.ts(29,9): error TS2451: Cannot redeclare block-scoped variable 'x2'. +tests/cases/compiler/letAndVarRedeclaration.ts(31,13): error TS2451: Cannot redeclare block-scoped variable 'x2'. +tests/cases/compiler/letAndVarRedeclaration.ts(34,18): error TS2451: Cannot redeclare block-scoped variable 'x2'. +tests/cases/compiler/letAndVarRedeclaration.ts(38,5): error TS2451: Cannot redeclare block-scoped variable 'x11'. +tests/cases/compiler/letAndVarRedeclaration.ts(39,10): error TS2451: Cannot redeclare block-scoped variable 'x11'. +tests/cases/compiler/letAndVarRedeclaration.ts(43,9): error TS2451: Cannot redeclare block-scoped variable 'x11'. +tests/cases/compiler/letAndVarRedeclaration.ts(44,14): error TS2451: Cannot redeclare block-scoped variable 'x11'. +tests/cases/compiler/letAndVarRedeclaration.ts(49,9): error TS2451: Cannot redeclare block-scoped variable 'x11'. +tests/cases/compiler/letAndVarRedeclaration.ts(50,14): error TS2451: Cannot redeclare block-scoped variable 'x11'. + + +==== tests/cases/compiler/letAndVarRedeclaration.ts (21 errors) ==== + + let e0 + ~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'e0'. + var e0; + ~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'e0'. + function e0() { } + ~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'e0'. + + function f0() { + let x1; + ~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'x1'. + var x1; + ~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'x1'. + function x1() { } + ~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'x1'. + } + + function f1() { + let x; + ~ +!!! error TS2451: Cannot redeclare block-scoped variable 'x'. + { + var x; + ~ +!!! error TS2451: Cannot redeclare block-scoped variable 'x'. + } + { + function x() { } + ~ +!!! error TS2451: Cannot redeclare block-scoped variable 'x'. + } + } + + module M0 { + let x2; + ~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'x2'. + var x2; + ~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'x2'. + function x2() { } + ~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'x2'. + } + + module M1 { + let x2; + ~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'x2'. + { + var x2; + ~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'x2'. + } + { + function x2() { } + ~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'x2'. + } + } + + let x11; + ~~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'x11'. + for (var x11; ;) { + ~~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'x11'. + } + + function f2() { + let x11; + ~~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'x11'. + for (var x11; ;) { + ~~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'x11'. + } + } + + module M2 { + let x11; + ~~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'x11'. + for (var x11; ;) { + ~~~ +!!! error TS2451: Cannot redeclare block-scoped variable 'x11'. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/letAndVarRedeclaration.js b/tests/baselines/reference/letAndVarRedeclaration.js new file mode 100644 index 00000000000..fd4bfe67cac --- /dev/null +++ b/tests/baselines/reference/letAndVarRedeclaration.js @@ -0,0 +1,102 @@ +//// [letAndVarRedeclaration.ts] + +let e0 +var e0; +function e0() { } + +function f0() { + let x1; + var x1; + function x1() { } +} + +function f1() { + let x; + { + var x; + } + { + function x() { } + } +} + +module M0 { + let x2; + var x2; + function x2() { } +} + +module M1 { + let x2; + { + var x2; + } + { + function x2() { } + } +} + +let x11; +for (var x11; ;) { +} + +function f2() { + let x11; + for (var x11; ;) { + } +} + +module M2 { + let x11; + for (var x11; ;) { + } +} + +//// [letAndVarRedeclaration.js] +let e0; +var e0; +function e0() { } +function f0() { + let x1; + var x1; + function x1() { } +} +function f1() { + let x; + { + var x; + } + { + function x() { } + } +} +var M0; +(function (M0) { + let x2; + var x2; + function x2() { } +})(M0 || (M0 = {})); +var M1; +(function (M1) { + let x2; + { + var x2; + } + { + function x2() { } + } +})(M1 || (M1 = {})); +let x11; +for (var x11;;) { +} +function f2() { + let x11; + for (var x11;;) { + } +} +var M2; +(function (M2) { + let x11; + for (var x11;;) { + } +})(M2 || (M2 = {})); diff --git a/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt b/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt index 93dc307fc85..fbcee276583 100644 --- a/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt +++ b/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt @@ -1,21 +1,21 @@ -tests/cases/compiler/letInLetOrConstDeclarations.ts(2,9): error TS4089: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. -tests/cases/compiler/letInLetOrConstDeclarations.ts(3,14): error TS4089: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. -tests/cases/compiler/letInLetOrConstDeclarations.ts(6,11): error TS4089: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetOrConstDeclarations.ts(2,9): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetOrConstDeclarations.ts(3,14): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetOrConstDeclarations.ts(6,11): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. ==== tests/cases/compiler/letInLetOrConstDeclarations.ts (3 errors) ==== { let let = 1; // should error ~~~ -!!! error TS4089: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. for (let let in []) { } // should error ~~~ -!!! error TS4089: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. } { const let = 1; // should error ~~~ -!!! error TS4089: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. } { function let() { // should be ok diff --git a/tests/baselines/reference/lift.js b/tests/baselines/reference/lift.js index 21c09aaeb53..33f8200530b 100644 --- a/tests/baselines/reference/lift.js +++ b/tests/baselines/reference/lift.js @@ -37,11 +37,7 @@ var C = (function (_super) { var x = 10 + w; var ll = x * w; } - C.prototype.liftxyz = function () { - return x + z + this.y; - }; - C.prototype.liftxylocllz = function () { - return x + z + this.y + this.ll; - }; + C.prototype.liftxyz = function () { return x + z + this.y; }; + C.prototype.liftxylocllz = function () { return x + z + this.y + this.ll; }; return C; })(B); diff --git a/tests/baselines/reference/logicalNotOperatorWithBooleanType.js b/tests/baselines/reference/logicalNotOperatorWithBooleanType.js index 0f3c39a09ff..107bd9a88ec 100644 --- a/tests/baselines/reference/logicalNotOperatorWithBooleanType.js +++ b/tests/baselines/reference/logicalNotOperatorWithBooleanType.js @@ -41,15 +41,11 @@ var ResultIsBoolean = !!BOOLEAN; //// [logicalNotOperatorWithBooleanType.js] // ! operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/logicalNotOperatorWithNumberType.js b/tests/baselines/reference/logicalNotOperatorWithNumberType.js index 48e1468285e..0d0601cad23 100644 --- a/tests/baselines/reference/logicalNotOperatorWithNumberType.js +++ b/tests/baselines/reference/logicalNotOperatorWithNumberType.js @@ -49,15 +49,11 @@ var ResultIsBoolean13 = !!!(NUMBER + NUMBER); // ! operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -71,9 +67,7 @@ var ResultIsBoolean2 = !NUMBER1; // number type literal var ResultIsBoolean3 = !1; var ResultIsBoolean4 = !{ x: 1, y: 2 }; -var ResultIsBoolean5 = !{ x: 1, y: function (n) { - return n; -} }; +var ResultIsBoolean5 = !{ x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsBoolean6 = !objA.a; var ResultIsBoolean7 = !M.n; diff --git a/tests/baselines/reference/logicalNotOperatorWithStringType.js b/tests/baselines/reference/logicalNotOperatorWithStringType.js index 1bab5de239d..7f75814d601 100644 --- a/tests/baselines/reference/logicalNotOperatorWithStringType.js +++ b/tests/baselines/reference/logicalNotOperatorWithStringType.js @@ -48,15 +48,11 @@ var ResultIsBoolean14 = !!!(STRING + STRING); // ! operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -70,9 +66,7 @@ var ResultIsBoolean2 = !STRING1; // string type literal var ResultIsBoolean3 = !""; var ResultIsBoolean4 = !{ x: "", y: "" }; -var ResultIsBoolean5 = !{ x: "", y: function (s) { - return s; -} }; +var ResultIsBoolean5 = !{ x: "", y: function (s) { return s; } }; // string type expressions var ResultIsBoolean6 = !objA.a; var ResultIsBoolean7 = !M.n; diff --git a/tests/baselines/reference/maxConstraints.js b/tests/baselines/reference/maxConstraints.js index 4ea37d30501..b2098ccaf2b 100644 --- a/tests/baselines/reference/maxConstraints.js +++ b/tests/baselines/reference/maxConstraints.js @@ -9,7 +9,5 @@ var max2: Comparer = (x, y) => { return (x.compareTo(y) > 0) ? x : y }; var maxResult = max2(1, 2); //// [maxConstraints.js] -var max2 = function (x, y) { - return (x.compareTo(y) > 0) ? x : y; -}; +var max2 = function (x, y) { return (x.compareTo(y) > 0) ? x : y; }; var maxResult = max2(1, 2); diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.errors.txt b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.errors.txt index 4c49e6beb0c..584edc24bb5 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates3.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. - Named properties 'x' of types 'C' and 'C2' are not identical. + Named property 'x' of types 'C' and 'C2' are not identical. tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates3.ts(31,15): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. - Named properties 'x' of types 'C' and 'C2' are not identical. + Named property 'x' of types 'C' and 'C2' are not identical. ==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates3.ts (2 errors) ==== @@ -16,7 +16,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheri interface A extends C { // error ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. -!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical. y: string; } @@ -41,7 +41,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheri interface A extends C { // error, privates conflict ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. -!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical. y: string; } diff --git a/tests/baselines/reference/mergedInterfacesWithMultipleBases4.errors.txt b/tests/baselines/reference/mergedInterfacesWithMultipleBases4.errors.txt index 1e11dc792f1..f7ea6fbc2a0 100644 --- a/tests/baselines/reference/mergedInterfacesWithMultipleBases4.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithMultipleBases4.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultipleBases4.ts(19,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C'. - Named properties 'a' of types 'C' and 'C' are not identical. + Named property 'a' of types 'C' and 'C' are not identical. ==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultipleBases4.ts (1 errors) ==== @@ -24,7 +24,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultip interface A extends C, C3 { // error ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C'. -!!! error TS2320: Named properties 'a' of types 'C' and 'C' are not identical. +!!! error TS2320: Named property 'a' of types 'C' and 'C' are not identical. y: T; } diff --git a/tests/baselines/reference/missingSelf.js b/tests/baselines/reference/missingSelf.js index c2c1e04ad5c..56dcc4f9fa0 100644 --- a/tests/baselines/reference/missingSelf.js +++ b/tests/baselines/reference/missingSelf.js @@ -22,9 +22,7 @@ c2.b(); var CalcButton = (function () { function CalcButton() { } - CalcButton.prototype.a = function () { - this.onClick(); - }; + CalcButton.prototype.a = function () { this.onClick(); }; CalcButton.prototype.onClick = function () { }; return CalcButton; })(); diff --git a/tests/baselines/reference/modFunctionCrash.js b/tests/baselines/reference/modFunctionCrash.js index f216788c0eb..0d4f62eae63 100644 --- a/tests/baselines/reference/modFunctionCrash.js +++ b/tests/baselines/reference/modFunctionCrash.js @@ -7,6 +7,4 @@ declare module Q { Q.f(function() {this;}); //// [modFunctionCrash.js] -Q.f(function () { - this; -}); +Q.f(function () { this; }); diff --git a/tests/baselines/reference/moduleReopenedTypeOtherBlock.js b/tests/baselines/reference/moduleReopenedTypeOtherBlock.js index d2dc938872a..951c558ddfd 100644 --- a/tests/baselines/reference/moduleReopenedTypeOtherBlock.js +++ b/tests/baselines/reference/moduleReopenedTypeOtherBlock.js @@ -23,9 +23,7 @@ var M; var C2 = (function () { function C2() { } - C2.prototype.f = function () { - return null; - }; + C2.prototype.f = function () { return null; }; return C2; })(); M.C2 = C2; diff --git a/tests/baselines/reference/moduleReopenedTypeSameBlock.js b/tests/baselines/reference/moduleReopenedTypeSameBlock.js index c3546f20b2f..92e7e9e5228 100644 --- a/tests/baselines/reference/moduleReopenedTypeSameBlock.js +++ b/tests/baselines/reference/moduleReopenedTypeSameBlock.js @@ -21,9 +21,7 @@ var M; var C2 = (function () { function C2() { } - C2.prototype.f = function () { - return null; - }; + C2.prototype.f = function () { return null; }; return C2; })(); M.C2 = C2; diff --git a/tests/baselines/reference/moduleSymbolMerging.js b/tests/baselines/reference/moduleSymbolMerging.js index 0a812a62e09..d43fff1378a 100644 --- a/tests/baselines/reference/moduleSymbolMerging.js +++ b/tests/baselines/reference/moduleSymbolMerging.js @@ -22,9 +22,7 @@ var A; })(A || (A = {})); var B; (function (B) { - function f() { - return null; - } + function f() { return null; } B.f = f; })(B || (B = {})); diff --git a/tests/baselines/reference/moduleUnassignedVariable.js b/tests/baselines/reference/moduleUnassignedVariable.js index 179a2577adf..1765342efcd 100644 --- a/tests/baselines/reference/moduleUnassignedVariable.js +++ b/tests/baselines/reference/moduleUnassignedVariable.js @@ -12,11 +12,7 @@ module Bar { var Bar; (function (Bar) { Bar.a = 1; - function fooA() { - return Bar.a; - } // Correct: return Bar.a + function fooA() { return Bar.a; } // Correct: return Bar.a Bar.b; - function fooB() { - return Bar.b; - } // Incorrect: return b + function fooB() { return Bar.b; } // Incorrect: return b })(Bar || (Bar = {})); diff --git a/tests/baselines/reference/moduleVisibilityTest1.js b/tests/baselines/reference/moduleVisibilityTest1.js index d8bdedfafe2..a2957cb9582 100644 --- a/tests/baselines/reference/moduleVisibilityTest1.js +++ b/tests/baselines/reference/moduleVisibilityTest1.js @@ -70,15 +70,11 @@ c.someMethodThatCallsAnOuterMethod(); //// [moduleVisibilityTest1.js] var OuterMod; (function (OuterMod) { - function someExportedOuterFunc() { - return -1; - } + function someExportedOuterFunc() { return -1; } OuterMod.someExportedOuterFunc = someExportedOuterFunc; var OuterInnerMod; (function (OuterInnerMod) { - function someExportedOuterInnerFunc() { - return "foo"; - } + function someExportedOuterInnerFunc() { return "foo"; } OuterInnerMod.someExportedOuterInnerFunc = someExportedOuterInnerFunc; })(OuterInnerMod = OuterMod.OuterInnerMod || (OuterMod.OuterInnerMod = {})); })(OuterMod || (OuterMod = {})); @@ -87,9 +83,7 @@ var M; (function (M) { var InnerMod; (function (InnerMod) { - function someExportedInnerFunc() { - return -2; - } + function someExportedInnerFunc() { return -2; } InnerMod.someExportedInnerFunc = someExportedInnerFunc; })(InnerMod = M.InnerMod || (M.InnerMod = {})); (function (E) { @@ -109,30 +103,18 @@ var M; var C = (function () { function C() { this.someProp = 1; - function someInnerFunc() { - return 2; - } + function someInnerFunc() { return 2; } var someInnerVar = 3; } - C.prototype.someMethodThatCallsAnOuterMethod = function () { - return OuterInnerAlias.someExportedOuterInnerFunc(); - }; - C.prototype.someMethodThatCallsAnInnerMethod = function () { - return InnerMod.someExportedInnerFunc(); - }; - C.prototype.someMethodThatCallsAnOuterInnerMethod = function () { - return OuterMod.someExportedOuterFunc(); - }; - C.prototype.someMethod = function () { - return 0; - }; + C.prototype.someMethodThatCallsAnOuterMethod = function () { return OuterInnerAlias.someExportedOuterInnerFunc(); }; + C.prototype.someMethodThatCallsAnInnerMethod = function () { return InnerMod.someExportedInnerFunc(); }; + C.prototype.someMethodThatCallsAnOuterInnerMethod = function () { return OuterMod.someExportedOuterFunc(); }; + C.prototype.someMethod = function () { return 0; }; return C; })(); M.C = C; var someModuleVar = 4; - function someModuleFunction() { - return 5; - } + function someModuleFunction() { return 5; } })(M || (M = {})); var M; (function (M) { diff --git a/tests/baselines/reference/moduleVisibilityTest2.js b/tests/baselines/reference/moduleVisibilityTest2.js index 63ecaf0c135..9102bd17ae2 100644 --- a/tests/baselines/reference/moduleVisibilityTest2.js +++ b/tests/baselines/reference/moduleVisibilityTest2.js @@ -71,15 +71,11 @@ c.someMethodThatCallsAnOuterMethod(); //// [moduleVisibilityTest2.js] var OuterMod; (function (OuterMod) { - function someExportedOuterFunc() { - return -1; - } + function someExportedOuterFunc() { return -1; } OuterMod.someExportedOuterFunc = someExportedOuterFunc; var OuterInnerMod; (function (OuterInnerMod) { - function someExportedOuterInnerFunc() { - return "foo"; - } + function someExportedOuterInnerFunc() { return "foo"; } OuterInnerMod.someExportedOuterInnerFunc = someExportedOuterInnerFunc; })(OuterInnerMod = OuterMod.OuterInnerMod || (OuterMod.OuterInnerMod = {})); })(OuterMod || (OuterMod = {})); @@ -88,9 +84,7 @@ var M; (function (M) { var InnerMod; (function (InnerMod) { - function someExportedInnerFunc() { - return -2; - } + function someExportedInnerFunc() { return -2; } InnerMod.someExportedInnerFunc = someExportedInnerFunc; })(InnerMod || (InnerMod = {})); var E; @@ -110,30 +104,18 @@ var M; var C = (function () { function C() { this.someProp = 1; - function someInnerFunc() { - return 2; - } + function someInnerFunc() { return 2; } var someInnerVar = 3; } - C.prototype.someMethodThatCallsAnOuterMethod = function () { - return OuterInnerAlias.someExportedOuterInnerFunc(); - }; - C.prototype.someMethodThatCallsAnInnerMethod = function () { - return InnerMod.someExportedInnerFunc(); - }; - C.prototype.someMethodThatCallsAnOuterInnerMethod = function () { - return OuterMod.someExportedOuterFunc(); - }; - C.prototype.someMethod = function () { - return 0; - }; + C.prototype.someMethodThatCallsAnOuterMethod = function () { return OuterInnerAlias.someExportedOuterInnerFunc(); }; + C.prototype.someMethodThatCallsAnInnerMethod = function () { return InnerMod.someExportedInnerFunc(); }; + C.prototype.someMethodThatCallsAnOuterInnerMethod = function () { return OuterMod.someExportedOuterFunc(); }; + C.prototype.someMethod = function () { return 0; }; return C; })(); M.C = C; var someModuleVar = 4; - function someModuleFunction() { - return 5; - } + function someModuleFunction() { return 5; } })(M || (M = {})); var M; (function (M) { diff --git a/tests/baselines/reference/multiModuleClodule1.js b/tests/baselines/reference/multiModuleClodule1.js index 8fa142812cd..9f6d7b5014c 100644 --- a/tests/baselines/reference/multiModuleClodule1.js +++ b/tests/baselines/reference/multiModuleClodule1.js @@ -36,9 +36,7 @@ var C; (function (C) { function foo() { } C.foo = foo; - function baz() { - return ''; - } + function baz() { return ''; } })(C || (C = {})); var c = new C(C.x); c.foo = C.foo; diff --git a/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties.errors.txt b/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties.errors.txt index 633f544a67b..70db70de97b 100644 --- a/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties.errors.txt +++ b/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/multipleBaseInterfaesWithIncompatibleProperties.ts(6,11): error TS2320: Interface 'C' cannot simultaneously extend types 'A' and 'A'. - Named properties 'x' of types 'A' and 'A' are not identical. + Named property 'x' of types 'A' and 'A' are not identical. ==== tests/cases/compiler/multipleBaseInterfaesWithIncompatibleProperties.ts (1 errors) ==== @@ -11,5 +11,5 @@ tests/cases/compiler/multipleBaseInterfaesWithIncompatibleProperties.ts(6,11): e interface C extends A, A { } ~ !!! error TS2320: Interface 'C' cannot simultaneously extend types 'A' and 'A'. -!!! error TS2320: Named properties 'x' of types 'A' and 'A' are not identical. +!!! error TS2320: Named property 'x' of types 'A' and 'A' are not identical. \ No newline at end of file diff --git a/tests/baselines/reference/multipleInheritance.js b/tests/baselines/reference/multipleInheritance.js index 9cab77f3dba..269d5c2ea19 100644 --- a/tests/baselines/reference/multipleInheritance.js +++ b/tests/baselines/reference/multipleInheritance.js @@ -97,13 +97,9 @@ var ND = (function (_super) { })(N); var Good = (function () { function Good() { - this.f = function () { - return 0; - }; + this.f = function () { return 0; }; } - Good.prototype.g = function () { - return 0; - }; + Good.prototype.g = function () { return 0; }; return Good; })(); var Baad = (function (_super) { @@ -111,11 +107,7 @@ var Baad = (function (_super) { function Baad() { _super.apply(this, arguments); } - Baad.prototype.f = function () { - return 0; - }; - Baad.prototype.g = function (n) { - return 0; - }; + Baad.prototype.f = function () { return 0; }; + Baad.prototype.g = function (n) { return 0; }; return Baad; })(Good); diff --git a/tests/baselines/reference/mutrec.js b/tests/baselines/reference/mutrec.js index ba6c8ade036..1d1ccb4e90b 100644 --- a/tests/baselines/reference/mutrec.js +++ b/tests/baselines/reference/mutrec.js @@ -43,15 +43,11 @@ g(i4); //// [mutrec.js] -function f(p) { - return p; -} +function f(p) { return p; } ; var b; f(b); -function g(p) { - return p; -} +function g(p) { return p; } ; var i2; g(i2); diff --git a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js index 585a3d2178b..76fd13aa320 100644 --- a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js +++ b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js @@ -20,9 +20,7 @@ var __extends = this.__extends || function (d, b) { var foo = (function () { function foo() { } - foo.prototype.bar = function () { - return null; - }; + foo.prototype.bar = function () { return null; }; return foo; })(); var foo2 = (function (_super) { diff --git a/tests/baselines/reference/nameCollisionsInPropertyAssignments.js b/tests/baselines/reference/nameCollisionsInPropertyAssignments.js index 3035ab6e628..1f3631e03ba 100644 --- a/tests/baselines/reference/nameCollisionsInPropertyAssignments.js +++ b/tests/baselines/reference/nameCollisionsInPropertyAssignments.js @@ -4,6 +4,4 @@ var y = { x() { x++; } }; //// [nameCollisionsInPropertyAssignments.js] var x = 1; -var y = { x: function () { - x++; -} }; +var y = { x: function () { x++; } }; diff --git a/tests/baselines/reference/negateOperatorWithBooleanType.js b/tests/baselines/reference/negateOperatorWithBooleanType.js index ce7b14b2d82..9442f54490f 100644 --- a/tests/baselines/reference/negateOperatorWithBooleanType.js +++ b/tests/baselines/reference/negateOperatorWithBooleanType.js @@ -38,15 +38,11 @@ var ResultIsNumber7 = -A.foo(); //// [negateOperatorWithBooleanType.js] // - operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/negateOperatorWithNumberType.js b/tests/baselines/reference/negateOperatorWithNumberType.js index 15e0eeca435..5fa83e088c8 100644 --- a/tests/baselines/reference/negateOperatorWithNumberType.js +++ b/tests/baselines/reference/negateOperatorWithNumberType.js @@ -45,15 +45,11 @@ var ResultIsNumber11 = -(NUMBER - NUMBER); // - operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -67,9 +63,7 @@ var ResultIsNumber2 = -NUMBER1; // number type literal var ResultIsNumber3 = -1; var ResultIsNumber4 = -{ x: 1, y: 2 }; -var ResultIsNumber5 = -{ x: 1, y: function (n) { - return n; -} }; +var ResultIsNumber5 = -{ x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsNumber6 = -objA.a; var ResultIsNumber7 = -M.n; diff --git a/tests/baselines/reference/negateOperatorWithStringType.js b/tests/baselines/reference/negateOperatorWithStringType.js index 228733b65c5..bdbc4a3d664 100644 --- a/tests/baselines/reference/negateOperatorWithStringType.js +++ b/tests/baselines/reference/negateOperatorWithStringType.js @@ -44,15 +44,11 @@ var ResultIsNumber12 = -STRING.charAt(0); // - operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -66,9 +62,7 @@ var ResultIsNumber2 = -STRING1; // string type literal var ResultIsNumber3 = -""; var ResultIsNumber4 = -{ x: "", y: "" }; -var ResultIsNumber5 = -{ x: "", y: function (s) { - return s; -} }; +var ResultIsNumber5 = -{ x: "", y: function (s) { return s; } }; // string type expressions var ResultIsNumber6 = -objA.a; var ResultIsNumber7 = -M.n; diff --git a/tests/baselines/reference/nestedClassDeclaration.js b/tests/baselines/reference/nestedClassDeclaration.js index fa69ef5950e..70445b3372f 100644 --- a/tests/baselines/reference/nestedClassDeclaration.js +++ b/tests/baselines/reference/nestedClassDeclaration.js @@ -37,5 +37,4 @@ var C3 = (function () { return C3; })(); var x = { - class: C4 -}, _a = void 0; + class: C4 }, _a = void 0; diff --git a/tests/baselines/reference/nestedSelf.js b/tests/baselines/reference/nestedSelf.js index 897bdd720e7..9c0feaa887f 100644 --- a/tests/baselines/reference/nestedSelf.js +++ b/tests/baselines/reference/nestedSelf.js @@ -17,9 +17,7 @@ var M; } C.prototype.foo = function () { var _this = this; - [1, 2, 3].map(function (x) { - return _this.n * x; - }); + [1, 2, 3].map(function (x) { return _this.n * x; }); }; return C; })(); diff --git a/tests/baselines/reference/newOperatorErrorCases.js b/tests/baselines/reference/newOperatorErrorCases.js index 8a44d51fb5c..b893beba02a 100644 --- a/tests/baselines/reference/newOperatorErrorCases.js +++ b/tests/baselines/reference/newOperatorErrorCases.js @@ -65,7 +65,5 @@ var c1 = new T; var c1; var c2 = new T(); // Parse error // Construct expression of non-void returning function -function fnNumber() { - return 32; -} +function fnNumber() { return 32; } var s = new fnNumber(); // Error diff --git a/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInFunction.js b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInFunction.js index d144a78fae3..bdb55633682 100644 --- a/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInFunction.js +++ b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInFunction.js @@ -11,7 +11,5 @@ function x() { var console; function x() { var _this = 5; - (function (x) { - console.log(_this); - }); + (function (x) { console.log(_this); }); } diff --git a/tests/baselines/reference/noCollisionThisExpressionInFunctionAndVarInGlobal.js b/tests/baselines/reference/noCollisionThisExpressionInFunctionAndVarInGlobal.js index c34ad4c97bd..b3677681822 100644 --- a/tests/baselines/reference/noCollisionThisExpressionInFunctionAndVarInGlobal.js +++ b/tests/baselines/reference/noCollisionThisExpressionInFunctionAndVarInGlobal.js @@ -12,7 +12,5 @@ var console; var _this = 5; function x() { var _this = this; - (function (x) { - console.log(_this); - }); + (function (x) { console.log(_this); }); } diff --git a/tests/baselines/reference/noConstraintInReturnType1.js b/tests/baselines/reference/noConstraintInReturnType1.js index 747cbfdf758..0402f9d83cb 100644 --- a/tests/baselines/reference/noConstraintInReturnType1.js +++ b/tests/baselines/reference/noConstraintInReturnType1.js @@ -8,9 +8,7 @@ class List { var List = (function () { function List() { } - List.empty = function () { - return null; - }; + List.empty = function () { return null; }; return List; })(); diff --git a/tests/baselines/reference/noImplicitAnyWithOverloads.js b/tests/baselines/reference/noImplicitAnyWithOverloads.js index c2e9f174ada..fd56b6e0d73 100644 --- a/tests/baselines/reference/noImplicitAnyWithOverloads.js +++ b/tests/baselines/reference/noImplicitAnyWithOverloads.js @@ -11,6 +11,4 @@ callb((a) => { a.foo; }); // error, chose first overload //// [noImplicitAnyWithOverloads.js] function callb(a) { } -callb(function (a) { - a.foo; -}); // error, chose first overload +callb(function (a) { a.foo; }); // error, chose first overload diff --git a/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.js b/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.js index 8afbb0c6201..c32cd84ce26 100644 --- a/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.js +++ b/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.js @@ -112,12 +112,8 @@ var r6 = true ? { foo: 1 } : null; var r6 = true ? null : { foo: 1 }; var r7 = true ? function () { } : null; var r7 = true ? null : function () { }; -var r8 = true ? function (x) { - return x; -} : null; -var r8b = true ? null : function (x) { - return x; -}; // type parameters not identical across declarations +var r8 = true ? function (x) { return x; } : null; +var r8b = true ? null : function (x) { return x; }; // type parameters not identical across declarations var i1; var r9 = true ? i1 : null; var r9 = true ? null : i1; diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js index 1cfd94a0c97..0474abef393 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js @@ -56,9 +56,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ''; - }; + A.prototype.foo = function () { return ''; }; return A; })(); var B = (function (_super) { @@ -66,9 +64,7 @@ var B = (function (_super) { function B() { _super.apply(this, arguments); } - B.prototype.bar = function () { - return ''; - }; + B.prototype.bar = function () { return ''; }; return B; })(A); var Foo = (function () { diff --git a/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt b/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt index 73332ff8926..b2f3bd9d824 100644 --- a/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt +++ b/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,17): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,17): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,63): error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? -tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,33): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,33): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,79): error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? @@ -59,12 +59,12 @@ tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,79): error TS // ElementAccessExpressions can only contain one expression. There should be a parse error here. var foods = new PetFood[new IceCream('Mint chocolate chip') , Cookie('Chocolate chip', false) , new Cookie('Peanut butter', true)]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? var foods2: MonsterFood[] = new PetFood[new IceCream('Mint chocolate chip') , Cookie('Chocolate chip', false) , new Cookie('Peanut butter', true)]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? \ No newline at end of file diff --git a/tests/baselines/reference/objectLiteralErrors.js b/tests/baselines/reference/objectLiteralErrors.js index 06158cb87c9..4dccc78b67d 100644 --- a/tests/baselines/reference/objectLiteralErrors.js +++ b/tests/baselines/reference/objectLiteralErrors.js @@ -67,69 +67,25 @@ var e15 = { "100": 0, 1e2: 0 }; var e16 = { 0x20: 0, 3.2e1: 0 }; var e17 = { a: 0, b: 1, a: 0 }; // Accessor and property with the same name -var f1 = { a: 0, get a() { - return 0; -} }; -var f2 = { a: '', get a() { - return ''; -} }; -var f3 = { a: 0, get a() { - return ''; -} }; -var f4 = { a: true, get a() { - return false; -} }; -var f5 = { a: {}, get a() { - return {}; -} }; -var f6 = { a: 0, get 'a'() { - return 0; -} }; -var f7 = { 'a': 0, get a() { - return 0; -} }; -var f8 = { 'a': 0, get "a"() { - return 0; -} }; -var f9 = { 'a': 0, get 'a'() { - return 0; -} }; -var f10 = { "a": 0, get 'a'() { - return 0; -} }; -var f11 = { 1.0: 0, get '1'() { - return 0; -} }; -var f12 = { 0: 0, get 0() { - return 0; -} }; -var f13 = { 0: 0, get 0() { - return 0; -} }; -var f14 = { 0: 0, get 0x0() { - return 0; -} }; -var f14 = { 0: 0, get 000() { - return 0; -} }; -var f15 = { "100": 0, get 1e2() { - return 0; -} }; -var f16 = { 0x20: 0, get 3.2e1() { - return 0; -} }; -var f17 = { a: 0, get b() { - return 1; -}, get a() { - return 0; -} }; +var f1 = { a: 0, get a() { return 0; } }; +var f2 = { a: '', get a() { return ''; } }; +var f3 = { a: 0, get a() { return ''; } }; +var f4 = { a: true, get a() { return false; } }; +var f5 = { a: {}, get a() { return {}; } }; +var f6 = { a: 0, get 'a'() { return 0; } }; +var f7 = { 'a': 0, get a() { return 0; } }; +var f8 = { 'a': 0, get "a"() { return 0; } }; +var f9 = { 'a': 0, get 'a'() { return 0; } }; +var f10 = { "a": 0, get 'a'() { return 0; } }; +var f11 = { 1.0: 0, get '1'() { return 0; } }; +var f12 = { 0: 0, get 0() { return 0; } }; +var f13 = { 0: 0, get 0() { return 0; } }; +var f14 = { 0: 0, get 0x0() { return 0; } }; +var f14 = { 0: 0, get 000() { return 0; } }; +var f15 = { "100": 0, get 1e2() { return 0; } }; +var f16 = { 0x20: 0, get 3.2e1() { return 0; } }; +var f17 = { a: 0, get b() { return 1; }, get a() { return 0; } }; // Get and set accessor with mismatched type annotations -var g1 = { get a() { - return 4; -}, set a(n) { } }; -var g2 = { get a() { - return 4; -}, set a(n) { } }; -var g3 = { get a() { - return undefined; -}, set a(n) { } }; +var g1 = { get a() { return 4; }, set a(n) { } }; +var g2 = { get a() { return 4; }, set a(n) { } }; +var g3 = { get a() { return undefined; }, set a(n) { } }; diff --git a/tests/baselines/reference/objectLiteralErrorsES3.js b/tests/baselines/reference/objectLiteralErrorsES3.js index 6543827d9f3..031a68fd109 100644 --- a/tests/baselines/reference/objectLiteralErrorsES3.js +++ b/tests/baselines/reference/objectLiteralErrorsES3.js @@ -7,10 +7,6 @@ var e3 = { get a() { return ''; }, set a(n) { } }; //// [objectLiteralErrorsES3.js] -var e1 = { get a() { - return 4; -} }; +var e1 = { get a() { return 4; } }; var e2 = { set a(n) { } }; -var e3 = { get a() { - return ''; -}, set a(n) { } }; +var e3 = { get a() { return ''; }, set a(n) { } }; diff --git a/tests/baselines/reference/objectLiteralGettersAndSetters.js b/tests/baselines/reference/objectLiteralGettersAndSetters.js index bd261697d5f..d226c2c5569 100644 --- a/tests/baselines/reference/objectLiteralGettersAndSetters.js +++ b/tests/baselines/reference/objectLiteralGettersAndSetters.js @@ -85,62 +85,24 @@ var getParamType3 = { //// [objectLiteralGettersAndSetters.js] // Get and set accessor with the same name -var sameName1a = { get 'a'() { - return ''; -}, set a(n) { - var p = n; - var p; -} }; -var sameName2a = { get 0.0() { - return ''; -}, set 0(n) { - var p = n; - var p; -} }; -var sameName3a = { get 0x20() { - return ''; -}, set 3.2e1(n) { - var p = n; - var p; -} }; -var sameName4a = { get ''() { - return ''; -}, set ""(n) { - var p = n; - var p; -} }; -var sameName5a = { get '\t'() { - return ''; -}, set '\t'(n) { - var p = n; - var p; -} }; -var sameName6a = { get 'a'() { - return ''; -}, set a(n) { - var p = n; - var p; -} }; +var sameName1a = { get 'a'() { return ''; }, set a(n) { var p = n; var p; } }; +var sameName2a = { get 0.0() { return ''; }, set 0(n) { var p = n; var p; } }; +var sameName3a = { get 0x20() { return ''; }, set 3.2e1(n) { var p = n; var p; } }; +var sameName4a = { get ''() { return ''; }, set ""(n) { var p = n; var p; } }; +var sameName5a = { get '\t'() { return ''; }, set '\t'(n) { var p = n; var p; } }; +var sameName6a = { get 'a'() { return ''; }, set a(n) { var p = n; var p; } }; // PropertyName CallSignature{FunctionBody} is equivalent to PropertyName:function CallSignature{FunctionBody} -var callSig1 = { num: function (n) { - return ''; -} }; +var callSig1 = { num: function (n) { return ''; } }; var callSig1; -var callSig2 = { num: function (n) { - return ''; -} }; +var callSig2 = { num: function (n) { return ''; } }; var callSig2; var callSig3 = { num: function (n) { return ''; } }; var callSig3; // Get accessor only, type of the property is the annotated return type of the get accessor -var getter1 = { get x() { - return undefined; -} }; +var getter1 = { get x() { return undefined; } }; var getter1; // Get accessor only, type of the property is the inferred return type of the get accessor -var getter2 = { get x() { - return ''; -} }; +var getter2 = { get x() { return ''; } }; var getter2; // Set accessor only, type of the property is the param type of the set accessor var setter1 = { set x(n) { } }; @@ -150,18 +112,10 @@ var setter2 = { set x(n) { } }; var setter2; var anyVar; // Get and set accessor with matching type annotations -var sameType1 = { get x() { - return undefined; -}, set x(n) { } }; -var sameType2 = { get x() { - return undefined; -}, set x(n) { } }; -var sameType3 = { get x() { - return undefined; -}, set x(n) { } }; -var sameType4 = { get x() { - return undefined; -}, set x(n) { } }; +var sameType1 = { get x() { return undefined; }, set x(n) { } }; +var sameType2 = { get x() { return undefined; }, set x(n) { } }; +var sameType3 = { get x() { return undefined; }, set x(n) { } }; +var sameType4 = { get x() { return undefined; }, set x(n) { } }; // Type of unannotated get accessor return type is the type annotation of the set accessor param var setParamType1 = { set n(x) { }, @@ -187,14 +141,10 @@ var getParamType1 = { var y = x; var y; }, - get n() { - return ''; - } + get n() { return ''; } }; var getParamType2 = { - get n() { - return ''; - }, + get n() { return ''; }, set n(x) { var y = x; var y; @@ -202,9 +152,7 @@ var getParamType2 = { }; // Type of unannotated accessors is the inferred return type of the get accessor var getParamType3 = { - get n() { - return ''; - }, + get n() { return ''; }, set n(x) { var y = x; var y; diff --git a/tests/baselines/reference/objectLiteralMemberWithoutBlock1.js b/tests/baselines/reference/objectLiteralMemberWithoutBlock1.js index 2ad13950b14..d6a8579be04 100644 --- a/tests/baselines/reference/objectLiteralMemberWithoutBlock1.js +++ b/tests/baselines/reference/objectLiteralMemberWithoutBlock1.js @@ -2,5 +2,4 @@ var v = { foo(); } //// [objectLiteralMemberWithoutBlock1.js] -var v = { foo: function () { -} }; +var v = { foo: function () { } }; diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignment.js b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignment.js index c000a30181d..251098eb6c8 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignment.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignment.js @@ -20,15 +20,9 @@ var name = "my name"; var person = { name: name, id: id }; function foo(obj) { } ; -function bar(name, id) { - return { name: name, id: id }; -} -function bar1(name, id) { - return { name: name }; -} -function baz(name, id) { - return { name: name, id: id }; -} +function bar(name, id) { return { name: name, id: id }; } +function bar1(name, id) { return { name: name }; } +function baz(name, id) { return { name: name, id: id }; } foo(person); var person1 = bar("Hello", 5); var person2 = bar("Hello", 5); diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentES6.js b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentES6.js index ee99de6d470..247ec56d127 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentES6.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentES6.js @@ -20,15 +20,9 @@ var name = "my name"; var person = { name, id }; function foo(obj) { } ; -function bar(name, id) { - return { name, id }; -} -function bar1(name, id) { - return { name }; -} -function baz(name, id) { - return { name, id }; -} +function bar(name, id) { return { name, id }; } +function bar1(name, id) { return { name }; } +function baz(name, id) { return { name, id }; } foo(person); var person1 = bar("Hello", 5); var person2 = bar("Hello", 5); diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.js b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.js index 1bef1cc9554..8e2d7f80356 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.js @@ -16,8 +16,6 @@ var name = "my name"; var person = { name: name, id: id }; // error var person1 = name, id; ; // error: can't use short-hand property assignment in type position -function foo(name, id) { - return { name: name, id: id }; -} // error +function foo(name, id) { return { name: name, id: id }; } // error function bar(obj) { } bar({ name: name, id: id }); // error diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.js b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.js index b008644116b..71449746add 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.js @@ -12,12 +12,8 @@ var person2: { name: string, id: number } = bar("hello", 5); var id = 10000; var name = "my name"; var person = { name: name, id: id }; // error -function bar(name, id) { - return { name: name, id: id }; -} // error -function foo(name, id) { - return { name: name, id: id }; -} // error +function bar(name, id) { return { name: name, id: id }; } // error +function foo(name, id) { return { name: name, id: id }; } // error var person1 = name, id; ; // error : Can't use shorthand in the type position var person2 = bar("hello", 5); diff --git a/tests/baselines/reference/objectLiteralWithSemicolons4.js b/tests/baselines/reference/objectLiteralWithSemicolons4.js index 9e1e3dea4b9..a01d52548ee 100644 --- a/tests/baselines/reference/objectLiteralWithSemicolons4.js +++ b/tests/baselines/reference/objectLiteralWithSemicolons4.js @@ -5,5 +5,4 @@ var v = { //// [objectLiteralWithSemicolons4.js] var v = { - a: -}; + a: }; diff --git a/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.js b/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.js index 9c327ca3a38..7a2b5e2ec2f 100644 --- a/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.js +++ b/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.js @@ -29,9 +29,7 @@ i = o; // error var C = (function () { function C() { } - C.prototype.toString = function () { - return 1; - }; + C.prototype.toString = function () { return 1; }; return C; })(); var c; diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignatures.js b/tests/baselines/reference/objectTypesIdentityWithCallSignatures.js index 21cfc280500..0c6952291f9 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignatures.js +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignatures.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return ''; -} }; +var b = { foo: function (x) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.js b/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.js index 0c7e54ded21..43473d88e0a 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.js +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return ''; -} }; +var b = { foo: function (x) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.js b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.js index 434d1cdd31e..498867f0a02 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.js +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return ''; -} }; +var b = { foo: function (x) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.js b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.js index 52dc447f5fb..54400ad81d1 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.js +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.js @@ -121,32 +121,24 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; var b = { - foo: function (x) { - return ''; - } + foo: function (x) { return ''; } }; function foo1(x) { } function foo1b(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.js b/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.js index b3381ac5825..87067b6be28 100644 --- a/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.js +++ b/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.js @@ -91,9 +91,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return ''; -} }; // not a construct signature, function called new +var b = { new: function (x) { return ''; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.js b/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.js index 0010d8815b4..c95159ed997 100644 --- a/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.js +++ b/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.js @@ -91,9 +91,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return ''; -} }; // not a construct signature, function called new +var b = { new: function (x) { return ''; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.js index cc17fcbeaf3..c8bed1a47ab 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return x; -} }; +var b = { foo: function (x) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.js index 0dc2c18d491..6ef5d15fd98 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var a; -var b = { foo: function (x, y) { - return x; -} }; +var b = { foo: function (x, y) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.js index b0652b29b7f..2b83064afed 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return ''; -} }; +var b = { foo: function (x) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.js index 3486157840c..1f9c5fa5256 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.js @@ -121,39 +121,29 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var D = (function () { function D() { } - D.prototype.foo = function (x, y) { - return null; - }; + D.prototype.foo = function (x, y) { return null; }; return D; })(); var a; -var b = { foo: function (x, y) { - return ''; -} }; +var b = { foo: function (x, y) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.js index 714e7dbf142..21106b56b00 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.js @@ -140,39 +140,29 @@ var Two = (function () { var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var D = (function () { function D() { } - D.prototype.foo = function (x, y) { - return null; - }; + D.prototype.foo = function (x, y) { return null; }; return D; })(); var a; -var b = { foo: function (x, y) { - return ''; -} }; +var b = { foo: function (x, y) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.js index e1940c41587..99188347d36 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return null; -} }; +var b = { foo: function (x) { return null; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.js index b4eaf096ec8..10d72bde0b3 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return null; -} }; +var b = { foo: function (x) { return null; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.js index 2c9ad2767d9..5a20dfdecb6 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return x; -} }; +var b = { foo: function (x) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.js index 3e98e5887a9..ec9c786b890 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return x; -} }; +var b = { foo: function (x) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.js index 36d17758c94..a4af2bc820e 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var a; -var b = { foo: function (x, y) { - return x; -} }; +var b = { foo: function (x, y) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.js index 4e58adda1c4..28b2f978b55 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var a; -var b = { foo: function (x, y) { - return x; -} }; +var b = { foo: function (x, y) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.js index 71842d18781..de9b4859fa1 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var a; -var b = { foo: function (x, y) { - return x; -} }; +var b = { foo: function (x, y) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.js index 6183be4fb69..fdc67d4b84a 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.js @@ -92,9 +92,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return ''; -} }; // not a construct signature, function called new +var b = { new: function (x) { return ''; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.js index 59a801134d4..11dcdf0a609 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.js @@ -109,9 +109,7 @@ var D = (function () { return D; })(); var a; -var b = { new: function (x, y) { - return ''; -} }; // not a construct signature, function called new +var b = { new: function (x, y) { return ''; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.js index d61edd07382..5c6f59eef24 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.js @@ -128,9 +128,7 @@ var D = (function () { return D; })(); var a; -var b = { new: function (x, y) { - return ''; -} }; // not a construct signature, function called new +var b = { new: function (x, y) { return ''; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.js index b390f7a933b..556d1bcaee0 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.js @@ -99,9 +99,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return null; -} }; // not a construct signature, function called new +var b = { new: function (x) { return null; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.js index d22cc6b254e..68c32cb0e71 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.js @@ -95,9 +95,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return null; -} }; // not a construct signature, function called new +var b = { new: function (x) { return null; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.js index 99d3f8287df..789e02d2d7b 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.js @@ -87,9 +87,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return x; -} }; +var b = { new: function (x) { return x; } }; function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.js index cd77c1ee3d1..5a501d05834 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.js @@ -87,9 +87,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return new C(x); -} }; +var b = { new: function (x) { return new C(x); } }; function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.js index 72b8e7c8d8f..685a8441d97 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.js @@ -91,9 +91,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x, y) { - return new C(x, y); -} }; // not a construct signature, function called new +var b = { new: function (x, y) { return new C(x, y); } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.js index 1c781f299ce..f16d69acaa1 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.js @@ -91,9 +91,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x, y) { - return new C(x, y); -} }; // not a construct signature, function called new +var b = { new: function (x, y) { return new C(x, y); } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.js index 8c5aca3cb1c..25c628e9e15 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.js @@ -91,9 +91,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x, y) { - return new C(x, y); -} }; // not a construct signature, function called new +var b = { new: function (x, y) { return new C(x, y); } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesWithOptionalProperties2.js b/tests/baselines/reference/objectTypesWithOptionalProperties2.js index 7a237223d7c..cf0d113c244 100644 --- a/tests/baselines/reference/objectTypesWithOptionalProperties2.js +++ b/tests/baselines/reference/objectTypesWithOptionalProperties2.js @@ -42,6 +42,5 @@ var C2 = (function () { return C2; })(); var b = { - x: function () { }, - 1: // error + x: function () { }, 1: // error }; diff --git a/tests/baselines/reference/optionalAccessorsInInterface1.js b/tests/baselines/reference/optionalAccessorsInInterface1.js index 3ebccc2ea8e..dd274b133e5 100644 --- a/tests/baselines/reference/optionalAccessorsInInterface1.js +++ b/tests/baselines/reference/optionalAccessorsInInterface1.js @@ -17,9 +17,5 @@ defineMyProperty2({}, "name", { get: function () { return 5; } }); //// [optionalAccessorsInInterface1.js] -defineMyProperty({}, "name", { get: function () { - return 5; -} }); -defineMyProperty2({}, "name", { get: function () { - return 5; -} }); +defineMyProperty({}, "name", { get: function () { return 5; } }); +defineMyProperty2({}, "name", { get: function () { return 5; } }); diff --git a/tests/baselines/reference/optionalFunctionArgAssignability.js b/tests/baselines/reference/optionalFunctionArgAssignability.js index bca42060066..c82a47e88da 100644 --- a/tests/baselines/reference/optionalFunctionArgAssignability.js +++ b/tests/baselines/reference/optionalFunctionArgAssignability.js @@ -9,10 +9,6 @@ a = b; // error because number is not assignable to string //// [optionalFunctionArgAssignability.js] -var a = function then(onFulfill, onReject) { - return null; -}; -var b = function then(onFulFill, onReject) { - return null; -}; +var a = function then(onFulfill, onReject) { return null; }; +var b = function then(onFulFill, onReject) { return null; }; a = b; // error because number is not assignable to string diff --git a/tests/baselines/reference/optionalParamArgsTest.js b/tests/baselines/reference/optionalParamArgsTest.js index 6f9b97036ed..202439bc79a 100644 --- a/tests/baselines/reference/optionalParamArgsTest.js +++ b/tests/baselines/reference/optionalParamArgsTest.js @@ -139,12 +139,8 @@ var C1 = (function () { if (p === void 0) { p = 0; } this.n = 0; } - C1.prototype.C1M1 = function () { - return 0; - }; // returning C1M1A1 will result in "Unresolved symbol C1M1A1" - C1.prototype.C1M2 = function (C1M2A1) { - return C1M2A1; - }; // will return C1M1A2 without complaint + C1.prototype.C1M1 = function () { return 0; }; // returning C1M1A1 will result in "Unresolved symbol C1M1A1" + C1.prototype.C1M2 = function (C1M2A1) { return C1M2A1; }; // will return C1M1A2 without complaint // C1M3 contains all optional parameters C1.prototype.C1M3 = function (C1M3A1, C1M3A2) { if (C1M3A1 === void 0) { C1M3A1 = 0; } @@ -152,9 +148,7 @@ var C1 = (function () { return C1M3A1 + C1M3A2; }; // C1M4 contains a mix of optional and non-optional parameters - C1.prototype.C1M4 = function (C1M4A1, C1M4A2) { - return C1M4A1 + C1M4A2; - }; + C1.prototype.C1M4 = function (C1M4A1, C1M4A2) { return C1M4A1 + C1M4A2; }; C1.prototype.C1M5 = function (C1M5A1, C1M5A2, C1M5A3) { if (C1M5A2 === void 0) { C1M5A2 = 0; } return C1M5A1 + C1M5A2; @@ -175,34 +169,22 @@ var C2 = (function (_super) { } return C2; })(C1); -function F1() { - return 0; -} -function F2(F2A1) { - return F2A1; -} +function F1() { return 0; } +function F2(F2A1) { return F2A1; } function F3(F3A1, F3A2) { if (F3A1 === void 0) { F3A1 = 0; } if (F3A2 === void 0) { F3A2 = F3A1; } return F3A1 + F3A2; } -function F4(F4A1, F4A2) { - return F4A1 + F4A2; -} -var L1 = function () { - return 0; -}; -var L2 = function (L2A1) { - return L2A1; -}; +function F4(F4A1, F4A2) { return F4A1 + F4A2; } +var L1 = function () { return 0; }; +var L2 = function (L2A1) { return L2A1; }; var L3 = function (L3A1, L3A2) { if (L3A1 === void 0) { L3A1 = 0; } if (L3A2 === void 0) { L3A2 = L3A1; } return L3A1 + L3A2; }; -var L4 = function (L4A1, L4A2) { - return L4A1 + L4A2; -}; +var L4 = function (L4A1, L4A2) { return L4A1 + L4A2; }; var c1o1 = new C1(5); var i1o1 = new C1(5); // Valid diff --git a/tests/baselines/reference/overloadAssignmentCompat.js b/tests/baselines/reference/overloadAssignmentCompat.js index f6767f6f33e..2d4bd931844 100644 --- a/tests/baselines/reference/overloadAssignmentCompat.js +++ b/tests/baselines/reference/overloadAssignmentCompat.js @@ -65,7 +65,5 @@ function attr2(nameOrMap, value) { return "s"; } } -function foo() { - return "a"; -} +function foo() { return "a"; } ; diff --git a/tests/baselines/reference/overloadCallTest.js b/tests/baselines/reference/overloadCallTest.js index f7eb97fc9eb..38930b7aea3 100644 --- a/tests/baselines/reference/overloadCallTest.js +++ b/tests/baselines/reference/overloadCallTest.js @@ -18,9 +18,7 @@ class foo { //// [overloadCallTest.js] var foo = (function () { function foo() { - function bar(foo) { - return "foo"; - } + function bar(foo) { return "foo"; } ; var test = bar("test"); var goo = bar(); diff --git a/tests/baselines/reference/overloadOnConstNoAnyImplementation2.js b/tests/baselines/reference/overloadOnConstNoAnyImplementation2.js index 6c66c23f1f8..52f6639e352 100644 --- a/tests/baselines/reference/overloadOnConstNoAnyImplementation2.js +++ b/tests/baselines/reference/overloadOnConstNoAnyImplementation2.js @@ -35,15 +35,7 @@ var C = (function () { return C; })(); var c; -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); diff --git a/tests/baselines/reference/overloadOnConstNoStringImplementation2.js b/tests/baselines/reference/overloadOnConstNoStringImplementation2.js index f51f84acb2a..71d7a4e4a3f 100644 --- a/tests/baselines/reference/overloadOnConstNoStringImplementation2.js +++ b/tests/baselines/reference/overloadOnConstNoStringImplementation2.js @@ -34,15 +34,7 @@ var C = (function () { return C; })(); var c; -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); diff --git a/tests/baselines/reference/overloadResolution.js b/tests/baselines/reference/overloadResolution.js index 8737708beda..1ee5e077c08 100644 --- a/tests/baselines/reference/overloadResolution.js +++ b/tests/baselines/reference/overloadResolution.js @@ -127,16 +127,12 @@ var SomeDerived3 = (function (_super) { } return SomeDerived3; })(SomeBase); -function fn1() { - return null; -} +function fn1() { return null; } var s = fn1(undefined); var s; // No candidate overloads found fn1({}); // Error -function fn2() { - return undefined; -} +function fn2() { return undefined; } var d = fn2(0, undefined); var d; // Generic and non - generic overload where generic overload is the only candidate when called without type arguments @@ -145,9 +141,7 @@ var s = fn2(0, ''); fn2('', 0); // Error // Generic and non - generic overload where non - generic overload is the only candidate when called without type arguments fn2('', 0); // OK -function fn3() { - return null; -} +function fn3() { return null; } var s = fn3(3); var s = fn3('', 3, ''); var n = fn3(5, 5, 5); @@ -173,8 +167,6 @@ fn4(null, null); // Error // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints fn4(true, null); // Error fn4(null, true); // Error -function fn5() { - return undefined; -} +function fn5() { return undefined; } var n = fn5(function (n) { return n.toFixed(); }); var s = fn5(function (n) { return n.substr(0); }); diff --git a/tests/baselines/reference/overloadResolutionOverNonCTLambdas.js b/tests/baselines/reference/overloadResolutionOverNonCTLambdas.js index 86e84ced58f..e77e8d3371f 100644 --- a/tests/baselines/reference/overloadResolutionOverNonCTLambdas.js +++ b/tests/baselines/reference/overloadResolutionOverNonCTLambdas.js @@ -48,13 +48,7 @@ var Bugs; return result; } })(Bugs || (Bugs = {})); -function bug3(f) { - return f("s"); -} -function fprime(x) { - return x; -} +function bug3(f) { return f("s"); } +function fprime(x) { return x; } bug3(fprime); -bug3(function (x) { - return x; -}); +bug3(function (x) { return x; }); diff --git a/tests/baselines/reference/overloadResolutionTest1.js b/tests/baselines/reference/overloadResolutionTest1.js index a08243fb27a..60b99ebf7b9 100644 --- a/tests/baselines/reference/overloadResolutionTest1.js +++ b/tests/baselines/reference/overloadResolutionTest1.js @@ -26,23 +26,17 @@ function foo4(bar:{a:any;}):any{ return bar }; var x = foo4({a:true}); // error //// [overloadResolutionTest1.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } ; var x1 = foo([{ a: true }]); // works var x11 = foo([{ a: 0 }]); // works var x111 = foo([{ a: "s" }]); // error - does not match any signature var x1111 = foo([{ a: null }]); // works - ambiguous call is resolved to be the first in the overload set so this returns a string -function foo2(bar) { - return bar; -} +function foo2(bar) { return bar; } ; var x2 = foo2({ a: 0 }); // works var x3 = foo2({ a: true }); // works var x4 = foo2({ a: "s" }); // error -function foo4(bar) { - return bar; -} +function foo4(bar) { return bar; } ; var x = foo4({ a: true }); // error diff --git a/tests/baselines/reference/parameterInitializersForwardReferencing.js b/tests/baselines/reference/parameterInitializersForwardReferencing.js index d810db54695..8ce7fae6874 100644 --- a/tests/baselines/reference/parameterInitializersForwardReferencing.js +++ b/tests/baselines/reference/parameterInitializersForwardReferencing.js @@ -92,8 +92,6 @@ var x = function (a, b, c) { }; // Should not produce errors - can reference later parameters if they occur within a function expression initializer. function f(a, b, c) { - if (b === void 0) { b = function () { - return c; - }; } + if (b === void 0) { b = function () { return c; }; } if (c === void 0) { c = b(); } } diff --git a/tests/baselines/reference/parametersWithNoAnnotationAreAny.js b/tests/baselines/reference/parametersWithNoAnnotationAreAny.js index 48f8d3e520c..a8d06125d25 100644 --- a/tests/baselines/reference/parametersWithNoAnnotationAreAny.js +++ b/tests/baselines/reference/parametersWithNoAnnotationAreAny.js @@ -30,12 +30,8 @@ var b = { } //// [parametersWithNoAnnotationAreAny.js] -function foo(x) { - return x; -} -var f = function foo(x) { - return x; -}; +function foo(x) { return x; } +var f = function foo(x) { return x; }; var f2 = function (x) { return x; }; var f3 = function (x) { return x; }; var C = (function () { diff --git a/tests/baselines/reference/parenthesizedContexualTyping2.js b/tests/baselines/reference/parenthesizedContexualTyping2.js index d5e4e0ebe8f..993a10ba49c 100644 --- a/tests/baselines/reference/parenthesizedContexualTyping2.js +++ b/tests/baselines/reference/parenthesizedContexualTyping2.js @@ -49,80 +49,20 @@ function fun() { } return undefined; } -var a = fun(function (x) { - x(undefined); - return x; -}, 10); -var b = fun((function (x) { - x(undefined); - return x; -}), 10); -var c = fun(((function (x) { - x(undefined); - return x; -})), 10); -var d = fun((((function (x) { - x(undefined); - return x; -}))), 10); -var e = fun(function (x) { - x(undefined); - return x; -}, function (x) { - x(undefined); - return x; -}, 10); -var f = fun((function (x) { - x(undefined); - return x; -}), (function (x) { - x(undefined); - return x; -}), 10); -var g = fun(((function (x) { - x(undefined); - return x; -})), ((function (x) { - x(undefined); - return x; -})), 10); -var h = fun((((function (x) { - x(undefined); - return x; -}))), ((function (x) { - x(undefined); - return x; -})), 10); +var a = fun(function (x) { x(undefined); return x; }, 10); +var b = fun((function (x) { x(undefined); return x; }), 10); +var c = fun(((function (x) { x(undefined); return x; })), 10); +var d = fun((((function (x) { x(undefined); return x; }))), 10); +var e = fun(function (x) { x(undefined); return x; }, function (x) { x(undefined); return x; }, 10); +var f = fun((function (x) { x(undefined); return x; }), (function (x) { x(undefined); return x; }), 10); +var g = fun(((function (x) { x(undefined); return x; })), ((function (x) { x(undefined); return x; })), 10); +var h = fun((((function (x) { x(undefined); return x; }))), ((function (x) { x(undefined); return x; })), 10); // Ternaries in parens -var i = fun((Math.random() < 0.5 ? function (x) { - x(undefined); - return x; -} : function (x) { return undefined; }), 10); -var j = fun((Math.random() < 0.5 ? (function (x) { - x(undefined); - return x; -}) : (function (x) { return undefined; })), 10); -var k = fun((Math.random() < 0.5 ? (function (x) { - x(undefined); - return x; -}) : (function (x) { return undefined; })), function (x) { - x(undefined); - return x; -}, 10); -var l = fun(((Math.random() < 0.5 ? ((function (x) { - x(undefined); - return x; -})) : ((function (x) { return undefined; })))), ((function (x) { - x(undefined); - return x; -})), 10); -var lambda1 = function (x) { - x(undefined); - return x; -}; -var lambda2 = (function (x) { - x(undefined); - return x; -}); +var i = fun((Math.random() < 0.5 ? function (x) { x(undefined); return x; } : function (x) { return undefined; }), 10); +var j = fun((Math.random() < 0.5 ? (function (x) { x(undefined); return x; }) : (function (x) { return undefined; })), 10); +var k = fun((Math.random() < 0.5 ? (function (x) { x(undefined); return x; }) : (function (x) { return undefined; })), function (x) { x(undefined); return x; }, 10); +var l = fun(((Math.random() < 0.5 ? ((function (x) { x(undefined); return x; })) : ((function (x) { return undefined; })))), ((function (x) { x(undefined); return x; })), 10); +var lambda1 = function (x) { x(undefined); return x; }; +var lambda2 = (function (x) { x(undefined); return x; }); var obj1 = { x: function (x) { return (x, undefined); }, y: function (y) { return (y, undefined); } }; var obj2 = ({ x: function (x) { return (x, undefined); }, y: function (y) { return (y, undefined); } }); diff --git a/tests/baselines/reference/parseTypes.js b/tests/baselines/reference/parseTypes.js index 193533de04a..08cc9f2a6bd 100644 --- a/tests/baselines/reference/parseTypes.js +++ b/tests/baselines/reference/parseTypes.js @@ -18,13 +18,9 @@ var x = null; var y = null; var z = null; var w = null; -function f() { - return 3; -} +function f() { return 3; } ; -function g(s) { - true; -} +function g(s) { true; } ; y = f; y = g; diff --git a/tests/baselines/reference/parser15.4.4.14-9-2.js b/tests/baselines/reference/parser15.4.4.14-9-2.js index 9680dbff36b..0f533cd9a26 100644 --- a/tests/baselines/reference/parser15.4.4.14-9-2.js +++ b/tests/baselines/reference/parser15.4.4.14-9-2.js @@ -37,13 +37,14 @@ runTestCase(testcase); * @description Array.prototype.indexOf must return correct index (Number) */ function testcase() { - var obj = { toString: function () { - return 0; - } }; + var obj = { toString: function () { return 0; } }; var one = 1; var _float = -(4 / 3); var a = new Array(false, undefined, null, "0", obj, -1.3333333333333, "str", -0, true, +0, one, 1, 0, false, _float, -(4 / 3)); - if (a.indexOf(-(4 / 3)) === 14 && a.indexOf(0) === 7 && a.indexOf(-0) === 7 && a.indexOf(1) === 10) { + if (a.indexOf(-(4 / 3)) === 14 && + a.indexOf(0) === 7 && + a.indexOf(-0) === 7 && + a.indexOf(1) === 10) { return true; } } diff --git a/tests/baselines/reference/parserClass1.js b/tests/baselines/reference/parserClass1.js index 1245da3363f..eb1d17566aa 100644 --- a/tests/baselines/reference/parserClass1.js +++ b/tests/baselines/reference/parserClass1.js @@ -13,21 +13,11 @@ var NullLogger = (function () { function NullLogger() { } - NullLogger.prototype.information = function () { - return false; - }; - NullLogger.prototype.debug = function () { - return false; - }; - NullLogger.prototype.warning = function () { - return false; - }; - NullLogger.prototype.error = function () { - return false; - }; - NullLogger.prototype.fatal = function () { - return false; - }; + NullLogger.prototype.information = function () { return false; }; + NullLogger.prototype.debug = function () { return false; }; + NullLogger.prototype.warning = function () { return false; }; + NullLogger.prototype.error = function () { return false; }; + NullLogger.prototype.fatal = function () { return false; }; NullLogger.prototype.log = function (s) { }; return NullLogger; diff --git a/tests/baselines/reference/parserComputedPropertyName10.errors.txt b/tests/baselines/reference/parserComputedPropertyName10.errors.txt index 061e2c40c2d..a9b5396781a 100644 --- a/tests/baselines/reference/parserComputedPropertyName10.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName10.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e] = 1 ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName11.errors.txt b/tests/baselines/reference/parserComputedPropertyName11.errors.txt index 65748f72b24..2a7a606f4bf 100644 --- a/tests/baselines/reference/parserComputedPropertyName11.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts(2,4): error TS1168: Computed property names are not allowed in method overloads. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts(2,4): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e](); ~~~ -!!! error TS1168: Computed property names are not allowed in method overloads. +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName13.errors.txt b/tests/baselines/reference/parserComputedPropertyName13.errors.txt index b209f3c7d01..a7a77cf1244 100644 --- a/tests/baselines/reference/parserComputedPropertyName13.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName13.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts (2 errors) ==== var v: { [e]: number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName14.errors.txt b/tests/baselines/reference/parserComputedPropertyName14.errors.txt index 6ac2d276a80..50a6d1bc689 100644 --- a/tests/baselines/reference/parserComputedPropertyName14.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName14.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts (2 errors) ==== var v: { [e](): number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName15.errors.txt b/tests/baselines/reference/parserComputedPropertyName15.errors.txt index f66e5930c26..9635178af16 100644 --- a/tests/baselines/reference/parserComputedPropertyName15.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName15.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts(1,31): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts(1,31): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts(1,32): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts (2 errors) ==== var v: { [e: number]: string; [e]: number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName18.errors.txt b/tests/baselines/reference/parserComputedPropertyName18.errors.txt index f7485a127cb..9e64ddd0d28 100644 --- a/tests/baselines/reference/parserComputedPropertyName18.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName18.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts (2 errors) ==== var v: { [e]?(): number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName19.errors.txt b/tests/baselines/reference/parserComputedPropertyName19.errors.txt index 65c22ff36c3..86bb591011e 100644 --- a/tests/baselines/reference/parserComputedPropertyName19.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName19.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts (2 errors) ==== var v: { [e]? }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName20.errors.txt b/tests/baselines/reference/parserComputedPropertyName20.errors.txt index d65dfede1d2..035e494af33 100644 --- a/tests/baselines/reference/parserComputedPropertyName20.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName20.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP interface I { [e](): number ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName21.errors.txt b/tests/baselines/reference/parserComputedPropertyName21.errors.txt index 5a9738a23a6..4ebc321cc80 100644 --- a/tests/baselines/reference/parserComputedPropertyName21.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName21.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP interface I { [e]: number ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName22.errors.txt b/tests/baselines/reference/parserComputedPropertyName22.errors.txt index ce20dd0c587..fd9e3797018 100644 --- a/tests/baselines/reference/parserComputedPropertyName22.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName22.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP declare class C { [e]: number ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName25.errors.txt b/tests/baselines/reference/parserComputedPropertyName25.errors.txt index 8d26c8afdb7..0d0a2a8d833 100644 --- a/tests/baselines/reference/parserComputedPropertyName25.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName25.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(3,6): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(4,6): error TS2304: Cannot find name 'e2'. @@ -8,7 +8,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP // No ASI [e] = 0 ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. [e2] = 1 diff --git a/tests/baselines/reference/parserComputedPropertyName28.errors.txt b/tests/baselines/reference/parserComputedPropertyName28.errors.txt index c522ec031eb..a84f3b7d16b 100644 --- a/tests/baselines/reference/parserComputedPropertyName28.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName28.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(2,6): error TS2304: Cannot find name 'e'. -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(3,6): error TS2304: Cannot find name 'e2'. @@ -8,12 +8,12 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e]: number = 0; ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. [e2]: number ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~~ !!! error TS2304: Cannot find name 'e2'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName29.errors.txt b/tests/baselines/reference/parserComputedPropertyName29.errors.txt index 5e6baed0f06..3d886eacc50 100644 --- a/tests/baselines/reference/parserComputedPropertyName29.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName29.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,6): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,11): error TS2304: Cannot find name 'id'. -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(4,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(4,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(4,6): error TS2304: Cannot find name 'e2'. @@ -10,14 +10,14 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP // yes ASI [e] = id++ ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. ~~ !!! error TS2304: Cannot find name 'id'. [e2]: number ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~~ !!! error TS2304: Cannot find name 'e2'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName31.errors.txt b/tests/baselines/reference/parserComputedPropertyName31.errors.txt index 97a3b1ee187..4661b0797af 100644 --- a/tests/baselines/reference/parserComputedPropertyName31.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName31.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(3,6): error TS2304: Cannot find name 'e'. -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(4,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(4,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(4,6): error TS2304: Cannot find name 'e2'. @@ -9,12 +9,12 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP // yes ASI [e]: number ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. [e2]: number ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~~ !!! error TS2304: Cannot find name 'e2'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName32.errors.txt b/tests/baselines/reference/parserComputedPropertyName32.errors.txt index da423baaa05..4be8d70383e 100644 --- a/tests/baselines/reference/parserComputedPropertyName32.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName32.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts(2,5): error TS1165: Computed property names are not allowed in an ambient context. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts(2,5): error TS1165: A computed property name in an ambient context must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP declare class C { [e](): number ~~~ -!!! error TS1165: Computed property names are not allowed in an ambient context. +!!! error TS1165: A computed property name in an ambient context must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName36.errors.txt b/tests/baselines/reference/parserComputedPropertyName36.errors.txt index 1b4130b0e27..07e937b3b42 100644 --- a/tests/baselines/reference/parserComputedPropertyName36.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName36.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts(2,6): error TS2304: Cannot find name 'public'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [public ]: string; ~~~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~~~~~~ !!! error TS2304: Cannot find name 'public'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName41.errors.txt b/tests/baselines/reference/parserComputedPropertyName41.errors.txt index 65d4ec8627f..5389b187cad 100644 --- a/tests/baselines/reference/parserComputedPropertyName41.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName41.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts (1 errors) ==== var v = { [0 in []]: true ~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName7.errors.txt b/tests/baselines/reference/parserComputedPropertyName7.errors.txt index bcf39b0ca0a..056fa3d82fd 100644 --- a/tests/baselines/reference/parserComputedPropertyName7.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName7.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e] ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName8.errors.txt b/tests/baselines/reference/parserComputedPropertyName8.errors.txt index 250c7a52c6e..32bb4906353 100644 --- a/tests/baselines/reference/parserComputedPropertyName8.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName8.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts(2,11): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts(2,11): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts(2,12): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { public [e] ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName9.errors.txt b/tests/baselines/reference/parserComputedPropertyName9.errors.txt index fd434046564..9db0cbde3bd 100644 --- a/tests/baselines/reference/parserComputedPropertyName9.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName9.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,5): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,9): error TS2304: Cannot find name 'Type'. @@ -7,7 +7,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e]: Type ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. ~~~~ diff --git a/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt index 55af923e54b..2c8f1d2ab4f 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput declare class C { [e]: number ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt index 7db85cdef35..31d3f9985ab 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput class C { [e] = 1 ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt index ead27a994d1..b4808607ab0 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts(2,4): error TS1168: Computed property names are not allowed in method overloads. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts(2,4): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput class C { [e](); ~~~ -!!! error TS1168: Computed property names are not allowed in method overloads. +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt index 5918387942d..55176bf76f1 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt @@ -1,10 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts(1,12): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts (1 errors) ==== var v = { [e]: 1 }; - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName2.js b/tests/baselines/reference/parserES5ComputedPropertyName2.js index 861716a3cde..2b39e305e07 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName2.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName2.js @@ -2,4 +2,7 @@ var v = { [e]: 1 }; //// [parserES5ComputedPropertyName2.js] -var v = { [e]: 1 }; +var v = (_a = {}, _a[e] = +1, +_a); +var _a; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt index 097ab1ea9cb..07ea47dd3f0 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt @@ -1,10 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts(1,12): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts (1 errors) ==== var v = { [e]() { } }; - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName3.js b/tests/baselines/reference/parserES5ComputedPropertyName3.js index f83253b531d..3247b0251f1 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName3.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName3.js @@ -2,4 +2,6 @@ var v = { [e]() { } }; //// [parserES5ComputedPropertyName3.js] -var v = { [e]: function () { } }; +var v = (_a = {}, _a[e] = function () { }, +_a); +var _a; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt index ca69791c93c..cfb12152c94 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt @@ -1,13 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,15): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,15): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,16): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts (2 errors) ==== var v = { get [e]() { } }; ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName4.js b/tests/baselines/reference/parserES5ComputedPropertyName4.js index 568b54500ac..436f967e8de 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName4.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName4.js @@ -2,4 +2,6 @@ var v = { get [e]() { } }; //// [parserES5ComputedPropertyName4.js] -var v = { get [e]() { } }; +var v = (_a = {}, _a[e] = Object.defineProperty({ get: function () { }, enumerable: true, configurable: true }), +_a); +var _a; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt index 122ca20a0e4..9125ce7b58f 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput interface I { [e]: number ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt index d38d57d87be..277bdcd3c94 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput class C { [e] ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt index e52727c6929..6b674a1d2c0 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts (2 errors) ==== var v: { [e]: number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt index 8cbe0ffcf8d..fb087a4d82f 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,5): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,9): error TS2304: Cannot find name 'Type'. @@ -7,7 +7,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput class C { [e]: Type ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. ~~~~ diff --git a/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt b/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt new file mode 100644 index 00000000000..9c1a39b1f4a --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts (1 errors) ==== + for (var i of e) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement10.errors.txt b/tests/baselines/reference/parserES5ForOfStatement10.errors.txt new file mode 100644 index 00000000000..d7f411b1879 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement10.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts (1 errors) ==== + for (const v of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement10.js b/tests/baselines/reference/parserES5ForOfStatement10.js new file mode 100644 index 00000000000..2b9dc843887 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement10.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement10.ts] +for (const v of X) { +} + +//// [parserES5ForOfStatement10.js] +for (var v of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement11.errors.txt b/tests/baselines/reference/parserES5ForOfStatement11.errors.txt new file mode 100644 index 00000000000..48805a336c7 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement11.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts (1 errors) ==== + for (const [a, b] of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement11.js b/tests/baselines/reference/parserES5ForOfStatement11.js new file mode 100644 index 00000000000..45a24b109c0 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement11.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement11.ts] +for (const [a, b] of X) { +} + +//// [parserES5ForOfStatement11.js] +for (var _a = void 0, a = _a[0], b = _a[1] of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement12.errors.txt b/tests/baselines/reference/parserES5ForOfStatement12.errors.txt new file mode 100644 index 00000000000..3b9f242b975 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement12.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts (1 errors) ==== + for (const {a, b} of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement12.js b/tests/baselines/reference/parserES5ForOfStatement12.js new file mode 100644 index 00000000000..30beac5118c --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement12.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement12.ts] +for (const {a, b} of X) { +} + +//// [parserES5ForOfStatement12.js] +for (var _a = void 0, a = _a.a, b = _a.b of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement13.errors.txt b/tests/baselines/reference/parserES5ForOfStatement13.errors.txt new file mode 100644 index 00000000000..8b8c8ce0868 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement13.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts (1 errors) ==== + for (let {a, b} of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement13.js b/tests/baselines/reference/parserES5ForOfStatement13.js new file mode 100644 index 00000000000..89706613add --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement13.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement13.ts] +for (let {a, b} of X) { +} + +//// [parserES5ForOfStatement13.js] +for (let _a = void 0, a = _a.a, b = _a.b of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement14.errors.txt b/tests/baselines/reference/parserES5ForOfStatement14.errors.txt new file mode 100644 index 00000000000..dc4db95270a --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement14.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts (1 errors) ==== + for (let [a, b] of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement14.js b/tests/baselines/reference/parserES5ForOfStatement14.js new file mode 100644 index 00000000000..96aa327a625 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement14.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement14.ts] +for (let [a, b] of X) { +} + +//// [parserES5ForOfStatement14.js] +for (let _a = void 0, a = _a[0], b = _a[1] of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement15.errors.txt b/tests/baselines/reference/parserES5ForOfStatement15.errors.txt new file mode 100644 index 00000000000..07aa6dd5b37 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement15.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts (1 errors) ==== + for (var [a, b] of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement15.js b/tests/baselines/reference/parserES5ForOfStatement15.js new file mode 100644 index 00000000000..efca0b289f6 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement15.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement15.ts] +for (var [a, b] of X) { +} + +//// [parserES5ForOfStatement15.js] +for (var _a = void 0, a = _a[0], b = _a[1] of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement16.errors.txt b/tests/baselines/reference/parserES5ForOfStatement16.errors.txt new file mode 100644 index 00000000000..15a3e4f7f0b --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement16.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts (1 errors) ==== + for (var {a, b} of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement16.js b/tests/baselines/reference/parserES5ForOfStatement16.js new file mode 100644 index 00000000000..102e91685c3 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement16.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement16.ts] +for (var {a, b} of X) { +} + +//// [parserES5ForOfStatement16.js] +for (var _a = void 0, a = _a.a, b = _a.b of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement17.js b/tests/baselines/reference/parserES5ForOfStatement17.js new file mode 100644 index 00000000000..7995c4c689e --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement17.js @@ -0,0 +1,5 @@ +//// [parserES5ForOfStatement17.ts] +for (var of; ;) { } + +//// [parserES5ForOfStatement17.js] +for (var of;;) { } diff --git a/tests/baselines/reference/parserES5ForOfStatement17.types b/tests/baselines/reference/parserES5ForOfStatement17.types new file mode 100644 index 00000000000..5dd0f6e9b93 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement17.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement17.ts === +for (var of; ;) { } +>of : any + diff --git a/tests/baselines/reference/parserES5ForOfStatement18.errors.txt b/tests/baselines/reference/parserES5ForOfStatement18.errors.txt new file mode 100644 index 00000000000..fc314e51012 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement18.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts (1 errors) ==== + for (var of of of) { } + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement18.js b/tests/baselines/reference/parserES5ForOfStatement18.js new file mode 100644 index 00000000000..1df3e0bed7b --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement18.js @@ -0,0 +1,5 @@ +//// [parserES5ForOfStatement18.ts] +for (var of of of) { } + +//// [parserES5ForOfStatement18.js] +for (var of of of) { } diff --git a/tests/baselines/reference/parserES5ForOfStatement19.js b/tests/baselines/reference/parserES5ForOfStatement19.js new file mode 100644 index 00000000000..7ed0d5a333a --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement19.js @@ -0,0 +1,5 @@ +//// [parserES5ForOfStatement19.ts] +for (var of in of) { } + +//// [parserES5ForOfStatement19.js] +for (var of in of) { } diff --git a/tests/baselines/reference/parserES5ForOfStatement19.types b/tests/baselines/reference/parserES5ForOfStatement19.types new file mode 100644 index 00000000000..13abc7ae757 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement19.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts === +for (var of in of) { } +>of : any +>of : any + diff --git a/tests/baselines/reference/parserES5ForOfStatement2.errors.txt b/tests/baselines/reference/parserES5ForOfStatement2.errors.txt new file mode 100644 index 00000000000..347ae29ddb8 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement2.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts (1 errors) ==== + for (var of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement2.js b/tests/baselines/reference/parserES5ForOfStatement2.js new file mode 100644 index 00000000000..dfcfb476172 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement2.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement2.ts] +for (var of X) { +} + +//// [parserES5ForOfStatement2.js] +for ( of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement20.errors.txt b/tests/baselines/reference/parserES5ForOfStatement20.errors.txt new file mode 100644 index 00000000000..4aee32394b6 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement20.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts(1,10): error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts (1 errors) ==== + for (var of = 0 in of) { } + ~~ +!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement20.js b/tests/baselines/reference/parserES5ForOfStatement20.js new file mode 100644 index 00000000000..c51cbbc2a3a --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement20.js @@ -0,0 +1,5 @@ +//// [parserES5ForOfStatement20.ts] +for (var of = 0 in of) { } + +//// [parserES5ForOfStatement20.js] +for (var of = 0 in of) { } diff --git a/tests/baselines/reference/parserES5ForOfStatement21.errors.txt b/tests/baselines/reference/parserES5ForOfStatement21.errors.txt new file mode 100644 index 00000000000..2ddbf4b5666 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement21.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts (1 errors) ==== + for (var of of) { } + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement21.js b/tests/baselines/reference/parserES5ForOfStatement21.js new file mode 100644 index 00000000000..e02ed853cb5 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement21.js @@ -0,0 +1,5 @@ +//// [parserES5ForOfStatement21.ts] +for (var of of) { } + +//// [parserES5ForOfStatement21.js] +for ( of of) { } diff --git a/tests/baselines/reference/parserES5ForOfStatement3.errors.txt b/tests/baselines/reference/parserES5ForOfStatement3.errors.txt new file mode 100644 index 00000000000..553ca40aee0 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement3.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts (1 errors) ==== + for (var a, b of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement3.js b/tests/baselines/reference/parserES5ForOfStatement3.js new file mode 100644 index 00000000000..64892eb5094 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement3.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement3.ts] +for (var a, b of X) { +} + +//// [parserES5ForOfStatement3.js] +for (var a of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement4.errors.txt b/tests/baselines/reference/parserES5ForOfStatement4.errors.txt new file mode 100644 index 00000000000..6a08c8942ed --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement4.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts (1 errors) ==== + for (var a = 1 of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement4.js b/tests/baselines/reference/parserES5ForOfStatement4.js new file mode 100644 index 00000000000..e17699a8662 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement4.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement4.ts] +for (var a = 1 of X) { +} + +//// [parserES5ForOfStatement4.js] +for (var a = 1 of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement5.errors.txt b/tests/baselines/reference/parserES5ForOfStatement5.errors.txt new file mode 100644 index 00000000000..212eae8ac10 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement5.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts (1 errors) ==== + for (var a: number of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement5.js b/tests/baselines/reference/parserES5ForOfStatement5.js new file mode 100644 index 00000000000..2eeb504365e --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement5.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement5.ts] +for (var a: number of X) { +} + +//// [parserES5ForOfStatement5.js] +for (var a of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement6.errors.txt b/tests/baselines/reference/parserES5ForOfStatement6.errors.txt new file mode 100644 index 00000000000..e331b66eb85 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement6.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts (1 errors) ==== + for (var a = 1, b = 2 of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement6.js b/tests/baselines/reference/parserES5ForOfStatement6.js new file mode 100644 index 00000000000..575368fcd20 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement6.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement6.ts] +for (var a = 1, b = 2 of X) { +} + +//// [parserES5ForOfStatement6.js] +for (var a = 1 of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement7.errors.txt b/tests/baselines/reference/parserES5ForOfStatement7.errors.txt new file mode 100644 index 00000000000..5ba60c264eb --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement7.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts (1 errors) ==== + for (var a: number = 1, b: string = "" of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement7.js b/tests/baselines/reference/parserES5ForOfStatement7.js new file mode 100644 index 00000000000..ac240494c18 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement7.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement7.ts] +for (var a: number = 1, b: string = "" of X) { +} + +//// [parserES5ForOfStatement7.js] +for (var a = 1 of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement8.errors.txt b/tests/baselines/reference/parserES5ForOfStatement8.errors.txt new file mode 100644 index 00000000000..3696bf11f8c --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement8.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts (1 errors) ==== + for (var v of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement8.js b/tests/baselines/reference/parserES5ForOfStatement8.js new file mode 100644 index 00000000000..c926784adfe --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement8.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement8.ts] +for (var v of X) { +} + +//// [parserES5ForOfStatement8.js] +for (var v of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement9.errors.txt b/tests/baselines/reference/parserES5ForOfStatement9.errors.txt new file mode 100644 index 00000000000..6e2e9d05705 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement9.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts (1 errors) ==== + for (let v of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement9.js b/tests/baselines/reference/parserES5ForOfStatement9.js new file mode 100644 index 00000000000..e2ec49e9ac9 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement9.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement9.ts] +for (let v of X) { +} + +//// [parserES5ForOfStatement9.js] +for (let v of X) { +} diff --git a/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt new file mode 100644 index 00000000000..adfac8f700f --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts (1 errors) ==== + interface I { + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolIndexer1.js b/tests/baselines/reference/parserES5SymbolIndexer1.js new file mode 100644 index 00000000000..641d93b1170 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer1.js @@ -0,0 +1,6 @@ +//// [parserES5SymbolIndexer1.ts] +interface I { + [s: symbol]: string; +} + +//// [parserES5SymbolIndexer1.js] diff --git a/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt new file mode 100644 index 00000000000..12eef8ec049 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts (1 errors) ==== + class C { + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolIndexer2.js b/tests/baselines/reference/parserES5SymbolIndexer2.js new file mode 100644 index 00000000000..c511b6acafa --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer2.js @@ -0,0 +1,11 @@ +//// [parserES5SymbolIndexer2.ts] +class C { + [s: symbol]: string; +} + +//// [parserES5SymbolIndexer2.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt new file mode 100644 index 00000000000..c9cd9db4fab --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts (1 errors) ==== + var x: { + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolIndexer3.js b/tests/baselines/reference/parserES5SymbolIndexer3.js new file mode 100644 index 00000000000..daffb51a6d7 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer3.js @@ -0,0 +1,7 @@ +//// [parserES5SymbolIndexer3.ts] +var x: { + [s: symbol]: string; +} + +//// [parserES5SymbolIndexer3.js] +var x; diff --git a/tests/baselines/reference/parserES5SymbolProperty1.errors.txt b/tests/baselines/reference/parserES5SymbolProperty1.errors.txt new file mode 100644 index 00000000000..261b28a0650 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty1.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts (1 errors) ==== + interface I { + [Symbol.iterator]: string; + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty1.js b/tests/baselines/reference/parserES5SymbolProperty1.js new file mode 100644 index 00000000000..36030aec105 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty1.js @@ -0,0 +1,6 @@ +//// [parserES5SymbolProperty1.ts] +interface I { + [Symbol.iterator]: string; +} + +//// [parserES5SymbolProperty1.js] diff --git a/tests/baselines/reference/parserES5SymbolProperty2.errors.txt b/tests/baselines/reference/parserES5SymbolProperty2.errors.txt new file mode 100644 index 00000000000..20e166b81f1 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty2.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts (1 errors) ==== + interface I { + [Symbol.unscopables](): string; + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty2.js b/tests/baselines/reference/parserES5SymbolProperty2.js new file mode 100644 index 00000000000..d600b05ea52 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty2.js @@ -0,0 +1,6 @@ +//// [parserES5SymbolProperty2.ts] +interface I { + [Symbol.unscopables](): string; +} + +//// [parserES5SymbolProperty2.js] diff --git a/tests/baselines/reference/parserES5SymbolProperty3.errors.txt b/tests/baselines/reference/parserES5SymbolProperty3.errors.txt new file mode 100644 index 00000000000..9125e8b6dcc --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty3.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts (1 errors) ==== + declare class C { + [Symbol.unscopables](): string; + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty3.js b/tests/baselines/reference/parserES5SymbolProperty3.js new file mode 100644 index 00000000000..0d0fb18313f --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty3.js @@ -0,0 +1,6 @@ +//// [parserES5SymbolProperty3.ts] +declare class C { + [Symbol.unscopables](): string; +} + +//// [parserES5SymbolProperty3.js] diff --git a/tests/baselines/reference/parserES5SymbolProperty4.errors.txt b/tests/baselines/reference/parserES5SymbolProperty4.errors.txt new file mode 100644 index 00000000000..af64d0895d5 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty4.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts (1 errors) ==== + declare class C { + [Symbol.isRegExp]: string; + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty4.js b/tests/baselines/reference/parserES5SymbolProperty4.js new file mode 100644 index 00000000000..d8f55358e73 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty4.js @@ -0,0 +1,6 @@ +//// [parserES5SymbolProperty4.ts] +declare class C { + [Symbol.isRegExp]: string; +} + +//// [parserES5SymbolProperty4.js] diff --git a/tests/baselines/reference/parserES5SymbolProperty5.errors.txt b/tests/baselines/reference/parserES5SymbolProperty5.errors.txt new file mode 100644 index 00000000000..7ebc7f589d2 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty5.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts (1 errors) ==== + class C { + [Symbol.isRegExp]: string; + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty5.js b/tests/baselines/reference/parserES5SymbolProperty5.js new file mode 100644 index 00000000000..e2448432542 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty5.js @@ -0,0 +1,11 @@ +//// [parserES5SymbolProperty5.ts] +class C { + [Symbol.isRegExp]: string; +} + +//// [parserES5SymbolProperty5.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserES5SymbolProperty6.errors.txt b/tests/baselines/reference/parserES5SymbolProperty6.errors.txt new file mode 100644 index 00000000000..f72a3b4fd28 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty6.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts (1 errors) ==== + class C { + [Symbol.toStringTag]: string = ""; + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty6.js b/tests/baselines/reference/parserES5SymbolProperty6.js new file mode 100644 index 00000000000..ce2050688c3 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty6.js @@ -0,0 +1,12 @@ +//// [parserES5SymbolProperty6.ts] +class C { + [Symbol.toStringTag]: string = ""; +} + +//// [parserES5SymbolProperty6.js] +var C = (function () { + function C() { + this[Symbol.toStringTag] = ""; + } + return C; +})(); diff --git a/tests/baselines/reference/parserES5SymbolProperty7.errors.txt b/tests/baselines/reference/parserES5SymbolProperty7.errors.txt new file mode 100644 index 00000000000..9fab662b513 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty7.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts (1 errors) ==== + class C { + [Symbol.toStringTag](): void { } + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty7.js b/tests/baselines/reference/parserES5SymbolProperty7.js new file mode 100644 index 00000000000..102d10af417 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty7.js @@ -0,0 +1,12 @@ +//// [parserES5SymbolProperty7.ts] +class C { + [Symbol.toStringTag](): void { } +} + +//// [parserES5SymbolProperty7.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.toStringTag] = function () { }; + return C; +})(); diff --git a/tests/baselines/reference/parserES5SymbolProperty8.errors.txt b/tests/baselines/reference/parserES5SymbolProperty8.errors.txt new file mode 100644 index 00000000000..289b321b2af --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty8.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts (1 errors) ==== + var x: { + [Symbol.toPrimitive](): string + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty8.js b/tests/baselines/reference/parserES5SymbolProperty8.js new file mode 100644 index 00000000000..ed3a55db0f2 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty8.js @@ -0,0 +1,7 @@ +//// [parserES5SymbolProperty8.ts] +var x: { + [Symbol.toPrimitive](): string +} + +//// [parserES5SymbolProperty8.js] +var x; diff --git a/tests/baselines/reference/parserES5SymbolProperty9.errors.txt b/tests/baselines/reference/parserES5SymbolProperty9.errors.txt new file mode 100644 index 00000000000..1b74bb23d11 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty9.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts (1 errors) ==== + var x: { + [Symbol.toPrimitive]: string + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty9.js b/tests/baselines/reference/parserES5SymbolProperty9.js new file mode 100644 index 00000000000..4728765e553 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty9.js @@ -0,0 +1,7 @@ +//// [parserES5SymbolProperty9.ts] +var x: { + [Symbol.toPrimitive]: string +} + +//// [parserES5SymbolProperty9.js] +var x; diff --git a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js index 1ed36d8dac5..c33dbc2a626 100644 --- a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js +++ b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js @@ -3,4 +3,5 @@ var v = [1, 2, 3 4, 5, 6, 7]; //// [parserErrorRecoveryArrayLiteralExpression1.js] -var v = [1, 2, 3, 4, 5, 6, 7]; +var v = [1, 2, 3, + 4, 5, 6, 7]; diff --git a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js index c5386a2b6a2..0bfe59964db 100644 --- a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js +++ b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js @@ -5,4 +5,5 @@ var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0 //// [parserErrorRecoveryArrayLiteralExpression2.js] -var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0, .7042760848999023, 1.1955541372299194, 0.19600726664066315, -0.7120069861412048]; +var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0, + .7042760848999023, 1.1955541372299194, 0.19600726664066315, -0.7120069861412048]; diff --git a/tests/baselines/reference/parserErrorRecovery_Block1.js b/tests/baselines/reference/parserErrorRecovery_Block1.js index cdcd5856fa6..e2bc5f89a39 100644 --- a/tests/baselines/reference/parserErrorRecovery_Block1.js +++ b/tests/baselines/reference/parserErrorRecovery_Block1.js @@ -6,6 +6,7 @@ function f() { //// [parserErrorRecovery_Block1.js] function f() { - 1 + ; + 1 + + ; return; } diff --git a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js index c26b16b5a0a..ae2509c3f49 100644 --- a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js +++ b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js @@ -41,9 +41,7 @@ var Shapes; this.con = "hello"; } // Instance member - Point.prototype.getDist = function () { - return Math.sqrt(this.x * this.x + this.y * this.y); - }; + Point.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; // Static member Point.origin = new Point(0, 0); return Point; diff --git a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js index 866f96a8030..4936b1ea8bc 100644 --- a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js +++ b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js @@ -41,9 +41,7 @@ var Shapes; this.con = "hello"; } // Instance member - Point.prototype.getDist = function () { - return Math.sqrt(this.x * this.x + this.y * this.y); - }; + Point.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; // Static member Point.origin = new Point(0, 0); return Point; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js index 08dc96d38ef..6a703759fff 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js @@ -3,4 +3,5 @@ var v = { a return; //// [parserErrorRecovery_ObjectLiteral2.js] -var v = { a: , return: }; +var v = { a: , + return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js index 1ea23d59112..eecf45fea4f 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js @@ -3,4 +3,5 @@ var v = { a: return; //// [parserErrorRecovery_ObjectLiteral3.js] -var v = { a: , return: }; +var v = { a: , + return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js index 4fe49788740..87a1a31437e 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js @@ -3,4 +3,5 @@ var v = { a: 1 return; //// [parserErrorRecovery_ObjectLiteral4.js] -var v = { a: 1, return: }; +var v = { a: 1, + return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js index cf55b59c711..97e618946a0 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js @@ -3,4 +3,5 @@ var v = { a: 1, return; //// [parserErrorRecovery_ObjectLiteral5.js] -var v = { a: 1, return: }; +var v = { a: 1, + return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_SwitchStatement1.js b/tests/baselines/reference/parserErrorRecovery_SwitchStatement1.js index 63591985d1e..4d8008639c9 100644 --- a/tests/baselines/reference/parserErrorRecovery_SwitchStatement1.js +++ b/tests/baselines/reference/parserErrorRecovery_SwitchStatement1.js @@ -10,8 +10,10 @@ switch (e) { //// [parserErrorRecovery_SwitchStatement1.js] switch (e) { case 1: - 1 + ; + 1 + + ; case 2: - 1 + ; + 1 + + ; default: } diff --git a/tests/baselines/reference/parserForInStatement4.errors.txt b/tests/baselines/reference/parserForInStatement4.errors.txt index a4df2beaedb..91484260903 100644 --- a/tests/baselines/reference/parserForInStatement4.errors.txt +++ b/tests/baselines/reference/parserForInStatement4.errors.txt @@ -1,8 +1,11 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement4.ts(1,10): error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement4.ts(1,19): error TS2304: Cannot find name 'X'. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement4.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement4.ts (2 errors) ==== for (var a = 1 in X) { + ~ +!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. ~ !!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForInStatement7.errors.txt b/tests/baselines/reference/parserForInStatement7.errors.txt index 397401003db..7c85ce3f795 100644 --- a/tests/baselines/reference/parserForInStatement7.errors.txt +++ b/tests/baselines/reference/parserForInStatement7.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement7.ts(1,10): error TS2404: The left-hand side of a 'for...in' statement cannot use a type annotation. tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement7.ts(1,25): error TS1091: Only a single variable declaration is allowed in a 'for...in' statement. tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement7.ts(1,43): error TS2304: Cannot find name 'X'. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement7.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement7.ts (2 errors) ==== for (var a: number = 1, b: string = "" in X) { - ~ -!!! error TS2404: The left-hand side of a 'for...in' statement cannot use a type annotation. ~ !!! error TS1091: Only a single variable declaration is allowed in a 'for...in' statement. ~ diff --git a/tests/baselines/reference/parserForOfStatement1.d.errors.txt b/tests/baselines/reference/parserForOfStatement1.d.errors.txt new file mode 100644 index 00000000000..05af0a6f775 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement1.d.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts (1 errors) ==== + for (var i of e) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement10.errors.txt b/tests/baselines/reference/parserForOfStatement10.errors.txt new file mode 100644 index 00000000000..570c319b51f --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement10.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts (1 errors) ==== + for (const v of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement10.js b/tests/baselines/reference/parserForOfStatement10.js new file mode 100644 index 00000000000..d0b48203090 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement10.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement10.ts] +for (const v of X) { +} + +//// [parserForOfStatement10.js] +for (var v of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement11.errors.txt b/tests/baselines/reference/parserForOfStatement11.errors.txt new file mode 100644 index 00000000000..f253a2d4295 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement11.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts (1 errors) ==== + for (const [a, b] of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement11.js b/tests/baselines/reference/parserForOfStatement11.js new file mode 100644 index 00000000000..daa3fb6df48 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement11.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement11.ts] +for (const [a, b] of X) { +} + +//// [parserForOfStatement11.js] +for (var [a, b] of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement12.errors.txt b/tests/baselines/reference/parserForOfStatement12.errors.txt new file mode 100644 index 00000000000..07ef4498984 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement12.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts (1 errors) ==== + for (const {a, b} of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement12.js b/tests/baselines/reference/parserForOfStatement12.js new file mode 100644 index 00000000000..2e62b90de5e --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement12.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement12.ts] +for (const {a, b} of X) { +} + +//// [parserForOfStatement12.js] +for (var { a, b } of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement13.errors.txt b/tests/baselines/reference/parserForOfStatement13.errors.txt new file mode 100644 index 00000000000..6c10a7b0582 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement13.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts (1 errors) ==== + for (let {a, b} of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement13.js b/tests/baselines/reference/parserForOfStatement13.js new file mode 100644 index 00000000000..a9c59046b8e --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement13.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement13.ts] +for (let {a, b} of X) { +} + +//// [parserForOfStatement13.js] +for (let { a, b } of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement14.errors.txt b/tests/baselines/reference/parserForOfStatement14.errors.txt new file mode 100644 index 00000000000..209a39c0513 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement14.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts (1 errors) ==== + for (let [a, b] of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement14.js b/tests/baselines/reference/parserForOfStatement14.js new file mode 100644 index 00000000000..e46e2c46ea6 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement14.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement14.ts] +for (let [a, b] of X) { +} + +//// [parserForOfStatement14.js] +for (let [a, b] of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement15.errors.txt b/tests/baselines/reference/parserForOfStatement15.errors.txt new file mode 100644 index 00000000000..c5fd77af299 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement15.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts (1 errors) ==== + for (var [a, b] of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement15.js b/tests/baselines/reference/parserForOfStatement15.js new file mode 100644 index 00000000000..81782393383 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement15.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement15.ts] +for (var [a, b] of X) { +} + +//// [parserForOfStatement15.js] +for (var [a, b] of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement16.errors.txt b/tests/baselines/reference/parserForOfStatement16.errors.txt new file mode 100644 index 00000000000..d169eef1256 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement16.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts (1 errors) ==== + for (var {a, b} of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement16.js b/tests/baselines/reference/parserForOfStatement16.js new file mode 100644 index 00000000000..f0ca1ee3e6d --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement16.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement16.ts] +for (var {a, b} of X) { +} + +//// [parserForOfStatement16.js] +for (var { a, b } of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement17.js b/tests/baselines/reference/parserForOfStatement17.js new file mode 100644 index 00000000000..a6e2aee79a4 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement17.js @@ -0,0 +1,5 @@ +//// [parserForOfStatement17.ts] +for (var of; ;) { } + +//// [parserForOfStatement17.js] +for (var of;;) { } diff --git a/tests/baselines/reference/parserForOfStatement17.types b/tests/baselines/reference/parserForOfStatement17.types new file mode 100644 index 00000000000..64e15462dd6 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement17.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement17.ts === +for (var of; ;) { } +>of : any + diff --git a/tests/baselines/reference/parserForOfStatement18.errors.txt b/tests/baselines/reference/parserForOfStatement18.errors.txt new file mode 100644 index 00000000000..9312af76fc1 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement18.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts (1 errors) ==== + for (var of of of) { } + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement18.js b/tests/baselines/reference/parserForOfStatement18.js new file mode 100644 index 00000000000..c30fbb60857 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement18.js @@ -0,0 +1,5 @@ +//// [parserForOfStatement18.ts] +for (var of of of) { } + +//// [parserForOfStatement18.js] +for (var of of of) { } diff --git a/tests/baselines/reference/parserForOfStatement19.js b/tests/baselines/reference/parserForOfStatement19.js new file mode 100644 index 00000000000..c838e8c71e0 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement19.js @@ -0,0 +1,5 @@ +//// [parserForOfStatement19.ts] +for (var of in of) { } + +//// [parserForOfStatement19.js] +for (var of in of) { } diff --git a/tests/baselines/reference/parserForOfStatement19.types b/tests/baselines/reference/parserForOfStatement19.types new file mode 100644 index 00000000000..6fcc5e8f792 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement19.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts === +for (var of in of) { } +>of : any +>of : any + diff --git a/tests/baselines/reference/parserForOfStatement2.errors.txt b/tests/baselines/reference/parserForOfStatement2.errors.txt new file mode 100644 index 00000000000..8e7da497308 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement2.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts (1 errors) ==== + for (var of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement2.js b/tests/baselines/reference/parserForOfStatement2.js new file mode 100644 index 00000000000..84d23d4e2aa --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement2.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement2.ts] +for (var of X) { +} + +//// [parserForOfStatement2.js] +for ( of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement20.errors.txt b/tests/baselines/reference/parserForOfStatement20.errors.txt new file mode 100644 index 00000000000..461f307f6b9 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement20.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts(1,10): error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts (1 errors) ==== + for (var of = 0 in of) { } + ~~ +!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement20.js b/tests/baselines/reference/parserForOfStatement20.js new file mode 100644 index 00000000000..8599238d853 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement20.js @@ -0,0 +1,5 @@ +//// [parserForOfStatement20.ts] +for (var of = 0 in of) { } + +//// [parserForOfStatement20.js] +for (var of = 0 in of) { } diff --git a/tests/baselines/reference/parserForOfStatement21.errors.txt b/tests/baselines/reference/parserForOfStatement21.errors.txt new file mode 100644 index 00000000000..dad48f415cd --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement21.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts (1 errors) ==== + for (var of of) { } + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement21.js b/tests/baselines/reference/parserForOfStatement21.js new file mode 100644 index 00000000000..5db883e18a0 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement21.js @@ -0,0 +1,5 @@ +//// [parserForOfStatement21.ts] +for (var of of) { } + +//// [parserForOfStatement21.js] +for ( of of) { } diff --git a/tests/baselines/reference/parserForOfStatement3.errors.txt b/tests/baselines/reference/parserForOfStatement3.errors.txt new file mode 100644 index 00000000000..83985f1a710 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement3.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts (1 errors) ==== + for (var a, b of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement3.js b/tests/baselines/reference/parserForOfStatement3.js new file mode 100644 index 00000000000..206e8fe5af8 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement3.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement3.ts] +for (var a, b of X) { +} + +//// [parserForOfStatement3.js] +for (var a of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement4.errors.txt b/tests/baselines/reference/parserForOfStatement4.errors.txt new file mode 100644 index 00000000000..94dd08ed597 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement4.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts (1 errors) ==== + for (var a = 1 of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement4.js b/tests/baselines/reference/parserForOfStatement4.js new file mode 100644 index 00000000000..9e7549c20fc --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement4.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement4.ts] +for (var a = 1 of X) { +} + +//// [parserForOfStatement4.js] +for (var a = 1 of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement5.errors.txt b/tests/baselines/reference/parserForOfStatement5.errors.txt new file mode 100644 index 00000000000..6570f4a0755 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement5.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts (1 errors) ==== + for (var a: number of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement5.js b/tests/baselines/reference/parserForOfStatement5.js new file mode 100644 index 00000000000..9028ebe7e3f --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement5.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement5.ts] +for (var a: number of X) { +} + +//// [parserForOfStatement5.js] +for (var a of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement6.errors.txt b/tests/baselines/reference/parserForOfStatement6.errors.txt new file mode 100644 index 00000000000..6208749911f --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement6.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts (1 errors) ==== + for (var a = 1, b = 2 of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement6.js b/tests/baselines/reference/parserForOfStatement6.js new file mode 100644 index 00000000000..37f3560a29c --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement6.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement6.ts] +for (var a = 1, b = 2 of X) { +} + +//// [parserForOfStatement6.js] +for (var a = 1 of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement7.errors.txt b/tests/baselines/reference/parserForOfStatement7.errors.txt new file mode 100644 index 00000000000..1810daad5ee --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement7.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts (1 errors) ==== + for (var a: number = 1, b: string = "" of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement7.js b/tests/baselines/reference/parserForOfStatement7.js new file mode 100644 index 00000000000..0b18d0358b4 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement7.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement7.ts] +for (var a: number = 1, b: string = "" of X) { +} + +//// [parserForOfStatement7.js] +for (var a = 1 of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement8.errors.txt b/tests/baselines/reference/parserForOfStatement8.errors.txt new file mode 100644 index 00000000000..8e2c41d0cef --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement8.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts (1 errors) ==== + for (var v of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement8.js b/tests/baselines/reference/parserForOfStatement8.js new file mode 100644 index 00000000000..3565998701e --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement8.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement8.ts] +for (var v of X) { +} + +//// [parserForOfStatement8.js] +for (var v of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement9.errors.txt b/tests/baselines/reference/parserForOfStatement9.errors.txt new file mode 100644 index 00000000000..01fd729e9cd --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement9.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts(1,1): error TS9003: 'for...of' statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts (1 errors) ==== + for (let v of X) { + ~~~ +!!! error TS9003: 'for...of' statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement9.js b/tests/baselines/reference/parserForOfStatement9.js new file mode 100644 index 00000000000..f03dad33c5f --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement9.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement9.ts] +for (let v of X) { +} + +//// [parserForOfStatement9.js] +for (let v of X) { +} diff --git a/tests/baselines/reference/parserForStatement3.errors.txt b/tests/baselines/reference/parserForStatement3.errors.txt index 533958505c1..06c3f083d45 100644 --- a/tests/baselines/reference/parserForStatement3.errors.txt +++ b/tests/baselines/reference/parserForStatement3.errors.txt @@ -1,5 +1,4 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,5): error TS2304: Cannot find name 'd'. -tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,5): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,10): error TS2304: Cannot find name '_'. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,15): error TS2304: Cannot find name 'a'. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,18): error TS2304: Cannot find name '_'. @@ -7,12 +6,10 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,2 tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,30): error TS2304: Cannot find name 'b'. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts (7 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts (6 errors) ==== for(d in _.jh[a]=_.jh[a]||[],b); ~ !!! error TS2304: Cannot find name 'd'. - ~ -!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. ~ !!! error TS2304: Cannot find name '_'. ~ diff --git a/tests/baselines/reference/parserForStatement6.errors.txt b/tests/baselines/reference/parserForStatement6.errors.txt index a098141c81b..a41f103e929 100644 --- a/tests/baselines/reference/parserForStatement6.errors.txt +++ b/tests/baselines/reference/parserForStatement6.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement6.ts(1,6): error TS2304: Cannot find name 'foo'. -tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement6.ts(1,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement6.ts(1,6): error TS2406: Invalid left-hand side in 'for...in' statement. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement6.ts(1,15): error TS2304: Cannot find name 'b'. @@ -8,7 +8,7 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement6.ts(1,1 ~~~ !!! error TS2304: Cannot find name 'foo'. ~~~~~ -!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +!!! error TS2406: Invalid left-hand side in 'for...in' statement. ~ !!! error TS2304: Cannot find name 'b'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForStatement7.errors.txt b/tests/baselines/reference/parserForStatement7.errors.txt index da1f1ce6808..3aa67480105 100644 --- a/tests/baselines/reference/parserForStatement7.errors.txt +++ b/tests/baselines/reference/parserForStatement7.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts(1,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts(1,6): error TS2406: Invalid left-hand side in 'for...in' statement. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts(1,10): error TS2304: Cannot find name 'foo'. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts(1,19): error TS2304: Cannot find name 'b'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts(1,1 ==== tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts (3 errors) ==== for (new foo() in b) { ~~~~~~~~~ -!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +!!! error TS2406: Invalid left-hand side in 'for...in' statement. ~~~ !!! error TS2304: Cannot find name 'foo'. ~ diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js index 4ff1f26d890..766c95632ab 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js @@ -5,4 +5,5 @@ 2; //// [parserGreaterThanTokenAmbiguity10.js] -1 >>> 2; +1 >>> +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity14.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity14.js index 5cc8bb3b88e..b2eba6d5873 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity14.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity14.js @@ -3,5 +3,6 @@ = 2; //// [parserGreaterThanTokenAmbiguity14.js] -1 >> ; +1 >> +; 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js index df9e55b7e3c..8675365d9ea 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js @@ -5,4 +5,5 @@ 2; //// [parserGreaterThanTokenAmbiguity15.js] -1 >>= 2; +1 >>= +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity19.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity19.js index 52035691c84..d0671d8649f 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity19.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity19.js @@ -3,5 +3,6 @@ = 2; //// [parserGreaterThanTokenAmbiguity19.js] -1 >>> ; +1 >>> +; 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js index e6043febcd1..e190e94e9f9 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js @@ -5,4 +5,5 @@ 2; //// [parserGreaterThanTokenAmbiguity20.js] -1 >>>= 2; +1 >>>= +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.js index 5ef065681dc..c0b8fc45cc1 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.js @@ -3,4 +3,5 @@ > 2; //// [parserGreaterThanTokenAmbiguity4.js] -1 > > 2; +1 > + > 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js index a707e808b4a..59d13d5c9d3 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js @@ -5,4 +5,5 @@ 2; //// [parserGreaterThanTokenAmbiguity5.js] -1 >> 2; +1 >> +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity9.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity9.js index 25c5ed53a7c..757ddf38a7f 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity9.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity9.js @@ -3,4 +3,5 @@ > 2; //// [parserGreaterThanTokenAmbiguity9.js] -1 >> > 2; +1 >> + > 2; diff --git a/tests/baselines/reference/parserIndexSignature11.errors.txt b/tests/baselines/reference/parserIndexSignature11.errors.txt index 8cf474b19bb..f1f2a4a00f4 100644 --- a/tests/baselines/reference/parserIndexSignature11.errors.txt +++ b/tests/baselines/reference/parserIndexSignature11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(2,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(2,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(2,10): error TS2304: Cannot find name 'p'. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(3,9): error TS1021: An index signature must have a type annotation. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(4,10): error TS1096: An index signature must have exactly one parameter. @@ -8,7 +8,7 @@ tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature1 interface I { [p]; // Used to be indexer, now it is a computed property ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; diff --git a/tests/baselines/reference/parserIndexSignature4.errors.txt b/tests/baselines/reference/parserIndexSignature4.errors.txt index d625f27eb6f..bd73b4d2bf4 100644 --- a/tests/baselines/reference/parserIndexSignature4.errors.txt +++ b/tests/baselines/reference/parserIndexSignature4.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,3): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,3): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,4): error TS2304: Cannot find name 'a'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4 interface I { [a = 0] // Used to be indexer, now it is a computed property ~~~~~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'a'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserIndexSignature5.errors.txt b/tests/baselines/reference/parserIndexSignature5.errors.txt index 3f3415973d9..54ccd05f4f9 100644 --- a/tests/baselines/reference/parserIndexSignature5.errors.txt +++ b/tests/baselines/reference/parserIndexSignature5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts(2,3): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts(2,3): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts(2,4): error TS2304: Cannot find name 'a'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5 interface I { [a] // Used to be indexer, now it is a computed property ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'a'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserRealSource1.js b/tests/baselines/reference/parserRealSource1.js index c62897c9aff..d19c2242f0b 100644 --- a/tests/baselines/reference/parserRealSource1.js +++ b/tests/baselines/reference/parserRealSource1.js @@ -189,21 +189,11 @@ var TypeScript; var NullLogger = (function () { function NullLogger() { } - NullLogger.prototype.information = function () { - return false; - }; - NullLogger.prototype.debug = function () { - return false; - }; - NullLogger.prototype.warning = function () { - return false; - }; - NullLogger.prototype.error = function () { - return false; - }; - NullLogger.prototype.fatal = function () { - return false; - }; + NullLogger.prototype.information = function () { return false; }; + NullLogger.prototype.debug = function () { return false; }; + NullLogger.prototype.warning = function () { return false; }; + NullLogger.prototype.error = function () { return false; }; + NullLogger.prototype.fatal = function () { return false; }; NullLogger.prototype.log = function (s) { }; return NullLogger; @@ -218,21 +208,11 @@ var TypeScript; this._error = this.logger.error(); this._fatal = this.logger.fatal(); } - LoggerAdapter.prototype.information = function () { - return this._information; - }; - LoggerAdapter.prototype.debug = function () { - return this._debug; - }; - LoggerAdapter.prototype.warning = function () { - return this._warning; - }; - LoggerAdapter.prototype.error = function () { - return this._error; - }; - LoggerAdapter.prototype.fatal = function () { - return this._fatal; - }; + LoggerAdapter.prototype.information = function () { return this._information; }; + LoggerAdapter.prototype.debug = function () { return this._debug; }; + LoggerAdapter.prototype.warning = function () { return this._warning; }; + LoggerAdapter.prototype.error = function () { return this._error; }; + LoggerAdapter.prototype.fatal = function () { return this._fatal; }; LoggerAdapter.prototype.log = function (s) { this.logger.log(s); }; @@ -243,21 +223,11 @@ var TypeScript; function BufferedLogger() { this.logContents = []; } - BufferedLogger.prototype.information = function () { - return false; - }; - BufferedLogger.prototype.debug = function () { - return false; - }; - BufferedLogger.prototype.warning = function () { - return false; - }; - BufferedLogger.prototype.error = function () { - return false; - }; - BufferedLogger.prototype.fatal = function () { - return false; - }; + BufferedLogger.prototype.information = function () { return false; }; + BufferedLogger.prototype.debug = function () { return false; }; + BufferedLogger.prototype.warning = function () { return false; }; + BufferedLogger.prototype.error = function () { return false; }; + BufferedLogger.prototype.fatal = function () { return false; }; BufferedLogger.prototype.log = function (s) { this.logContents.push(s); }; diff --git a/tests/baselines/reference/parserRealSource10.js b/tests/baselines/reference/parserRealSource10.js index 0dd944a7721..768e35c1a3b 100644 --- a/tests/baselines/reference/parserRealSource10.js +++ b/tests/baselines/reference/parserRealSource10.js @@ -813,7 +813,8 @@ var TypeScript; else { var tokenInfo = lookupToken(this.tokenId); if (tokenInfo != undefined) { - if ((tokenInfo.unopNodeType != NodeType.None) || (tokenInfo.binopNodeType != NodeType.None)) { + if ((tokenInfo.unopNodeType != NodeType.None) || + (tokenInfo.binopNodeType != NodeType.None)) { return 2 /* Operator */; } } diff --git a/tests/baselines/reference/parserRealSource11.js b/tests/baselines/reference/parserRealSource11.js index 0574c52eaaa..72fec692184 100644 --- a/tests/baselines/reference/parserRealSource11.js +++ b/tests/baselines/reference/parserRealSource11.js @@ -2397,18 +2397,10 @@ var TypeScript; this.postComments = null; this.isParenthesized = false; } - AST.prototype.isExpression = function () { - return false; - }; - AST.prototype.isStatementOrExpression = function () { - return false; - }; - AST.prototype.isCompoundStatement = function () { - return false; - }; - AST.prototype.isLeaf = function () { - return this.isStatementOrExpression() && (!this.isCompoundStatement()); - }; + AST.prototype.isExpression = function () { return false; }; + AST.prototype.isStatementOrExpression = function () { return false; }; + AST.prototype.isCompoundStatement = function () { return false; }; + AST.prototype.isLeaf = function () { return this.isStatementOrExpression() && (!this.isCompoundStatement()); }; AST.prototype.typeCheck = function (typeFlow) { switch (this.nodeType) { case NodeType.Error: @@ -2496,7 +2488,8 @@ var TypeScript; if (context.parser !== null) { context.parser.getSourceLineCol(lineCol, this.minChar); context.parser.getSourceLineCol(limLineCol, this.limChar); - context.write("(" + lineCol.line + "," + lineCol.col + ")--" + "(" + limLineCol.line + "," + limLineCol.col + "): "); + context.write("(" + lineCol.line + "," + lineCol.col + ")--" + + "(" + limLineCol.line + "," + limLineCol.col + "): "); } var lab = this.printLabel(); if (hasFlag(this.flags, ASTFlags.Error)) { @@ -2643,12 +2636,8 @@ var TypeScript; this.text = actualText; } }; - Identifier.prototype.isMissing = function () { - return false; - }; - Identifier.prototype.isLeaf = function () { - return true; - }; + Identifier.prototype.isMissing = function () { return false; }; + Identifier.prototype.isLeaf = function () { return true; }; Identifier.prototype.treeViewLabel = function () { return "id: " + this.actualText; }; @@ -2692,9 +2681,7 @@ var TypeScript; _super.call(this, NodeType.Label); this.id = id; } - Label.prototype.printLabel = function () { - return this.id.actualText + ":"; - }; + Label.prototype.printLabel = function () { return this.id.actualText + ":"; }; Label.prototype.typeCheck = function (typeFlow) { this.type = typeFlow.voidType; return this; @@ -2717,12 +2704,8 @@ var TypeScript; function Expression(nodeType) { _super.call(this, nodeType); } - Expression.prototype.isExpression = function () { - return true; - }; - Expression.prototype.isStatementOrExpression = function () { - return true; - }; + Expression.prototype.isExpression = function () { return true; }; + Expression.prototype.isStatementOrExpression = function () { return true; }; return Expression; })(AST); TypeScript.Expression = Expression; @@ -3183,9 +3166,7 @@ var TypeScript; this.varFlags = VarFlags.None; this.isDynamicImport = false; } - ImportDeclaration.prototype.isStatementOrExpression = function () { - return true; - }; + ImportDeclaration.prototype.isStatementOrExpression = function () { return true; }; ImportDeclaration.prototype.emit = function (emitter, tokenId, startLine) { var mod = this.alias.type; // REVIEW: Only modules may be aliased for now, though there's no real @@ -3246,18 +3227,10 @@ var TypeScript; this.varFlags = VarFlags.None; this.sym = null; } - BoundDecl.prototype.isStatementOrExpression = function () { - return true; - }; - BoundDecl.prototype.isPrivate = function () { - return hasFlag(this.varFlags, VarFlags.Private); - }; - BoundDecl.prototype.isPublic = function () { - return hasFlag(this.varFlags, VarFlags.Public); - }; - BoundDecl.prototype.isProperty = function () { - return hasFlag(this.varFlags, VarFlags.Property); - }; + BoundDecl.prototype.isStatementOrExpression = function () { return true; }; + BoundDecl.prototype.isPrivate = function () { return hasFlag(this.varFlags, VarFlags.Private); }; + BoundDecl.prototype.isPublic = function () { return hasFlag(this.varFlags, VarFlags.Public); }; + BoundDecl.prototype.isProperty = function () { return hasFlag(this.varFlags, VarFlags.Property); }; BoundDecl.prototype.typeCheck = function (typeFlow) { return typeFlow.typeCheckBoundDecl(this); }; @@ -3272,15 +3245,9 @@ var TypeScript; function VarDecl(id, nest) { _super.call(this, id, NodeType.VarDecl, nest); } - VarDecl.prototype.isAmbient = function () { - return hasFlag(this.varFlags, VarFlags.Ambient); - }; - VarDecl.prototype.isExported = function () { - return hasFlag(this.varFlags, VarFlags.Exported); - }; - VarDecl.prototype.isStatic = function () { - return hasFlag(this.varFlags, VarFlags.Static); - }; + VarDecl.prototype.isAmbient = function () { return hasFlag(this.varFlags, VarFlags.Ambient); }; + VarDecl.prototype.isExported = function () { return hasFlag(this.varFlags, VarFlags.Exported); }; + VarDecl.prototype.isStatic = function () { return hasFlag(this.varFlags, VarFlags.Static); }; VarDecl.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitJavascriptVarDecl(this, tokenId); }; @@ -3297,9 +3264,7 @@ var TypeScript; this.isOptional = false; this.parameterPropertySym = null; } - ArgDecl.prototype.isOptionalArg = function () { - return this.isOptional || this.init; - }; + ArgDecl.prototype.isOptionalArg = function () { return this.isOptional || this.init; }; ArgDecl.prototype.treeViewLabel = function () { return "arg: " + this.id.actualText; }; @@ -3360,12 +3325,8 @@ var TypeScript; } return this.internalNameCache; }; - FuncDecl.prototype.hasSelfReference = function () { - return hasFlag(this.fncFlags, FncFlags.HasSelfReference); - }; - FuncDecl.prototype.setHasSelfReference = function () { - this.fncFlags |= FncFlags.HasSelfReference; - }; + FuncDecl.prototype.hasSelfReference = function () { return hasFlag(this.fncFlags, FncFlags.HasSelfReference); }; + FuncDecl.prototype.setHasSelfReference = function () { this.fncFlags |= FncFlags.HasSelfReference; }; FuncDecl.prototype.addCloRef = function (id, sym) { if (this.envids == null) { this.envids = new Identifier[]; @@ -3419,45 +3380,19 @@ var TypeScript; FuncDecl.prototype.isMethod = function () { return (this.fncFlags & FncFlags.Method) != FncFlags.None; }; - FuncDecl.prototype.isCallMember = function () { - return hasFlag(this.fncFlags, FncFlags.CallMember); - }; - FuncDecl.prototype.isConstructMember = function () { - return hasFlag(this.fncFlags, FncFlags.ConstructMember); - }; - FuncDecl.prototype.isIndexerMember = function () { - return hasFlag(this.fncFlags, FncFlags.IndexerMember); - }; - FuncDecl.prototype.isSpecialFn = function () { - return this.isCallMember() || this.isIndexerMember() || this.isConstructMember(); - }; - FuncDecl.prototype.isAnonymousFn = function () { - return this.name === null; - }; - FuncDecl.prototype.isAccessor = function () { - return hasFlag(this.fncFlags, FncFlags.GetAccessor) || hasFlag(this.fncFlags, FncFlags.SetAccessor); - }; - FuncDecl.prototype.isGetAccessor = function () { - return hasFlag(this.fncFlags, FncFlags.GetAccessor); - }; - FuncDecl.prototype.isSetAccessor = function () { - return hasFlag(this.fncFlags, FncFlags.SetAccessor); - }; - FuncDecl.prototype.isAmbient = function () { - return hasFlag(this.fncFlags, FncFlags.Ambient); - }; - FuncDecl.prototype.isExported = function () { - return hasFlag(this.fncFlags, FncFlags.Exported); - }; - FuncDecl.prototype.isPrivate = function () { - return hasFlag(this.fncFlags, FncFlags.Private); - }; - FuncDecl.prototype.isPublic = function () { - return hasFlag(this.fncFlags, FncFlags.Public); - }; - FuncDecl.prototype.isStatic = function () { - return hasFlag(this.fncFlags, FncFlags.Static); - }; + FuncDecl.prototype.isCallMember = function () { return hasFlag(this.fncFlags, FncFlags.CallMember); }; + FuncDecl.prototype.isConstructMember = function () { return hasFlag(this.fncFlags, FncFlags.ConstructMember); }; + FuncDecl.prototype.isIndexerMember = function () { return hasFlag(this.fncFlags, FncFlags.IndexerMember); }; + FuncDecl.prototype.isSpecialFn = function () { return this.isCallMember() || this.isIndexerMember() || this.isConstructMember(); }; + FuncDecl.prototype.isAnonymousFn = function () { return this.name === null; }; + FuncDecl.prototype.isAccessor = function () { return hasFlag(this.fncFlags, FncFlags.GetAccessor) || hasFlag(this.fncFlags, FncFlags.SetAccessor); }; + FuncDecl.prototype.isGetAccessor = function () { return hasFlag(this.fncFlags, FncFlags.GetAccessor); }; + FuncDecl.prototype.isSetAccessor = function () { return hasFlag(this.fncFlags, FncFlags.SetAccessor); }; + FuncDecl.prototype.isAmbient = function () { return hasFlag(this.fncFlags, FncFlags.Ambient); }; + FuncDecl.prototype.isExported = function () { return hasFlag(this.fncFlags, FncFlags.Exported); }; + FuncDecl.prototype.isPrivate = function () { return hasFlag(this.fncFlags, FncFlags.Private); }; + FuncDecl.prototype.isPublic = function () { return hasFlag(this.fncFlags, FncFlags.Public); }; + FuncDecl.prototype.isStatic = function () { return hasFlag(this.fncFlags, FncFlags.Static); }; FuncDecl.prototype.treeViewLabel = function () { if (this.name == null) { return "funcExpr"; @@ -3469,12 +3404,8 @@ var TypeScript; FuncDecl.prototype.ClearFlags = function () { this.fncFlags = FncFlags.None; }; - FuncDecl.prototype.isSignature = function () { - return (this.fncFlags & FncFlags.Signature) != FncFlags.None; - }; - FuncDecl.prototype.hasStaticDeclarations = function () { - return (!this.isConstructor && (this.statics.members.length > 0 || this.innerStaticFuncs.length > 0)); - }; + FuncDecl.prototype.isSignature = function () { return (this.fncFlags & FncFlags.Signature) != FncFlags.None; }; + FuncDecl.prototype.hasStaticDeclarations = function () { return (!this.isConstructor && (this.statics.members.length > 0 || this.innerStaticFuncs.length > 0)); }; return FuncDecl; })(AST); TypeScript.FuncDecl = FuncDecl; @@ -3583,15 +3514,9 @@ var TypeScript; this.scopes = scopes; this.prettyName = this.name.actualText; } - ModuleDeclaration.prototype.isExported = function () { - return hasFlag(this.modFlags, ModuleFlags.Exported); - }; - ModuleDeclaration.prototype.isAmbient = function () { - return hasFlag(this.modFlags, ModuleFlags.Ambient); - }; - ModuleDeclaration.prototype.isEnum = function () { - return hasFlag(this.modFlags, ModuleFlags.IsEnum); - }; + ModuleDeclaration.prototype.isExported = function () { return hasFlag(this.modFlags, ModuleFlags.Exported); }; + ModuleDeclaration.prototype.isAmbient = function () { return hasFlag(this.modFlags, ModuleFlags.Ambient); }; + ModuleDeclaration.prototype.isEnum = function () { return hasFlag(this.modFlags, ModuleFlags.IsEnum); }; ModuleDeclaration.prototype.recordNonInterface = function () { this.modFlags &= ~ModuleFlags.ShouldEmitModuleDecl; }; @@ -3664,15 +3589,9 @@ var TypeScript; _super.call(this, nodeType); this.flags |= ASTFlags.IsStatement; } - Statement.prototype.isLoop = function () { - return false; - }; - Statement.prototype.isStatementOrExpression = function () { - return true; - }; - Statement.prototype.isCompoundStatement = function () { - return this.isLoop(); - }; + Statement.prototype.isLoop = function () { return false; }; + Statement.prototype.isStatementOrExpression = function () { return true; }; + Statement.prototype.isCompoundStatement = function () { return this.isLoop(); }; Statement.prototype.typeCheck = function (typeFlow) { this.type = typeFlow.voidType; return this; @@ -3776,9 +3695,7 @@ var TypeScript; this.target = null; this.resolvedTarget = null; } - Jump.prototype.hasExplicitTarget = function () { - return (this.target); - }; + Jump.prototype.hasExplicitTarget = function () { return (this.target); }; Jump.prototype.setResolvedTarget = function (parser, stmt) { if (stmt.isLoop()) { this.resolvedTarget = stmt; @@ -3829,9 +3746,7 @@ var TypeScript; this.cond = cond; this.body = null; } - WhileStatement.prototype.isLoop = function () { - return true; - }; + WhileStatement.prototype.isLoop = function () { return true; }; WhileStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -3884,9 +3799,7 @@ var TypeScript; this.whileAST = null; this.cond = null; } - DoWhileStatement.prototype.isLoop = function () { - return true; - }; + DoWhileStatement.prototype.isLoop = function () { return true; }; DoWhileStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -3942,9 +3855,7 @@ var TypeScript; this.elseBod = null; this.statement = new ASTSpan(); } - IfStatement.prototype.isCompoundStatement = function () { - return true; - }; + IfStatement.prototype.isCompoundStatement = function () { return true; }; IfStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -4064,9 +3975,7 @@ var TypeScript; this.lval.varFlags |= VarFlags.AutoInit; } } - ForInStatement.prototype.isLoop = function () { - return true; - }; + ForInStatement.prototype.isLoop = function () { return true; }; ForInStatement.prototype.isFiltered = function () { if (this.body) { var singleItem = null; @@ -4093,13 +4002,16 @@ var TypeScript; var target = cond.target; if (target.nodeType == NodeType.Dot) { var binex = target; - if ((binex.operand1.nodeType == NodeType.Name) && (this.obj.nodeType == NodeType.Name) && (binex.operand1.actualText == this.obj.actualText)) { + if ((binex.operand1.nodeType == NodeType.Name) && + (this.obj.nodeType == NodeType.Name) && + (binex.operand1.actualText == this.obj.actualText)) { var prop = binex.operand2; if (prop.actualText == "hasOwnProperty") { var args = cond.arguments; if ((args !== null) && (args.members.length == 1)) { var arg = args.members[0]; - if ((arg.nodeType == NodeType.Name) && (this.lval.nodeType == NodeType.Name)) { + if ((arg.nodeType == NodeType.Name) && + (this.lval.nodeType == NodeType.Name)) { if ((this.lval.actualText) == arg.actualText) { return true; } @@ -4173,9 +4085,7 @@ var TypeScript; _super.call(this, NodeType.For); this.init = init; } - ForStatement.prototype.isLoop = function () { - return true; - }; + ForStatement.prototype.isLoop = function () { return true; }; ForStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -4267,9 +4177,7 @@ var TypeScript; this.expr = expr; this.withSym = null; } - WithStatement.prototype.isCompoundStatement = function () { - return true; - }; + WithStatement.prototype.isCompoundStatement = function () { return true; }; WithStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -4296,9 +4204,7 @@ var TypeScript; this.defaultCase = null; this.statement = new ASTSpan(); } - SwitchStatement.prototype.isCompoundStatement = function () { - return true; - }; + SwitchStatement.prototype.isCompoundStatement = function () { return true; }; SwitchStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -4452,9 +4358,7 @@ var TypeScript; this.tryNode = tryNode; this.finallyNode = finallyNode; } - TryFinally.prototype.isCompoundStatement = function () { - return true; - }; + TryFinally.prototype.isCompoundStatement = function () { return true; }; TryFinally.prototype.emit = function (emitter, tokenId, startLine) { emitter.recordSourceMappingStart(this); emitter.emitJavascript(this.tryNode, TokenID.Try, false); @@ -4499,9 +4403,7 @@ var TypeScript; this.tryNode = tryNode; this.catchNode = catchNode; } - TryCatch.prototype.isCompoundStatement = function () { - return true; - }; + TryCatch.prototype.isCompoundStatement = function () { return true; }; TryCatch.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); diff --git a/tests/baselines/reference/parserRealSource14.js b/tests/baselines/reference/parserRealSource14.js index 9b9ee2bcf84..540296e6973 100644 --- a/tests/baselines/reference/parserRealSource14.js +++ b/tests/baselines/reference/parserRealSource14.js @@ -607,9 +607,7 @@ var TypeScript; }; AstPath.prototype.clone = function () { var clone = new AstPath(); - clone.asts = this.asts.map(function (value) { - return value; - }); + clone.asts = this.asts.map(function (value) { return value; }); clone.top = this.top; return clone; }; @@ -658,167 +656,288 @@ var TypeScript; AstPath.prototype.isNameOfClass = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.ClassDeclaration) && (this.parent().name === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.ClassDeclaration) && + (this.parent().name === this.ast()); }; AstPath.prototype.isNameOfInterface = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.InterfaceDeclaration) && (this.parent().name === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.InterfaceDeclaration) && + (this.parent().name === this.ast()); }; AstPath.prototype.isNameOfArgument = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.ArgDecl) && (this.parent().id === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.ArgDecl) && + (this.parent().id === this.ast()); }; AstPath.prototype.isNameOfVariable = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.VarDecl) && (this.parent().id === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.VarDecl) && + (this.parent().id === this.ast()); }; AstPath.prototype.isNameOfModule = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.ModuleDeclaration) && (this.parent().name === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.ModuleDeclaration) && + (this.parent().name === this.ast()); }; AstPath.prototype.isNameOfFunction = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.FuncDecl) && (this.parent().name === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.FuncDecl) && + (this.parent().name === this.ast()); }; AstPath.prototype.isChildOfScript = function () { var ast = lastOf(this.asts); - return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.Script; + return this.count() >= 3 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.Script; }; AstPath.prototype.isChildOfModule = function () { var ast = lastOf(this.asts); - return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.ModuleDeclaration; + return this.count() >= 3 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.ModuleDeclaration; }; AstPath.prototype.isChildOfClass = function () { var ast = lastOf(this.asts); - return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.ClassDeclaration; + return this.count() >= 3 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.ClassDeclaration; }; AstPath.prototype.isArgumentOfClassConstructor = function () { var ast = lastOf(this.asts); - return this.count() >= 5 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 3].nodeType === TypeScript.NodeType.List && this.asts[this.top - 4].nodeType === TypeScript.NodeType.ClassDeclaration && (this.asts[this.top - 2].isConstructor) && (this.asts[this.top - 2].arguments === this.asts[this.top - 1]) && (this.asts[this.top - 4].constructorDecl === this.asts[this.top - 2]); + return this.count() >= 5 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl && + this.asts[this.top - 3].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 4].nodeType === TypeScript.NodeType.ClassDeclaration && + (this.asts[this.top - 2].isConstructor) && + (this.asts[this.top - 2].arguments === this.asts[this.top - 1]) && + (this.asts[this.top - 4].constructorDecl === this.asts[this.top - 2]); }; AstPath.prototype.isChildOfInterface = function () { var ast = lastOf(this.asts); - return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.InterfaceDeclaration; + return this.count() >= 3 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.InterfaceDeclaration; }; AstPath.prototype.isTopLevelImplicitModule = function () { - return this.count() >= 1 && this.asts[this.top].nodeType === TypeScript.NodeType.ModuleDeclaration && TypeScript.hasFlag(this.asts[this.top].modFlags, TypeScript.ModuleFlags.IsWholeFile); + return this.count() >= 1 && + this.asts[this.top].nodeType === TypeScript.NodeType.ModuleDeclaration && + TypeScript.hasFlag(this.asts[this.top].modFlags, TypeScript.ModuleFlags.IsWholeFile); }; AstPath.prototype.isBodyOfTopLevelImplicitModule = function () { - return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0] && TypeScript.hasFlag(this.asts[this.top - 1].modFlags, TypeScript.ModuleFlags.IsWholeFile); + return this.count() >= 2 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration && + this.asts[this.top - 1].members == this.asts[this.top - 0] && + TypeScript.hasFlag(this.asts[this.top - 1].modFlags, TypeScript.ModuleFlags.IsWholeFile); }; AstPath.prototype.isBodyOfScript = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Script && this.asts[this.top - 1].bod == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Script && + this.asts[this.top - 1].bod == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfSwitch = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Switch && this.asts[this.top - 1].caseList == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Switch && + this.asts[this.top - 1].caseList == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfModule = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration && + this.asts[this.top - 1].members == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfClass = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ClassDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ClassDeclaration && + this.asts[this.top - 1].members == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfFunction = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 1].bod == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl && + this.asts[this.top - 1].bod == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfInterface = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.InterfaceDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.InterfaceDeclaration && + this.asts[this.top - 1].members == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfBlock = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Block && this.asts[this.top - 1].statements == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Block && + this.asts[this.top - 1].statements == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfFor = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.For && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.For && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfCase = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Case && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Case && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfTry = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Try && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Try && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfCatch = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Catch && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Catch && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfDoWhile = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.DoWhile && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.DoWhile && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfWhile = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.While && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.While && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfForIn = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ForIn && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ForIn && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfWith = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.With && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.With && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfFinally = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Finally && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Finally && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isCaseOfSwitch = function () { - return this.count() >= 3 && this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].caseList == this.asts[this.top - 1]; + return this.count() >= 3 && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].caseList == this.asts[this.top - 1]; }; AstPath.prototype.isDefaultCaseOfSwitch = function () { - return this.count() >= 3 && this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].caseList == this.asts[this.top - 1] && this.asts[this.top - 2].defaultCase == this.asts[this.top - 0]; + return this.count() >= 3 && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].caseList == this.asts[this.top - 1] && + this.asts[this.top - 2].defaultCase == this.asts[this.top - 0]; }; AstPath.prototype.isListOfObjectLit = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].operand == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].operand == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfObjectLit = function () { return this.isListOfObjectLit(); }; AstPath.prototype.isEmptyListOfObjectLit = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].operand == this.asts[this.top - 0] && this.asts[this.top - 0].members.length == 0; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].operand == this.asts[this.top - 0] && + this.asts[this.top - 0].members.length == 0; }; AstPath.prototype.isMemberOfObjectLit = function () { - return this.count() >= 3 && this.asts[this.top - 2].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 0].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 2].operand == this.asts[this.top - 1]; + return this.count() >= 3 && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.ObjectLit && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.Member && + this.asts[this.top - 2].operand == this.asts[this.top - 1]; }; AstPath.prototype.isNameOfMemberOfObjectLit = function () { - return this.count() >= 4 && this.asts[this.top - 3].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 2].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 0].nodeType === TypeScript.NodeType.Name && this.asts[this.top - 3].operand == this.asts[this.top - 2]; + return this.count() >= 4 && + this.asts[this.top - 3].nodeType === TypeScript.NodeType.ObjectLit && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.Name && + this.asts[this.top - 3].operand == this.asts[this.top - 2]; }; AstPath.prototype.isListOfArrayLit = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ArrayLit && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].operand == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ArrayLit && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].operand == this.asts[this.top - 0]; }; AstPath.prototype.isTargetOfMember = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 1].operand1 === this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && + this.asts[this.top - 1].operand1 === this.asts[this.top - 0]; }; AstPath.prototype.isMemberOfMember = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 1].operand2 === this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && + this.asts[this.top - 1].operand2 === this.asts[this.top - 0]; }; AstPath.prototype.isItemOfList = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List; //(this.asts[this.top - 1]).operand2 === this.asts[this.top - 0]; }; AstPath.prototype.isThenOfIf = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.If && this.asts[this.top - 1].thenBod == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.If && + this.asts[this.top - 1].thenBod == this.asts[this.top - 0]; }; AstPath.prototype.isElseOfIf = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.If && this.asts[this.top - 1].elseBod == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.If && + this.asts[this.top - 1].elseBod == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfDefaultCase = function () { return this.isBodyOfCase(); }; AstPath.prototype.isSingleStatementList = function () { - return this.count() >= 1 && this.asts[this.top].nodeType === TypeScript.NodeType.List && this.asts[this.top].members.length === 1; + return this.count() >= 1 && + this.asts[this.top].nodeType === TypeScript.NodeType.List && + this.asts[this.top].members.length === 1; }; AstPath.prototype.isArgumentListOfFunction = function () { - return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 1].arguments === this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl && + this.asts[this.top - 1].arguments === this.asts[this.top - 0]; }; AstPath.prototype.isArgumentOfFunction = function () { - return this.count() >= 3 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 2].arguments === this.asts[this.top - 1]; + return this.count() >= 3 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl && + this.asts[this.top - 2].arguments === this.asts[this.top - 1]; }; AstPath.prototype.isArgumentListOfCall = function () { - return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Call && this.asts[this.top - 1].arguments === this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Call && + this.asts[this.top - 1].arguments === this.asts[this.top - 0]; }; AstPath.prototype.isArgumentListOfNew = function () { - return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.New && this.asts[this.top - 1].arguments === this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.New && + this.asts[this.top - 1].arguments === this.asts[this.top - 0]; }; AstPath.prototype.isSynthesizedBlock = function () { - return this.count() >= 1 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.Block && this.asts[this.top - 0].isStatementBlock === false; + return this.count() >= 1 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.Block && + this.asts[this.top - 0].isStatementBlock === false; }; return AstPath; })(); @@ -879,7 +998,9 @@ var TypeScript; // bar // 0123 // If "position == 3", the caret is at the "right" of the "r" character, which should be considered valid - var inclusive = hasFlag(options, 1 /* EdgeInclusive */) || cur.nodeType === TypeScript.NodeType.Name || pos === script.limChar; // Special "EOF" case + var inclusive = hasFlag(options, 1 /* EdgeInclusive */) || + cur.nodeType === TypeScript.NodeType.Name || + pos === script.limChar; // Special "EOF" case var minChar = cur.minChar; var limChar = cur.limChar + (inclusive ? 1 : 0); if (pos >= minChar && pos < limChar) { diff --git a/tests/baselines/reference/parserRealSource4.js b/tests/baselines/reference/parserRealSource4.js index 1d6ed0aaf13..563e9e92a08 100644 --- a/tests/baselines/reference/parserRealSource4.js +++ b/tests/baselines/reference/parserRealSource4.js @@ -377,9 +377,7 @@ var TypeScript; } return false; }; - StringHashTable.prototype.count = function () { - return this.itemCount; - }; + StringHashTable.prototype.count = function () { return this.itemCount; }; StringHashTable.prototype.lookup = function (key) { var data = this.table[key]; if (data != undefined) { @@ -515,9 +513,7 @@ var TypeScript; } return result; }; - HashTable.prototype.count = function () { - return this.itemCount; - }; + HashTable.prototype.count = function () { return this.itemCount; }; HashTable.prototype.lookup = function (key) { var current; var val = this.hashFn(key); diff --git a/tests/baselines/reference/parserRealSource6.js b/tests/baselines/reference/parserRealSource6.js index e747b95e610..d65207b8c77 100644 --- a/tests/baselines/reference/parserRealSource6.js +++ b/tests/baselines/reference/parserRealSource6.js @@ -329,7 +329,8 @@ var TypeScript; // is has not been fully re-parsed yet. if (ast.nodeType == NodeType.Script && context.pos > limChar) limChar = context.pos; - if ((minChar <= context.pos) && (limChar >= context.pos)) { + if ((minChar <= context.pos) && + (limChar >= context.pos)) { switch (ast.nodeType) { case NodeType.Script: var script = ast; diff --git a/tests/baselines/reference/parserRealSource7.js b/tests/baselines/reference/parserRealSource7.js index c8dd3ae1b15..5073c33febd 100644 --- a/tests/baselines/reference/parserRealSource7.js +++ b/tests/baselines/reference/parserRealSource7.js @@ -1053,7 +1053,8 @@ var TypeScript; if (isExported) { typeSymbol.flags |= SymbolFlags.Exported; } - if ((context.scopeChain.moduleDecl) || (context.scopeChain.container == context.checker.gloMod)) { + if ((context.scopeChain.moduleDecl) || + (context.scopeChain.container == context.checker.gloMod)) { typeSymbol.flags |= SymbolFlags.ModuleMember; } moduleDecl.mod = modType; @@ -1079,7 +1080,11 @@ var TypeScript; // REVIEW-CLASSES if (!typeSymbol) { var valTypeSymbol = scopeChain.scope.findLocal(className, false, false); - if (valTypeSymbol && valTypeSymbol.isType() && valTypeSymbol.declAST && valTypeSymbol.declAST.nodeType == NodeType.FuncDecl && valTypeSymbol.declAST.isSignature()) { + if (valTypeSymbol && + valTypeSymbol.isType() && + valTypeSymbol.declAST && + valTypeSymbol.declAST.nodeType == NodeType.FuncDecl && + valTypeSymbol.declAST.isSignature()) { typeSymbol = valTypeSymbol; foundValSymbol = true; if (isExported) { @@ -1233,7 +1238,10 @@ var TypeScript; if (context.scopeChain.moduleDecl) { context.scopeChain.moduleDecl.recordNonInterface(); } - if (isProperty || isExported || (context.scopeChain.container == context.checker.gloMod) || context.scopeChain.moduleDecl) { + if (isProperty || + isExported || + (context.scopeChain.container == context.checker.gloMod) || + context.scopeChain.moduleDecl) { if (isAmbient) { var existingSym = scopeChain.scope.findLocal(varDecl.id.text, false, false); if (existingSym) { @@ -1254,7 +1262,8 @@ var TypeScript; } field.symbol = fieldSymbol; fieldSymbol.declAST = ast; - if ((context.scopeChain.moduleDecl) || (context.scopeChain.container == context.checker.gloMod)) { + if ((context.scopeChain.moduleDecl) || + (context.scopeChain.container == context.checker.gloMod)) { fieldSymbol.flags |= SymbolFlags.ModuleMember; fieldSymbol.declModule = context.scopeChain.moduleDecl; } @@ -1305,7 +1314,12 @@ var TypeScript; // If the parent is the constructor, and this isn't an instance method, skip it. // That way, we'll set the type during scope assignment, and can be sure that the // function will be placed in the constructor-local scope - if (!funcDecl.isConstructor && containerSym && containerSym.declAST && containerSym.declAST.nodeType == NodeType.FuncDecl && containerSym.declAST.isConstructor && !funcDecl.isMethod()) { + if (!funcDecl.isConstructor && + containerSym && + containerSym.declAST && + containerSym.declAST.nodeType == NodeType.FuncDecl && + containerSym.declAST.isConstructor && + !funcDecl.isMethod()) { return go; } // Interfaces and overloads @@ -1394,7 +1408,14 @@ var TypeScript; } } // REVIEW: Move this check into the typecheck phase? It's only being run over properties... - if (fgSym && !fgSym.isAccessor() && fgSym.type && fgSym.type.construct && fgSym.type.construct.signatures != [] && (fgSym.type.construct.signatures[0].declAST == null || !hasFlag(fgSym.type.construct.signatures[0].declAST.fncFlags, FncFlags.Ambient)) && !funcDecl.isConstructor) { + if (fgSym && + !fgSym.isAccessor() && + fgSym.type && + fgSym.type.construct && + fgSym.type.construct.signatures != [] && + (fgSym.type.construct.signatures[0].declAST == null || + !hasFlag(fgSym.type.construct.signatures[0].declAST.fncFlags, FncFlags.Ambient)) && + !funcDecl.isConstructor) { context.checker.errorReporter.simpleError(funcDecl, "Functions may not have class overloads"); } if (fgSym && !(fgSym.kind() == SymbolKind.Type) && funcDecl.isMethod() && !funcDecl.isAccessor() && !funcDecl.isConstructor) { diff --git a/tests/baselines/reference/parserRealSource8.js b/tests/baselines/reference/parserRealSource8.js index fcdb170ae12..8a667ad6dbe 100644 --- a/tests/baselines/reference/parserRealSource8.js +++ b/tests/baselines/reference/parserRealSource8.js @@ -632,7 +632,8 @@ var TypeScript; // the enclosing scope // REVIEW: Some twisted logic here - this needs to be cleaned up once old classes are removed // - if it's a new class, always use the contained scope, since we initialize the constructor scope below - if (context.scopeChain.thisType && (!funcDecl.isConstructor || hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod))) { + if (context.scopeChain.thisType && + (!funcDecl.isConstructor || hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod))) { var instType = context.scopeChain.thisType; if (!(instType.typeFlags & TypeFlags.IsClass) && !hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod)) { if (!funcDecl.isMethod() || isStatic) { @@ -644,7 +645,10 @@ var TypeScript; } } else { - if (context.scopeChain.previous.scope.container && context.scopeChain.previous.scope.container.declAST && context.scopeChain.previous.scope.container.declAST.nodeType == NodeType.FuncDecl && context.scopeChain.previous.scope.container.declAST.isConstructor) { + if (context.scopeChain.previous.scope.container && + context.scopeChain.previous.scope.container.declAST && + context.scopeChain.previous.scope.container.declAST.nodeType == NodeType.FuncDecl && + context.scopeChain.previous.scope.container.declAST.isConstructor) { // if the parent is the class constructor, use the constructor scope parentScope = instType.constructorScope; } @@ -681,7 +685,12 @@ var TypeScript; outerFnc.innerStaticFuncs[outerFnc.innerStaticFuncs.length] = funcDecl; } else { - if (!funcDecl.isConstructor && container && container.declAST && container.declAST.nodeType == NodeType.FuncDecl && container.declAST.isConstructor && !funcDecl.isMethod()) { + if (!funcDecl.isConstructor && + container && + container.declAST && + container.declAST.nodeType == NodeType.FuncDecl && + container.declAST.isConstructor && + !funcDecl.isMethod()) { funcScope = context.scopeChain.thisType.constructorScope; //locals; } else { @@ -702,7 +711,11 @@ var TypeScript; } context.typeFlow.checker.createFunctionSignature(funcDecl, container, funcScope, fgSym, fgSym == null); // it's a getter or setter for a class property - if (!funcDecl.accessorSymbol && (funcDecl.fncFlags & FncFlags.ClassMethod) && container && ((!fgSym || fgSym.declAST.nodeType != NodeType.FuncDecl) && funcDecl.isAccessor()) || (fgSym && fgSym.isAccessor())) { + if (!funcDecl.accessorSymbol && + (funcDecl.fncFlags & FncFlags.ClassMethod) && + container && + ((!fgSym || fgSym.declAST.nodeType != NodeType.FuncDecl) && funcDecl.isAccessor()) || + (fgSym && fgSym.isAccessor())) { funcDecl.accessorSymbol = context.typeFlow.checker.createAccessorSymbol(funcDecl, fgSym, container.getType(), (funcDecl.isMethod() && isStatic), true, funcScope, container); } funcDecl.type.symbol.flags |= SymbolFlags.TypeSetDuringScopeAssignment; diff --git a/tests/baselines/reference/parserReturnStatement4.js b/tests/baselines/reference/parserReturnStatement4.js index 3a993697cc6..f6800cbb8fd 100644 --- a/tests/baselines/reference/parserReturnStatement4.js +++ b/tests/baselines/reference/parserReturnStatement4.js @@ -2,6 +2,4 @@ var v = { get foo() { return } }; //// [parserReturnStatement4.js] -var v = { get foo() { - return; -} }; +var v = { get foo() { return; } }; diff --git a/tests/baselines/reference/parserSymbolIndexer1.errors.txt b/tests/baselines/reference/parserSymbolIndexer1.errors.txt new file mode 100644 index 00000000000..5c6c38d52b1 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer1.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts (1 errors) ==== + interface I { + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer1.js b/tests/baselines/reference/parserSymbolIndexer1.js new file mode 100644 index 00000000000..752391dad53 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer1.js @@ -0,0 +1,6 @@ +//// [parserSymbolIndexer1.ts] +interface I { + [s: symbol]: string; +} + +//// [parserSymbolIndexer1.js] diff --git a/tests/baselines/reference/parserSymbolIndexer2.errors.txt b/tests/baselines/reference/parserSymbolIndexer2.errors.txt new file mode 100644 index 00000000000..3961f4942de --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer2.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts (1 errors) ==== + class C { + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer2.js b/tests/baselines/reference/parserSymbolIndexer2.js new file mode 100644 index 00000000000..563614e1c8c --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer2.js @@ -0,0 +1,11 @@ +//// [parserSymbolIndexer2.ts] +class C { + [s: symbol]: string; +} + +//// [parserSymbolIndexer2.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserSymbolIndexer3.errors.txt b/tests/baselines/reference/parserSymbolIndexer3.errors.txt new file mode 100644 index 00000000000..5484a096d4c --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer3.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts(2,13): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts (1 errors) ==== + class C { + static [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer3.js b/tests/baselines/reference/parserSymbolIndexer3.js new file mode 100644 index 00000000000..917945193ae --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer3.js @@ -0,0 +1,11 @@ +//// [parserSymbolIndexer3.ts] +class C { + static [s: symbol]: string; +} + +//// [parserSymbolIndexer3.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserSymbolIndexer4.errors.txt b/tests/baselines/reference/parserSymbolIndexer4.errors.txt new file mode 100644 index 00000000000..1cf184a4847 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer4.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts (1 errors) ==== + var x: { + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer4.js b/tests/baselines/reference/parserSymbolIndexer4.js new file mode 100644 index 00000000000..21367ca5969 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer4.js @@ -0,0 +1,7 @@ +//// [parserSymbolIndexer4.ts] +var x: { + [s: symbol]: string; +} + +//// [parserSymbolIndexer4.js] +var x; diff --git a/tests/baselines/reference/parserSymbolIndexer5.errors.txt b/tests/baselines/reference/parserSymbolIndexer5.errors.txt new file mode 100644 index 00000000000..a8c19338e01 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer5.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,6): error TS2304: Cannot find name 's'. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,7): error TS1005: ']' expected. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,9): error TS2304: Cannot find name 'symbol'. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,15): error TS1005: ',' expected. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,16): error TS1136: Property assignment expected. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(3,1): error TS1005: ':' expected. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts (6 errors) ==== + var x = { + [s: symbol]: "" + ~ +!!! error TS2304: Cannot find name 's'. + ~ +!!! error TS1005: ']' expected. + ~~~~~~ +!!! error TS2304: Cannot find name 'symbol'. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1136: Property assignment expected. + } + ~ +!!! error TS1005: ':' expected. \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer5.js b/tests/baselines/reference/parserSymbolIndexer5.js new file mode 100644 index 00000000000..3aa046e2114 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer5.js @@ -0,0 +1,9 @@ +//// [parserSymbolIndexer5.ts] +var x = { + [s: symbol]: "" +} + +//// [parserSymbolIndexer5.js] +var x = { + [s]: symbol, "": +}; diff --git a/tests/baselines/reference/parserSymbolProperty1.js b/tests/baselines/reference/parserSymbolProperty1.js new file mode 100644 index 00000000000..6bcede608fb --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty1.js @@ -0,0 +1,6 @@ +//// [parserSymbolProperty1.ts] +interface I { + [Symbol.iterator]: string; +} + +//// [parserSymbolProperty1.js] diff --git a/tests/baselines/reference/parserSymbolProperty1.types b/tests/baselines/reference/parserSymbolProperty1.types new file mode 100644 index 00000000000..6c0cd75cf59 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty1.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty1.ts === +interface I { +>I : I + + [Symbol.iterator]: string; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty2.js b/tests/baselines/reference/parserSymbolProperty2.js new file mode 100644 index 00000000000..6530072d46f --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty2.js @@ -0,0 +1,6 @@ +//// [parserSymbolProperty2.ts] +interface I { + [Symbol.unscopables](): string; +} + +//// [parserSymbolProperty2.js] diff --git a/tests/baselines/reference/parserSymbolProperty2.types b/tests/baselines/reference/parserSymbolProperty2.types new file mode 100644 index 00000000000..bcf14b83a2a --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty2.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty2.ts === +interface I { +>I : I + + [Symbol.unscopables](): string; +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty3.js b/tests/baselines/reference/parserSymbolProperty3.js new file mode 100644 index 00000000000..5b1b48254b1 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty3.js @@ -0,0 +1,6 @@ +//// [parserSymbolProperty3.ts] +declare class C { + [Symbol.unscopables](): string; +} + +//// [parserSymbolProperty3.js] diff --git a/tests/baselines/reference/parserSymbolProperty3.types b/tests/baselines/reference/parserSymbolProperty3.types new file mode 100644 index 00000000000..977375d7393 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty3.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty3.ts === +declare class C { +>C : C + + [Symbol.unscopables](): string; +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty4.js b/tests/baselines/reference/parserSymbolProperty4.js new file mode 100644 index 00000000000..f79db0b1d79 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty4.js @@ -0,0 +1,6 @@ +//// [parserSymbolProperty4.ts] +declare class C { + [Symbol.isRegExp]: string; +} + +//// [parserSymbolProperty4.js] diff --git a/tests/baselines/reference/parserSymbolProperty4.types b/tests/baselines/reference/parserSymbolProperty4.types new file mode 100644 index 00000000000..a9070897fa8 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty4.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty4.ts === +declare class C { +>C : C + + [Symbol.isRegExp]: string; +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty5.js b/tests/baselines/reference/parserSymbolProperty5.js new file mode 100644 index 00000000000..922e1fb0323 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty5.js @@ -0,0 +1,11 @@ +//// [parserSymbolProperty5.ts] +class C { + [Symbol.isRegExp]: string; +} + +//// [parserSymbolProperty5.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserSymbolProperty5.types b/tests/baselines/reference/parserSymbolProperty5.types new file mode 100644 index 00000000000..8a171598e83 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty5.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty5.ts === +class C { +>C : C + + [Symbol.isRegExp]: string; +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty6.js b/tests/baselines/reference/parserSymbolProperty6.js new file mode 100644 index 00000000000..cbc06cd2951 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty6.js @@ -0,0 +1,12 @@ +//// [parserSymbolProperty6.ts] +class C { + [Symbol.toStringTag]: string = ""; +} + +//// [parserSymbolProperty6.js] +var C = (function () { + function C() { + this[Symbol.toStringTag] = ""; + } + return C; +})(); diff --git a/tests/baselines/reference/parserSymbolProperty6.types b/tests/baselines/reference/parserSymbolProperty6.types new file mode 100644 index 00000000000..660cbf4e545 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty6.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty6.ts === +class C { +>C : C + + [Symbol.toStringTag]: string = ""; +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty7.js b/tests/baselines/reference/parserSymbolProperty7.js new file mode 100644 index 00000000000..9368fd12855 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty7.js @@ -0,0 +1,12 @@ +//// [parserSymbolProperty7.ts] +class C { + [Symbol.toStringTag](): void { } +} + +//// [parserSymbolProperty7.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.toStringTag] = function () { }; + return C; +})(); diff --git a/tests/baselines/reference/parserSymbolProperty7.types b/tests/baselines/reference/parserSymbolProperty7.types new file mode 100644 index 00000000000..f8dc2523692 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty7.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty7.ts === +class C { +>C : C + + [Symbol.toStringTag](): void { } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty8.js b/tests/baselines/reference/parserSymbolProperty8.js new file mode 100644 index 00000000000..f312ede6b1d --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty8.js @@ -0,0 +1,7 @@ +//// [parserSymbolProperty8.ts] +var x: { + [Symbol.toPrimitive](): string +} + +//// [parserSymbolProperty8.js] +var x; diff --git a/tests/baselines/reference/parserSymbolProperty8.types b/tests/baselines/reference/parserSymbolProperty8.types new file mode 100644 index 00000000000..06387c9c231 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty8.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts === +var x: { +>x : { [Symbol.toPrimitive](): string; } + + [Symbol.toPrimitive](): string +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty9.js b/tests/baselines/reference/parserSymbolProperty9.js new file mode 100644 index 00000000000..6efc6650ea0 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty9.js @@ -0,0 +1,7 @@ +//// [parserSymbolProperty9.ts] +var x: { + [Symbol.toPrimitive]: string +} + +//// [parserSymbolProperty9.js] +var x; diff --git a/tests/baselines/reference/parserSymbolProperty9.types b/tests/baselines/reference/parserSymbolProperty9.types new file mode 100644 index 00000000000..40fbde2acff --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty9.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts === +var x: { +>x : { [Symbol.toPrimitive]: string; } + + [Symbol.toPrimitive]: string +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol +} diff --git a/tests/baselines/reference/parserharness.js b/tests/baselines/reference/parserharness.js index 7299abf6818..02304380013 100644 --- a/tests/baselines/reference/parserharness.js +++ b/tests/baselines/reference/parserharness.js @@ -2627,9 +2627,7 @@ var Harness; var description = b.description + (prop ? ": " + prop : ''); emitLog('testStart', { desc: description }); emitLog('pass', { - desc: description, - pass: true, - perfResults: { + desc: description, pass: true, perfResults: { mean: b.results[prop].mean(), min: b.results[prop].min(), max: b.results[prop].max(), @@ -2694,18 +2692,10 @@ var Harness; this.fileCollection[s] = writer; return writer; }; - EmitterIOHost.prototype.directoryExists = function (s) { - return false; - }; - EmitterIOHost.prototype.fileExists = function (s) { - return typeof this.fileCollection[s] !== 'undefined'; - }; - EmitterIOHost.prototype.resolvePath = function (s) { - return s; - }; - EmitterIOHost.prototype.reset = function () { - this.fileCollection = {}; - }; + EmitterIOHost.prototype.directoryExists = function (s) { return false; }; + EmitterIOHost.prototype.fileExists = function (s) { return typeof this.fileCollection[s] !== 'undefined'; }; + EmitterIOHost.prototype.resolvePath = function (s) { return s; }; + EmitterIOHost.prototype.reset = function () { this.fileCollection = {}; }; EmitterIOHost.prototype.toArray = function () { var result = []; for (var p in this.fileCollection) { @@ -3511,21 +3501,11 @@ var Harness; ////////////////////////////////////////////////////////////////////// // ILogger implementation // - TypeScriptLS.prototype.information = function () { - return false; - }; - TypeScriptLS.prototype.debug = function () { - return true; - }; - TypeScriptLS.prototype.warning = function () { - return true; - }; - TypeScriptLS.prototype.error = function () { - return true; - }; - TypeScriptLS.prototype.fatal = function () { - return true; - }; + TypeScriptLS.prototype.information = function () { return false; }; + TypeScriptLS.prototype.debug = function () { return true; }; + TypeScriptLS.prototype.warning = function () { return true; }; + TypeScriptLS.prototype.error = function () { return true; }; + TypeScriptLS.prototype.fatal = function () { return true; }; TypeScriptLS.prototype.log = function (s) { // For debugging... //IO.printLine("TypeScriptLS:" + s); diff --git a/tests/baselines/reference/parserindenter.js b/tests/baselines/reference/parserindenter.js index 514a24afcf6..511e75ea135 100644 --- a/tests/baselines/reference/parserindenter.js +++ b/tests/baselines/reference/parserindenter.js @@ -778,7 +778,10 @@ var Formatting; } Indenter.prototype.GetIndentationEdits = function (token, nextToken, node, sameLineIndent) { if (this.logger.information()) { - this.logger.log("GetIndentationEdits(" + "t1=[" + token.Span.startPosition() + "," + token.Span.endPosition() + "], " + "t2=[" + (nextToken == null ? "null" : (nextToken.Span.startPosition() + "," + nextToken.Span.endPosition())) + "]" + ")"); + this.logger.log("GetIndentationEdits(" + + "t1=[" + token.Span.startPosition() + "," + token.Span.endPosition() + "], " + + "t2=[" + (nextToken == null ? "null" : (nextToken.Span.startPosition() + "," + nextToken.Span.endPosition())) + "]" + + ")"); } var result = this.GetIndentationEditsWorker(token, nextToken, node, sameLineIndent); if (this.logger.information()) { @@ -938,7 +941,8 @@ var Formatting; }; Indenter.prototype.GetSpecialCaseIndentationForLCurly = function (node) { var indentationInfo = null; - if (node.AuthorNode.Details.Kind == AuthorParseNodeKind.apnkFncDecl || node.AuthorNode.EdgeLabel == AuthorParseNodeEdge.apneThen || node.AuthorNode.EdgeLabel == AuthorParseNodeEdge.apneElse) { + if (node.AuthorNode.Details.Kind == AuthorParseNodeKind.apnkFncDecl || + node.AuthorNode.EdgeLabel == AuthorParseNodeEdge.apneThen || node.AuthorNode.EdgeLabel == AuthorParseNodeEdge.apneElse) { // flushed with the node (function & if) indentationInfo = node.GetNodeStartLineIndentation(this); return indentationInfo; @@ -1233,7 +1237,8 @@ var Formatting; // Get the parent that is really on a different line from the self node var startNodeLineNumber = this.snapshot.GetLineNumberFromPosition(tree.StartNodeSelf.AuthorNode.Details.StartOffset); parent = tree.StartNodeSelf.Parent; - while (parent != null && startNodeLineNumber == this.snapshot.GetLineNumberFromPosition(parent.AuthorNode.Details.StartOffset)) { + while (parent != null && + startNodeLineNumber == this.snapshot.GetLineNumberFromPosition(parent.AuthorNode.Details.StartOffset)) { parent = parent.Parent; } } @@ -1331,7 +1336,8 @@ var Formatting; } }; Indenter.prototype.IsMultiLineString = function (token) { - return token.tokenID === TypeScript.TokenID.StringLiteral && this.snapshot.GetLineNumberFromPosition(token.Span.endPosition()) > this.snapshot.GetLineNumberFromPosition(token.Span.startPosition()); + return token.tokenID === TypeScript.TokenID.StringLiteral && + this.snapshot.GetLineNumberFromPosition(token.Span.endPosition()) > this.snapshot.GetLineNumberFromPosition(token.Span.startPosition()); }; return Indenter; })(); diff --git a/tests/baselines/reference/plusOperatorWithBooleanType.js b/tests/baselines/reference/plusOperatorWithBooleanType.js index 3de502f5ff6..5af1a8fb903 100644 --- a/tests/baselines/reference/plusOperatorWithBooleanType.js +++ b/tests/baselines/reference/plusOperatorWithBooleanType.js @@ -38,15 +38,11 @@ var ResultIsNumber7 = +A.foo(); //// [plusOperatorWithBooleanType.js] // + operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/plusOperatorWithNumberType.js b/tests/baselines/reference/plusOperatorWithNumberType.js index fa993b80f87..a0adaa5dec2 100644 --- a/tests/baselines/reference/plusOperatorWithNumberType.js +++ b/tests/baselines/reference/plusOperatorWithNumberType.js @@ -45,15 +45,11 @@ var ResultIsNumber11 = +(NUMBER + NUMBER); // + operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -67,9 +63,7 @@ var ResultIsNumber2 = +NUMBER1; // number type literal var ResultIsNumber3 = +1; var ResultIsNumber4 = +{ x: 1, y: 2 }; -var ResultIsNumber5 = +{ x: 1, y: function (n) { - return n; -} }; +var ResultIsNumber5 = +{ x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsNumber6 = +objA.a; var ResultIsNumber7 = +M.n; diff --git a/tests/baselines/reference/plusOperatorWithStringType.js b/tests/baselines/reference/plusOperatorWithStringType.js index 93af186ce8f..ed2c60111b3 100644 --- a/tests/baselines/reference/plusOperatorWithStringType.js +++ b/tests/baselines/reference/plusOperatorWithStringType.js @@ -44,15 +44,11 @@ var ResultIsNumber12 = +STRING.charAt(0); // + operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -66,9 +62,7 @@ var ResultIsNumber2 = +STRING1; // string type literal var ResultIsNumber3 = +""; var ResultIsNumber4 = +{ x: "", y: "" }; -var ResultIsNumber5 = +{ x: "", y: function (s) { - return s; -} }; +var ResultIsNumber5 = +{ x: "", y: function (s) { return s; } }; // string type expressions var ResultIsNumber6 = +objA.a; var ResultIsNumber7 = +M.n; diff --git a/tests/baselines/reference/primitiveMembers.js b/tests/baselines/reference/primitiveMembers.js index f41d2a65bba..bf3f1a17105 100644 --- a/tests/baselines/reference/primitiveMembers.js +++ b/tests/baselines/reference/primitiveMembers.js @@ -65,8 +65,6 @@ var foo = (function (_super) { function foo() { _super.apply(this, arguments); } - foo.prototype.bar = function () { - return undefined; - }; + foo.prototype.bar = function () { return undefined; }; return foo; })(baz); diff --git a/tests/baselines/reference/privateClassPropertyAccessibleWithinClass.js b/tests/baselines/reference/privateClassPropertyAccessibleWithinClass.js index 61d1a44b121..116b255a921 100644 --- a/tests/baselines/reference/privateClassPropertyAccessibleWithinClass.js +++ b/tests/baselines/reference/privateClassPropertyAccessibleWithinClass.js @@ -37,34 +37,20 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.prototype.foo = function () { - return this.foo; - }; + C.prototype.foo = function () { return this.foo; }; Object.defineProperty(C, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.foo = function () { - return this.foo; - }; - C.bar = function () { - this.foo(); - }; + C.foo = function () { return this.foo; }; + C.bar = function () { this.foo(); }; return C; })(); // added level of function nesting @@ -79,9 +65,7 @@ var C2 = (function () { }, set: function (x) { var _this = this; - (function () { - _this.y = _this.x; - }); + (function () { _this.y = _this.x; }); }, enumerable: true, configurable: true @@ -98,9 +82,7 @@ var C2 = (function () { }, set: function (x) { var _this = this; - (function () { - _this.y = _this.x; - }); + (function () { _this.y = _this.x; }); }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/privateIndexer2.js b/tests/baselines/reference/privateIndexer2.js index 13849216ca0..5a36a9eae18 100644 --- a/tests/baselines/reference/privateIndexer2.js +++ b/tests/baselines/reference/privateIndexer2.js @@ -11,8 +11,9 @@ var y: { //// [privateIndexer2.js] // private indexers not allowed -var x = { - [x]: string, - string: -}; +var x = (_a = {}, _a[x] = +string, _a.string = +, +_a); var y; +var _a; diff --git a/tests/baselines/reference/privateInstanceVisibility.js b/tests/baselines/reference/privateInstanceVisibility.js index e1ccb287515..b730a763e1e 100644 --- a/tests/baselines/reference/privateInstanceVisibility.js +++ b/tests/baselines/reference/privateInstanceVisibility.js @@ -57,9 +57,7 @@ var Test; var C = (function () { function C() { } - C.prototype.getX = function () { - return this.x; - }; + C.prototype.getX = function () { return this.x; }; C.prototype.clone = function (other) { this.x = other.x; }; diff --git a/tests/baselines/reference/privateVisibility.js b/tests/baselines/reference/privateVisibility.js index 9565b6fc25d..d70d7b4756f 100644 --- a/tests/baselines/reference/privateVisibility.js +++ b/tests/baselines/reference/privateVisibility.js @@ -32,9 +32,7 @@ var Foo = (function () { this.pubProp = 0; this.privProp = 0; } - Foo.prototype.pubMeth = function () { - this.privMeth(); - }; + Foo.prototype.pubMeth = function () { this.privMeth(); }; Foo.prototype.privMeth = function () { }; return Foo; })(); diff --git a/tests/baselines/reference/privateVisibles.js b/tests/baselines/reference/privateVisibles.js index c9206964f80..b2cb673c681 100644 --- a/tests/baselines/reference/privateVisibles.js +++ b/tests/baselines/reference/privateVisibles.js @@ -15,8 +15,6 @@ var Foo = (function () { this.pvar = 0; var n = this.pvar; } - Foo.prototype.meth = function () { - var q = this.pvar; - }; + Foo.prototype.meth = function () { var q = this.pvar; }; return Foo; })(); diff --git a/tests/baselines/reference/propertyAccess.errors.txt b/tests/baselines/reference/propertyAccess.errors.txt index 5cffcbec64c..d9cd90a48fc 100644 --- a/tests/baselines/reference/propertyAccess.errors.txt +++ b/tests/baselines/reference/propertyAccess.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(45,14): error TS2339: Property 'qqq' does not exist on type '{ 10: string; x: string; y: number; z: { n: string; m: number; o: () => boolean; }; 'literal property': number; }'. -tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(80,10): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. -tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(117,10): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. -tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(80,10): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. +tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(117,10): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. +tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. ==== tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts (4 errors) ==== @@ -88,7 +88,7 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): er // Bracket notation property access using value of other type on type with numeric index signature and no string index signature var ll = numIndex[someObject]; // Error ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. // Bracket notation property access using string value on type with string index signature and no numeric index signature var mm = strIndex['N']; @@ -127,7 +127,7 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): er // Bracket notation property access using values of other types on type with no index signatures var uu = noIndex[someObject]; // Error ~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. // Bracket notation property access using numeric value on type with numeric index signature and string index signature var vv = noIndex[32]; @@ -152,7 +152,7 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): er // Bracket notation property access using value of other type on type with numeric index signature and no string index signature and string index signature var zzzz = bothIndex[someObject]; // Error ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. var x1 = numIndex[stringOrNumber]; var x1: any; diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js index 81cdcec5434..88baee7752e 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js @@ -92,9 +92,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ''; - }; + A.prototype.foo = function () { return ''; }; return A; })(); var B = (function (_super) { diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js index eb3770bc0b3..941adc7ab43 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js @@ -67,9 +67,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ''; - }; + A.prototype.foo = function () { return ''; }; return A; })(); var B = (function (_super) { diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js index 3a88ec832f7..fe3c9433796 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js @@ -54,9 +54,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ''; - }; + A.prototype.foo = function () { return ''; }; return A; })(); var B = (function (_super) { diff --git a/tests/baselines/reference/propertyAssignment.errors.txt b/tests/baselines/reference/propertyAssignment.errors.txt index 51850754a9a..47359caf9c2 100644 --- a/tests/baselines/reference/propertyAssignment.errors.txt +++ b/tests/baselines/reference/propertyAssignment.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/propertyAssignment.ts(6,13): error TS1170: Computed property names are not allowed in type literals. +tests/cases/compiler/propertyAssignment.ts(6,13): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/compiler/propertyAssignment.ts(6,14): error TS2304: Cannot find name 'index'. tests/cases/compiler/propertyAssignment.ts(14,1): error TS2322: Type '{ x: number; }' is not assignable to type 'new () => any'. tests/cases/compiler/propertyAssignment.ts(16,1): error TS2322: Type '{ x: number; }' is not assignable to type '() => void'. @@ -12,7 +12,7 @@ tests/cases/compiler/propertyAssignment.ts(16,1): error TS2322: Type '{ x: numbe var foo2: { [index]; } // should be an error, used to be indexer, now it is a computed property ~~~~~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~~~~~ !!! error TS2304: Cannot find name 'index'. var bar2: { x : number; } diff --git a/tests/baselines/reference/propertyOrdering.js b/tests/baselines/reference/propertyOrdering.js index 1dc930f93a1..f0f4644a983 100644 --- a/tests/baselines/reference/propertyOrdering.js +++ b/tests/baselines/reference/propertyOrdering.js @@ -31,9 +31,7 @@ var Foo = (function () { Foo.prototype.foo = function () { return this._store.length; // shouldn't be an error }; - Foo.prototype.bar = function () { - return this.store; - }; // should be an error + Foo.prototype.bar = function () { return this.store; }; // should be an error return Foo; })(); var Bar = (function () { diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.js index 992011ee4af..19ec9f50d27 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.js @@ -37,34 +37,20 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.prototype.foo = function () { - return this.foo; - }; + C.prototype.foo = function () { return this.foo; }; Object.defineProperty(C, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.foo = function () { - return this.foo; - }; - C.bar = function () { - this.foo(); - }; + C.foo = function () { return this.foo; }; + C.bar = function () { this.foo(); }; return C; })(); // added level of function nesting @@ -79,9 +65,7 @@ var C2 = (function () { }, set: function (x) { var _this = this; - (function () { - _this.y = _this.x; - }); + (function () { _this.y = _this.x; }); }, enumerable: true, configurable: true @@ -98,9 +82,7 @@ var C2 = (function () { }, set: function (x) { var _this = this; - (function () { - _this.y = _this.x; - }); + (function () { _this.y = _this.x; }); }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js index 381d10f43ea..28a1da5ffec 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js @@ -38,36 +38,20 @@ var C = (function (_super) { _super.apply(this, arguments); } Object.defineProperty(C.prototype, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.prototype.foo = function () { - return this.x; - }; - C.prototype.bar = function () { - return this.foo(); - }; + C.prototype.foo = function () { return this.x; }; + C.prototype.bar = function () { return this.foo(); }; Object.defineProperty(C, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.foo = function () { - return this.x; - }; - C.bar = function () { - this.foo(); - }; + C.foo = function () { return this.x; }; + C.bar = function () { this.foo(); }; return C; })(B); diff --git a/tests/baselines/reference/qualifiedModuleLocals.js b/tests/baselines/reference/qualifiedModuleLocals.js index 45d61949c63..b7ba5b70e81 100644 --- a/tests/baselines/reference/qualifiedModuleLocals.js +++ b/tests/baselines/reference/qualifiedModuleLocals.js @@ -14,9 +14,7 @@ A.a(); var A; (function (A) { function b() { } - function a() { - A.b(); - } + function a() { A.b(); } A.a = a; // A.b should be an unresolved symbol error })(A || (A = {})); A.a(); diff --git a/tests/baselines/reference/quotedAccessorName1.js b/tests/baselines/reference/quotedAccessorName1.js index 93fd5b8dd6b..69e0fdb2c8e 100644 --- a/tests/baselines/reference/quotedAccessorName1.js +++ b/tests/baselines/reference/quotedAccessorName1.js @@ -8,9 +8,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "foo", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/quotedAccessorName2.js b/tests/baselines/reference/quotedAccessorName2.js index 43041a29bf4..5d2d4861550 100644 --- a/tests/baselines/reference/quotedAccessorName2.js +++ b/tests/baselines/reference/quotedAccessorName2.js @@ -8,9 +8,7 @@ var C = (function () { function C() { } Object.defineProperty(C, "foo", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/rectype.js b/tests/baselines/reference/rectype.js index ed303b6b26e..15c5d9861f4 100644 --- a/tests/baselines/reference/rectype.js +++ b/tests/baselines/reference/rectype.js @@ -16,9 +16,7 @@ module M { //// [rectype.js] var M; (function (M) { - function f(p) { - return f; - } + function f(p) { return f; } M.f = f; ; var i; diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js b/tests/baselines/reference/recursiveClassReferenceTest.js index f565f8f23d0..4b115d3e722 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.js +++ b/tests/baselines/reference/recursiveClassReferenceTest.js @@ -122,9 +122,7 @@ var Sample; var StartFindAction = (function () { function StartFindAction() { } - StartFindAction.prototype.getId = function () { - return "yo"; - }; + StartFindAction.prototype.getId = function () { return "yo"; }; StartFindAction.prototype.run = function (Thing) { return true; }; @@ -148,11 +146,9 @@ var Sample; // scenario 1 codeThing.addWidget("addWidget", this); } - FindWidget.prototype.gar = function (runner) { - if (true) { - return runner(this); - } - }; + FindWidget.prototype.gar = function (runner) { if (true) { + return runner(this); + } }; FindWidget.prototype.getDomNode = function () { return domNode; }; @@ -167,9 +163,7 @@ var Sample; var AbstractMode = (function () { function AbstractMode() { } - AbstractMode.prototype.getInitialState = function () { - return null; - }; + AbstractMode.prototype.getInitialState = function () { return null; }; return AbstractMode; })(); var Sample; @@ -190,9 +184,7 @@ var Sample; State.prototype.equals = function (other) { return this === other; }; - State.prototype.getMode = function () { - return mode; - }; + State.prototype.getMode = function () { return mode; }; return State; })(); PlainText.State = State; diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js.map b/tests/baselines/reference/recursiveClassReferenceTest.js.map index b2478b7f05c..a2c623e2cf5 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.js.map +++ b/tests/baselines/reference/recursiveClassReferenceTest.js.map @@ -1,2 +1,2 @@ //// [recursiveClassReferenceTest.js.map] -{"version":3,"file":"recursiveClassReferenceTest.js","sourceRoot":"","sources":["recursiveClassReferenceTest.ts"],"names":["Sample","Sample.Actions","Sample.Actions.Thing","Sample.Actions.Thing.Find","Sample.Actions.Thing.Find.StartFindAction","Sample.Actions.Thing.Find.StartFindAction.constructor","Sample.Actions.Thing.Find.StartFindAction.getId","Sample.Actions.Thing.Find.StartFindAction.run","Sample.Thing","Sample.Thing.Widgets","Sample.Thing.Widgets.FindWidget","Sample.Thing.Widgets.FindWidget.constructor","Sample.Thing.Widgets.FindWidget.gar","Sample.Thing.Widgets.FindWidget.getDomNode","Sample.Thing.Widgets.FindWidget.destroy","AbstractMode","AbstractMode.constructor","AbstractMode.getInitialState","Sample.Thing.Languages","Sample.Thing.Languages.PlainText","Sample.Thing.Languages.PlainText.State","Sample.Thing.Languages.PlainText.State.constructor","Sample.Thing.Languages.PlainText.State.clone","Sample.Thing.Languages.PlainText.State.equals","Sample.Thing.Languages.PlainText.State.getMode","Sample.Thing.Languages.PlainText.Mode","Sample.Thing.Languages.PlainText.Mode.constructor","Sample.Thing.Languages.PlainText.Mode.getInitialState"],"mappings":"AAAA,iEAAiE;AACjE,0EAA0E;;;;;;;AA8B1E,IAAO,MAAM,CAUZ;AAVD,WAAO,MAAM;IAACA,IAAAA,OAAOA,CAUpBA;IAVaA,WAAAA,OAAOA;QAACC,IAAAA,KAAKA,CAU1BA;QAVqBA,WAAAA,QAAKA;YAACC,IAAAA,IAAIA,CAU/BA;YAV2BA,WAAAA,IAAIA,EAACA,CAACA;gBACjCC,IAAaA,eAAeA;oBAA5BC,SAAaA,eAAeA;oBAQ5BC,CAACA;oBANOD,+BAAKA,GAAZA;wBAAiBE,MAAMA,CAACA,IAAIA,CAACA;oBAACA,CAACA;oBAExBF,6BAAGA,GAAVA,UAAWA,KAA6BA;wBAEvCG,MAAMA,CAACA,IAAIA,CAACA;oBACbA,CAACA;oBACFH,sBAACA;gBAADA,CAACA,AARDD,IAQCA;gBARYA,oBAAeA,GAAfA,eAQZA,CAAAA;YACFA,CAACA,EAV2BD,IAAIA,GAAJA,aAAIA,KAAJA,aAAIA,QAU/BA;QAADA,CAACA,EAVqBD,KAAKA,GAALA,aAAKA,KAALA,aAAKA,QAU1BA;IAADA,CAACA,EAVaD,OAAOA,GAAPA,cAAOA,KAAPA,cAAOA,QAUpBA;AAADA,CAACA,EAVM,MAAM,KAAN,MAAM,QAUZ;AAED,IAAO,MAAM,CAoBZ;AApBD,WAAO,MAAM;IAACA,IAAAA,KAAKA,CAoBlBA;IApBaA,WAAAA,KAAKA;QAACQ,IAAAA,OAAOA,CAoB1BA;QApBmBA,WAAAA,OAAOA,EAACA,CAACA;YAC5BC,IAAaA,UAAUA;gBAKtBC,SALYA,UAAUA,CAKFA,SAAkCA;oBAAlCC,cAASA,GAATA,SAASA,CAAyBA;oBAD9CA,YAAOA,GAAOA,IAAIA,CAACA;oBAGvBA,AADAA,aAAaA;oBACbA,SAASA,CAACA,SAASA,CAACA,WAAWA,EAAEA,IAAIA,CAACA,CAACA;gBAC3CA,CAACA;gBANMD,wBAAGA,GAAVA,UAAWA,MAAyCA;oBAAIE,EAAEA,CAACA,CAACA,IAAIA,CAACA,CAACA,CAACA;wBAAAA,MAAMA,CAACA,MAAMA,CAACA,IAAIA,CAACA,CAACA;oBAAAA,CAACA;gBAAAA,CAACA;gBAQlFF,+BAAUA,GAAjBA;oBACCG,MAAMA,CAACA,OAAOA,CAACA;gBAChBA,CAACA;gBAEMH,4BAAOA,GAAdA;gBAEAI,CAACA;gBAEFJ,iBAACA;YAADA,CAACA,AAlBDD,IAkBCA;YAlBYA,kBAAUA,GAAVA,UAkBZA,CAAAA;QACFA,CAACA,EApBmBD,OAAOA,GAAPA,aAAOA,KAAPA,aAAOA,QAoB1BA;IAADA,CAACA,EApBaR,KAAKA,GAALA,YAAKA,KAALA,YAAKA,QAoBlBA;AAADA,CAACA,EApBM,MAAM,KAAN,MAAM,QAoBZ;AAGD,IAAM,YAAY;IAAlBe,SAAMA,YAAYA;IAAqEC,CAACA;IAA3CD,sCAAeA,GAAtBA;QAAmCE,MAAMA,CAACA,IAAIA,CAACA;IAAAA,CAACA;IAACF,mBAACA;AAADA,CAACA,AAAxF,IAAwF;AASxF,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM;IAACf,IAAAA,KAAKA,CAwBlBA;IAxBaA,WAAAA,KAAKA;QAACQ,IAAAA,SAASA,CAwB5BA;QAxBmBA,WAAAA,SAASA;YAACU,IAAAA,SAASA,CAwBtCA;YAxB6BA,WAAAA,SAASA,EAACA,CAACA;gBAExCC,IAAaA,KAAKA;oBACXC,SADMA,KAAKA,CACSA,IAAWA;wBAAXC,SAAIA,GAAJA,IAAIA,CAAOA;oBAAIA,CAACA;oBACnCD,qBAAKA,GAAZA;wBACCE,MAAMA,CAACA,IAAIA,CAACA;oBACbA,CAACA;oBAEMF,sBAAMA,GAAbA,UAAcA,KAAYA;wBACzBG,MAAMA,CAACA,IAAIA,KAAKA,KAAKA,CAACA;oBACvBA,CAACA;oBAEMH,uBAAOA,GAAdA;wBAA0BI,MAAMA,CAACA,IAAIA,CAACA;oBAACA,CAACA;oBACzCJ,YAACA;gBAADA,CAACA,AAXDD,IAWCA;gBAXYA,eAAKA,GAALA,KAWZA,CAAAA;gBAEDA,IAAaA,IAAIA;oBAASM,UAAbA,IAAIA,UAAqBA;oBAAtCA,SAAaA,IAAIA;wBAASC,8BAAYA;oBAQtCA,CAACA;oBANAD,aAAaA;oBACNA,8BAAeA,GAAtBA;wBACCE,MAAMA,CAACA,IAAIA,KAAKA,CAACA,IAAIA,CAACA,CAACA;oBACxBA,CAACA;oBAGFF,WAACA;gBAADA,CAACA,AARDN,EAA0BA,YAAYA,EAQrCA;gBARYA,cAAIA,GAAJA,IAQZA,CAAAA;YACFA,CAACA,EAxB6BD,SAASA,GAATA,mBAASA,KAATA,mBAASA,QAwBtCA;QAADA,CAACA,EAxBmBV,SAASA,GAATA,eAASA,KAATA,eAASA,QAwB5BA;IAADA,CAACA,EAxBaR,KAAKA,GAALA,YAAKA,KAALA,YAAKA,QAwBlBA;AAADA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ"} \ No newline at end of file +{"version":3,"file":"recursiveClassReferenceTest.js","sourceRoot":"","sources":["recursiveClassReferenceTest.ts"],"names":["Sample","Sample.Actions","Sample.Actions.Thing","Sample.Actions.Thing.Find","Sample.Actions.Thing.Find.StartFindAction","Sample.Actions.Thing.Find.StartFindAction.constructor","Sample.Actions.Thing.Find.StartFindAction.getId","Sample.Actions.Thing.Find.StartFindAction.run","Sample.Thing","Sample.Thing.Widgets","Sample.Thing.Widgets.FindWidget","Sample.Thing.Widgets.FindWidget.constructor","Sample.Thing.Widgets.FindWidget.gar","Sample.Thing.Widgets.FindWidget.getDomNode","Sample.Thing.Widgets.FindWidget.destroy","AbstractMode","AbstractMode.constructor","AbstractMode.getInitialState","Sample.Thing.Languages","Sample.Thing.Languages.PlainText","Sample.Thing.Languages.PlainText.State","Sample.Thing.Languages.PlainText.State.constructor","Sample.Thing.Languages.PlainText.State.clone","Sample.Thing.Languages.PlainText.State.equals","Sample.Thing.Languages.PlainText.State.getMode","Sample.Thing.Languages.PlainText.Mode","Sample.Thing.Languages.PlainText.Mode.constructor","Sample.Thing.Languages.PlainText.Mode.getInitialState"],"mappings":"AAAA,iEAAiE;AACjE,0EAA0E;;;;;;;AA8B1E,IAAO,MAAM,CAUZ;AAVD,WAAO,MAAM;IAACA,IAAAA,OAAOA,CAUpBA;IAVaA,WAAAA,OAAOA;QAACC,IAAAA,KAAKA,CAU1BA;QAVqBA,WAAAA,QAAKA;YAACC,IAAAA,IAAIA,CAU/BA;YAV2BA,WAAAA,IAAIA,EAACA,CAACA;gBACjCC,IAAaA,eAAeA;oBAA5BC,SAAaA,eAAeA;oBAQ5BC,CAACA;oBANOD,+BAAKA,GAAZA,cAAiBE,MAAMA,CAACA,IAAIA,CAACA,CAACA,CAACA;oBAExBF,6BAAGA,GAAVA,UAAWA,KAA6BA;wBAEvCG,MAAMA,CAACA,IAAIA,CAACA;oBACbA,CAACA;oBACFH,sBAACA;gBAADA,CAACA,AARDD,IAQCA;gBARYA,oBAAeA,GAAfA,eAQZA,CAAAA;YACFA,CAACA,EAV2BD,IAAIA,GAAJA,aAAIA,KAAJA,aAAIA,QAU/BA;QAADA,CAACA,EAVqBD,KAAKA,GAALA,aAAKA,KAALA,aAAKA,QAU1BA;IAADA,CAACA,EAVaD,OAAOA,GAAPA,cAAOA,KAAPA,cAAOA,QAUpBA;AAADA,CAACA,EAVM,MAAM,KAAN,MAAM,QAUZ;AAED,IAAO,MAAM,CAoBZ;AApBD,WAAO,MAAM;IAACA,IAAAA,KAAKA,CAoBlBA;IApBaA,WAAAA,KAAKA;QAACQ,IAAAA,OAAOA,CAoB1BA;QApBmBA,WAAAA,OAAOA,EAACA,CAACA;YAC5BC,IAAaA,UAAUA;gBAKtBC,SALYA,UAAUA,CAKFA,SAAkCA;oBAAlCC,cAASA,GAATA,SAASA,CAAyBA;oBAD9CA,YAAOA,GAAOA,IAAIA,CAACA;oBAGvBA,AADAA,aAAaA;oBACbA,SAASA,CAACA,SAASA,CAACA,WAAWA,EAAEA,IAAIA,CAACA,CAACA;gBAC3CA,CAACA;gBANMD,wBAAGA,GAAVA,UAAWA,MAAyCA,IAAIE,EAAEA,CAACA,CAACA,IAAIA,CAACA,CAACA,CAACA;oBAAAA,MAAMA,CAACA,MAAMA,CAACA,IAAIA,CAACA,CAACA;gBAAAA,CAACA,CAAAA,CAACA;gBAQlFF,+BAAUA,GAAjBA;oBACCG,MAAMA,CAACA,OAAOA,CAACA;gBAChBA,CAACA;gBAEMH,4BAAOA,GAAdA;gBAEAI,CAACA;gBAEFJ,iBAACA;YAADA,CAACA,AAlBDD,IAkBCA;YAlBYA,kBAAUA,GAAVA,UAkBZA,CAAAA;QACFA,CAACA,EApBmBD,OAAOA,GAAPA,aAAOA,KAAPA,aAAOA,QAoB1BA;IAADA,CAACA,EApBaR,KAAKA,GAALA,YAAKA,KAALA,YAAKA,QAoBlBA;AAADA,CAACA,EApBM,MAAM,KAAN,MAAM,QAoBZ;AAGD,IAAM,YAAY;IAAlBe,SAAMA,YAAYA;IAAqEC,CAACA;IAA3CD,sCAAeA,GAAtBA,cAAmCE,MAAMA,CAACA,IAAIA,CAACA,CAAAA,CAACA;IAACF,mBAACA;AAADA,CAACA,AAAxF,IAAwF;AASxF,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM;IAACf,IAAAA,KAAKA,CAwBlBA;IAxBaA,WAAAA,KAAKA;QAACQ,IAAAA,SAASA,CAwB5BA;QAxBmBA,WAAAA,SAASA;YAACU,IAAAA,SAASA,CAwBtCA;YAxB6BA,WAAAA,SAASA,EAACA,CAACA;gBAExCC,IAAaA,KAAKA;oBACXC,SADMA,KAAKA,CACSA,IAAWA;wBAAXC,SAAIA,GAAJA,IAAIA,CAAOA;oBAAIA,CAACA;oBACnCD,qBAAKA,GAAZA;wBACCE,MAAMA,CAACA,IAAIA,CAACA;oBACbA,CAACA;oBAEMF,sBAAMA,GAAbA,UAAcA,KAAYA;wBACzBG,MAAMA,CAACA,IAAIA,KAAKA,KAAKA,CAACA;oBACvBA,CAACA;oBAEMH,uBAAOA,GAAdA,cAA0BI,MAAMA,CAACA,IAAIA,CAACA,CAACA,CAACA;oBACzCJ,YAACA;gBAADA,CAACA,AAXDD,IAWCA;gBAXYA,eAAKA,GAALA,KAWZA,CAAAA;gBAEDA,IAAaA,IAAIA;oBAASM,UAAbA,IAAIA,UAAqBA;oBAAtCA,SAAaA,IAAIA;wBAASC,8BAAYA;oBAQtCA,CAACA;oBANAD,aAAaA;oBACNA,8BAAeA,GAAtBA;wBACCE,MAAMA,CAACA,IAAIA,KAAKA,CAACA,IAAIA,CAACA,CAACA;oBACxBA,CAACA;oBAGFF,WAACA;gBAADA,CAACA,AARDN,EAA0BA,YAAYA,EAQrCA;gBARYA,cAAIA,GAAJA,IAQZA,CAAAA;YACFA,CAACA,EAxB6BD,SAASA,GAATA,mBAASA,KAATA,mBAASA,QAwBtCA;QAADA,CAACA,EAxBmBV,SAASA,GAATA,eAASA,KAATA,eAASA,QAwB5BA;IAADA,CAACA,EAxBaR,KAAKA,GAALA,YAAKA,KAALA,YAAKA,QAwBlBA;AAADA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ"} \ No newline at end of file diff --git a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt index d02743ba296..8e4f3be36ff 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt +++ b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt @@ -240,7 +240,7 @@ sourceFile:recursiveClassReferenceTest.ts >>> } 1 >^^^^^^^^^^^^^^^^^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > implements Sample.Thing.IAction { > > public getId() { return "yo"; } @@ -254,61 +254,56 @@ sourceFile:recursiveClassReferenceTest.ts 1 >Emitted(19, 21) Source(41, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.constructor) 2 >Emitted(19, 22) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.constructor) --- ->>> StartFindAction.prototype.getId = function () { +>>> StartFindAction.prototype.getId = function () { return "yo"; }; 1->^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^ +8 > ^ +9 > ^ +10> ^ 1-> 2 > getId 3 > +4 > public getId() { +5 > return +6 > +7 > "yo" +8 > ; +9 > +10> } 1->Emitted(20, 21) Source(35, 10) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) 2 >Emitted(20, 52) Source(35, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) 3 >Emitted(20, 55) Source(35, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) ---- ->>> return "yo"; -1 >^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^ -1 >public getId() { -2 > return -3 > -4 > "yo" -5 > ; -1 >Emitted(21, 25) Source(35, 20) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) -2 >Emitted(21, 31) Source(35, 26) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) -3 >Emitted(21, 32) Source(35, 27) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) -4 >Emitted(21, 36) Source(35, 31) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) -5 >Emitted(21, 37) Source(35, 32) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) ---- ->>> }; -1 >^^^^^^^^^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -1 >Emitted(22, 21) Source(35, 33) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) -2 >Emitted(22, 22) Source(35, 34) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +4 >Emitted(20, 69) Source(35, 20) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +5 >Emitted(20, 75) Source(35, 26) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +6 >Emitted(20, 76) Source(35, 27) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +7 >Emitted(20, 80) Source(35, 31) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +8 >Emitted(20, 81) Source(35, 32) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +9 >Emitted(20, 82) Source(35, 33) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +10>Emitted(20, 83) Source(35, 34) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) --- >>> StartFindAction.prototype.run = function (Thing) { -1->^^^^^^^^^^^^^^^^^^^^ +1 >^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ 4 > ^^^^^^^^^^ 5 > ^^^^^ -1-> +1 > > > public 2 > run 3 > 4 > public run( 5 > Thing:Sample.Thing.ICodeThing -1->Emitted(23, 21) Source(37, 10) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -2 >Emitted(23, 50) Source(37, 13) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -3 >Emitted(23, 53) Source(37, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -4 >Emitted(23, 63) Source(37, 14) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -5 >Emitted(23, 68) Source(37, 43) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +1 >Emitted(21, 21) Source(37, 10) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +2 >Emitted(21, 50) Source(37, 13) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +3 >Emitted(21, 53) Source(37, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +4 >Emitted(21, 63) Source(37, 14) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +5 >Emitted(21, 68) Source(37, 43) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) --- >>> return true; 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -323,11 +318,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > true 5 > ; -1 >Emitted(24, 25) Source(39, 4) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) -2 >Emitted(24, 31) Source(39, 10) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) -3 >Emitted(24, 32) Source(39, 11) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) -4 >Emitted(24, 36) Source(39, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) -5 >Emitted(24, 37) Source(39, 16) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +1 >Emitted(22, 25) Source(39, 4) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +2 >Emitted(22, 31) Source(39, 10) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +3 >Emitted(22, 32) Source(39, 11) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +4 >Emitted(22, 36) Source(39, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +5 >Emitted(22, 37) Source(39, 16) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -336,8 +331,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(25, 21) Source(40, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) -2 >Emitted(25, 22) Source(40, 4) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +1 >Emitted(23, 21) Source(40, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +2 >Emitted(23, 22) Source(40, 4) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) --- >>> return StartFindAction; 1->^^^^^^^^^^^^^^^^^^^^ @@ -345,8 +340,8 @@ sourceFile:recursiveClassReferenceTest.ts 1-> > 2 > } -1->Emitted(26, 21) Source(41, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -2 >Emitted(26, 43) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +1->Emitted(24, 21) Source(41, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +2 >Emitted(24, 43) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) --- >>> })(); 1 >^^^^^^^^^^^^^^^^ @@ -366,10 +361,10 @@ sourceFile:recursiveClassReferenceTest.ts > return true; > } > } -1 >Emitted(27, 17) Source(41, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -2 >Emitted(27, 18) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -3 >Emitted(27, 18) Source(33, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find) -4 >Emitted(27, 22) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) +1 >Emitted(25, 17) Source(41, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +2 >Emitted(25, 18) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +3 >Emitted(25, 18) Source(33, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find) +4 >Emitted(25, 22) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) --- >>> Find.StartFindAction = StartFindAction; 1->^^^^^^^^^^^^^^^^ @@ -391,11 +386,11 @@ sourceFile:recursiveClassReferenceTest.ts > } > } 5 > -1->Emitted(28, 17) Source(33, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find) -2 >Emitted(28, 37) Source(33, 30) + SourceIndex(0) name (Sample.Actions.Thing.Find) -3 >Emitted(28, 40) Source(33, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find) -4 >Emitted(28, 55) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) -5 >Emitted(28, 56) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) +1->Emitted(26, 17) Source(33, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find) +2 >Emitted(26, 37) Source(33, 30) + SourceIndex(0) name (Sample.Actions.Thing.Find) +3 >Emitted(26, 40) Source(33, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find) +4 >Emitted(26, 55) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) +5 >Emitted(26, 56) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) --- >>> })(Find = _Thing_1.Find || (_Thing_1.Find = {})); 1->^^^^^^^^^^^^ @@ -427,15 +422,15 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1->Emitted(29, 13) Source(42, 1) + SourceIndex(0) name (Sample.Actions.Thing.Find) -2 >Emitted(29, 14) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find) -3 >Emitted(29, 16) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) -4 >Emitted(29, 20) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) -5 >Emitted(29, 23) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) -6 >Emitted(29, 36) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) -7 >Emitted(29, 41) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) -8 >Emitted(29, 54) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) -9 >Emitted(29, 62) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing) +1->Emitted(27, 13) Source(42, 1) + SourceIndex(0) name (Sample.Actions.Thing.Find) +2 >Emitted(27, 14) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find) +3 >Emitted(27, 16) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) +4 >Emitted(27, 20) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) +5 >Emitted(27, 23) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) +6 >Emitted(27, 36) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) +7 >Emitted(27, 41) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) +8 >Emitted(27, 54) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) +9 >Emitted(27, 62) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing) --- >>> })(Thing = Actions.Thing || (Actions.Thing = {})); 1 >^^^^^^^^ @@ -467,15 +462,15 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1 >Emitted(30, 9) Source(42, 1) + SourceIndex(0) name (Sample.Actions.Thing) -2 >Emitted(30, 10) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing) -3 >Emitted(30, 12) Source(32, 23) + SourceIndex(0) name (Sample.Actions) -4 >Emitted(30, 17) Source(32, 28) + SourceIndex(0) name (Sample.Actions) -5 >Emitted(30, 20) Source(32, 23) + SourceIndex(0) name (Sample.Actions) -6 >Emitted(30, 33) Source(32, 28) + SourceIndex(0) name (Sample.Actions) -7 >Emitted(30, 38) Source(32, 23) + SourceIndex(0) name (Sample.Actions) -8 >Emitted(30, 51) Source(32, 28) + SourceIndex(0) name (Sample.Actions) -9 >Emitted(30, 59) Source(42, 2) + SourceIndex(0) name (Sample.Actions) +1 >Emitted(28, 9) Source(42, 1) + SourceIndex(0) name (Sample.Actions.Thing) +2 >Emitted(28, 10) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing) +3 >Emitted(28, 12) Source(32, 23) + SourceIndex(0) name (Sample.Actions) +4 >Emitted(28, 17) Source(32, 28) + SourceIndex(0) name (Sample.Actions) +5 >Emitted(28, 20) Source(32, 23) + SourceIndex(0) name (Sample.Actions) +6 >Emitted(28, 33) Source(32, 28) + SourceIndex(0) name (Sample.Actions) +7 >Emitted(28, 38) Source(32, 23) + SourceIndex(0) name (Sample.Actions) +8 >Emitted(28, 51) Source(32, 28) + SourceIndex(0) name (Sample.Actions) +9 >Emitted(28, 59) Source(42, 2) + SourceIndex(0) name (Sample.Actions) --- >>> })(Actions = Sample.Actions || (Sample.Actions = {})); 1->^^^^ @@ -506,15 +501,15 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1->Emitted(31, 5) Source(42, 1) + SourceIndex(0) name (Sample.Actions) -2 >Emitted(31, 6) Source(42, 2) + SourceIndex(0) name (Sample.Actions) -3 >Emitted(31, 8) Source(32, 15) + SourceIndex(0) name (Sample) -4 >Emitted(31, 15) Source(32, 22) + SourceIndex(0) name (Sample) -5 >Emitted(31, 18) Source(32, 15) + SourceIndex(0) name (Sample) -6 >Emitted(31, 32) Source(32, 22) + SourceIndex(0) name (Sample) -7 >Emitted(31, 37) Source(32, 15) + SourceIndex(0) name (Sample) -8 >Emitted(31, 51) Source(32, 22) + SourceIndex(0) name (Sample) -9 >Emitted(31, 59) Source(42, 2) + SourceIndex(0) name (Sample) +1->Emitted(29, 5) Source(42, 1) + SourceIndex(0) name (Sample.Actions) +2 >Emitted(29, 6) Source(42, 2) + SourceIndex(0) name (Sample.Actions) +3 >Emitted(29, 8) Source(32, 15) + SourceIndex(0) name (Sample) +4 >Emitted(29, 15) Source(32, 22) + SourceIndex(0) name (Sample) +5 >Emitted(29, 18) Source(32, 15) + SourceIndex(0) name (Sample) +6 >Emitted(29, 32) Source(32, 22) + SourceIndex(0) name (Sample) +7 >Emitted(29, 37) Source(32, 15) + SourceIndex(0) name (Sample) +8 >Emitted(29, 51) Source(32, 22) + SourceIndex(0) name (Sample) +9 >Emitted(29, 59) Source(42, 2) + SourceIndex(0) name (Sample) --- >>>})(Sample || (Sample = {})); 1 > @@ -541,13 +536,13 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1 >Emitted(32, 1) Source(42, 1) + SourceIndex(0) name (Sample) -2 >Emitted(32, 2) Source(42, 2) + SourceIndex(0) name (Sample) -3 >Emitted(32, 4) Source(32, 8) + SourceIndex(0) -4 >Emitted(32, 10) Source(32, 14) + SourceIndex(0) -5 >Emitted(32, 15) Source(32, 8) + SourceIndex(0) -6 >Emitted(32, 21) Source(32, 14) + SourceIndex(0) -7 >Emitted(32, 29) Source(42, 2) + SourceIndex(0) +1 >Emitted(30, 1) Source(42, 1) + SourceIndex(0) name (Sample) +2 >Emitted(30, 2) Source(42, 2) + SourceIndex(0) name (Sample) +3 >Emitted(30, 4) Source(32, 8) + SourceIndex(0) +4 >Emitted(30, 10) Source(32, 14) + SourceIndex(0) +5 >Emitted(30, 15) Source(32, 8) + SourceIndex(0) +6 >Emitted(30, 21) Source(32, 14) + SourceIndex(0) +7 >Emitted(30, 29) Source(42, 2) + SourceIndex(0) --- >>>var Sample; 1 > @@ -581,10 +576,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(33, 1) Source(44, 1) + SourceIndex(0) -2 >Emitted(33, 5) Source(44, 8) + SourceIndex(0) -3 >Emitted(33, 11) Source(44, 14) + SourceIndex(0) -4 >Emitted(33, 12) Source(64, 2) + SourceIndex(0) +1 >Emitted(31, 1) Source(44, 1) + SourceIndex(0) +2 >Emitted(31, 5) Source(44, 8) + SourceIndex(0) +3 >Emitted(31, 11) Source(44, 14) + SourceIndex(0) +4 >Emitted(31, 12) Source(64, 2) + SourceIndex(0) --- >>>(function (Sample) { 1-> @@ -593,9 +588,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 >module 3 > Sample -1->Emitted(34, 1) Source(44, 1) + SourceIndex(0) -2 >Emitted(34, 12) Source(44, 8) + SourceIndex(0) -3 >Emitted(34, 18) Source(44, 14) + SourceIndex(0) +1->Emitted(32, 1) Source(44, 1) + SourceIndex(0) +2 >Emitted(32, 12) Source(44, 8) + SourceIndex(0) +3 >Emitted(32, 18) Source(44, 14) + SourceIndex(0) --- >>> var Thing; 1 >^^^^ @@ -627,10 +622,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(35, 5) Source(44, 15) + SourceIndex(0) name (Sample) -2 >Emitted(35, 9) Source(44, 15) + SourceIndex(0) name (Sample) -3 >Emitted(35, 14) Source(44, 20) + SourceIndex(0) name (Sample) -4 >Emitted(35, 15) Source(64, 2) + SourceIndex(0) name (Sample) +1 >Emitted(33, 5) Source(44, 15) + SourceIndex(0) name (Sample) +2 >Emitted(33, 9) Source(44, 15) + SourceIndex(0) name (Sample) +3 >Emitted(33, 14) Source(44, 20) + SourceIndex(0) name (Sample) +4 >Emitted(33, 15) Source(64, 2) + SourceIndex(0) name (Sample) --- >>> (function (Thing) { 1->^^^^ @@ -640,9 +635,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Thing -1->Emitted(36, 5) Source(44, 15) + SourceIndex(0) name (Sample) -2 >Emitted(36, 16) Source(44, 15) + SourceIndex(0) name (Sample) -3 >Emitted(36, 21) Source(44, 20) + SourceIndex(0) name (Sample) +1->Emitted(34, 5) Source(44, 15) + SourceIndex(0) name (Sample) +2 >Emitted(34, 16) Source(44, 15) + SourceIndex(0) name (Sample) +3 >Emitted(34, 21) Source(44, 20) + SourceIndex(0) name (Sample) --- >>> var Widgets; 1->^^^^^^^^ @@ -674,10 +669,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(37, 9) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(37, 13) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(37, 20) Source(44, 28) + SourceIndex(0) name (Sample.Thing) -4 >Emitted(37, 21) Source(64, 2) + SourceIndex(0) name (Sample.Thing) +1->Emitted(35, 9) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(35, 13) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(35, 20) Source(44, 28) + SourceIndex(0) name (Sample.Thing) +4 >Emitted(35, 21) Source(64, 2) + SourceIndex(0) name (Sample.Thing) --- >>> (function (Widgets) { 1->^^^^^^^^ @@ -691,11 +686,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > Widgets 4 > 5 > { -1->Emitted(38, 9) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(38, 20) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(38, 27) Source(44, 28) + SourceIndex(0) name (Sample.Thing) -4 >Emitted(38, 29) Source(44, 29) + SourceIndex(0) name (Sample.Thing) -5 >Emitted(38, 30) Source(44, 30) + SourceIndex(0) name (Sample.Thing) +1->Emitted(36, 9) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(36, 20) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(36, 27) Source(44, 28) + SourceIndex(0) name (Sample.Thing) +4 >Emitted(36, 29) Source(44, 29) + SourceIndex(0) name (Sample.Thing) +5 >Emitted(36, 30) Source(44, 30) + SourceIndex(0) name (Sample.Thing) --- >>> var FindWidget = (function () { 1->^^^^^^^^^^^^ @@ -706,9 +701,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 > export class 3 > FindWidget -1->Emitted(39, 13) Source(45, 2) + SourceIndex(0) name (Sample.Thing.Widgets) -2 >Emitted(39, 17) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) -3 >Emitted(39, 27) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets) +1->Emitted(37, 13) Source(45, 2) + SourceIndex(0) name (Sample.Thing.Widgets) +2 >Emitted(37, 17) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) +3 >Emitted(37, 27) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets) --- >>> function FindWidget(codeThing) { 1->^^^^^^^^^^^^^^^^ @@ -732,11 +727,11 @@ sourceFile:recursiveClassReferenceTest.ts > private domNode:any = null; > constructor(private 5 > codeThing: Sample.Thing.ICodeThing -1->Emitted(40, 17) Source(50, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(40, 26) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -3 >Emitted(40, 36) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -4 >Emitted(40, 37) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -5 >Emitted(40, 46) Source(50, 57) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +1->Emitted(38, 17) Source(50, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(38, 26) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +3 >Emitted(38, 36) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +4 >Emitted(38, 37) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +5 >Emitted(38, 46) Source(50, 57) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) --- >>> this.codeThing = codeThing; 1->^^^^^^^^^^^^^^^^^^^^ @@ -749,11 +744,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > codeThing 5 > : Sample.Thing.ICodeThing -1->Emitted(41, 21) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -2 >Emitted(41, 35) Source(50, 32) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -3 >Emitted(41, 38) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -4 >Emitted(41, 47) Source(50, 32) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -5 >Emitted(41, 48) Source(50, 57) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +1->Emitted(39, 21) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +2 >Emitted(39, 35) Source(50, 32) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +3 >Emitted(39, 38) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +4 >Emitted(39, 47) Source(50, 32) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +5 >Emitted(39, 48) Source(50, 57) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) --- >>> this.domNode = null; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -766,11 +761,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > :any = 4 > null 5 > ; -1 >Emitted(42, 21) Source(49, 11) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -2 >Emitted(42, 33) Source(49, 18) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -3 >Emitted(42, 36) Source(49, 25) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -4 >Emitted(42, 40) Source(49, 29) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -5 >Emitted(42, 41) Source(49, 30) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +1 >Emitted(40, 21) Source(49, 11) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +2 >Emitted(40, 33) Source(49, 18) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +3 >Emitted(40, 36) Source(49, 25) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +4 >Emitted(40, 40) Source(49, 29) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +5 >Emitted(40, 41) Source(49, 30) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) --- >>> // scenario 1 1 >^^^^^^^^^^^^^^^^^^^^ @@ -783,9 +778,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 > 3 > // scenario 1 -1 >Emitted(43, 21) Source(52, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -2 >Emitted(43, 21) Source(51, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -3 >Emitted(43, 34) Source(51, 20) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +1 >Emitted(41, 21) Source(52, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +2 >Emitted(41, 21) Source(51, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +3 >Emitted(41, 34) Source(51, 20) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) --- >>> codeThing.addWidget("addWidget", this); 1->^^^^^^^^^^^^^^^^^^^^ @@ -809,113 +804,108 @@ sourceFile:recursiveClassReferenceTest.ts 8 > this 9 > ) 10> ; -1->Emitted(44, 21) Source(52, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -2 >Emitted(44, 30) Source(52, 16) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -3 >Emitted(44, 31) Source(52, 17) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -4 >Emitted(44, 40) Source(52, 26) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -5 >Emitted(44, 41) Source(52, 27) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -6 >Emitted(44, 52) Source(52, 38) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -7 >Emitted(44, 54) Source(52, 40) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -8 >Emitted(44, 58) Source(52, 44) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -9 >Emitted(44, 59) Source(52, 45) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -10>Emitted(44, 60) Source(52, 46) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +1->Emitted(42, 21) Source(52, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +2 >Emitted(42, 30) Source(52, 16) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +3 >Emitted(42, 31) Source(52, 17) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +4 >Emitted(42, 40) Source(52, 26) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +5 >Emitted(42, 41) Source(52, 27) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +6 >Emitted(42, 52) Source(52, 38) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +7 >Emitted(42, 54) Source(52, 40) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +8 >Emitted(42, 58) Source(52, 44) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +9 >Emitted(42, 59) Source(52, 45) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +10>Emitted(42, 60) Source(52, 46) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) --- >>> } 1 >^^^^^^^^^^^^^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 > } -1 >Emitted(45, 17) Source(53, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -2 >Emitted(45, 18) Source(53, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +1 >Emitted(43, 17) Source(53, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +2 >Emitted(43, 18) Source(53, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) --- ->>> FindWidget.prototype.gar = function (runner) { +>>> FindWidget.prototype.gar = function (runner) { if (true) { 1->^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ 4 > ^^^^^^^^^^ 5 > ^^^^^^ +6 > ^^^^ +7 > ^^ +8 > ^ +9 > ^ +10> ^^^^ +11> ^ +12> ^ +13> ^ 1-> 2 > gar 3 > 4 > public gar( 5 > runner:(widget:Sample.Thing.IWidget)=>any -1->Emitted(46, 17) Source(47, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(46, 41) Source(47, 13) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -3 >Emitted(46, 44) Source(47, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -4 >Emitted(46, 54) Source(47, 14) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -5 >Emitted(46, 60) Source(47, 55) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +6 > ) { +7 > if +8 > +9 > ( +10> true +11> ) +12> +13> { +1->Emitted(44, 17) Source(47, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(44, 41) Source(47, 13) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +3 >Emitted(44, 44) Source(47, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +4 >Emitted(44, 54) Source(47, 14) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +5 >Emitted(44, 60) Source(47, 55) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +6 >Emitted(44, 64) Source(47, 59) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +7 >Emitted(44, 66) Source(47, 61) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +8 >Emitted(44, 67) Source(47, 62) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +9 >Emitted(44, 68) Source(47, 63) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +10>Emitted(44, 72) Source(47, 67) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +11>Emitted(44, 73) Source(47, 68) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +12>Emitted(44, 74) Source(47, 69) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +13>Emitted(44, 75) Source(47, 70) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) --- ->>> if (true) { +>>> return runner(this); 1 >^^^^^^^^^^^^^^^^^^^^ -2 > ^^ -3 > ^ -4 > ^ -5 > ^^^^ -6 > ^ -7 > ^ -8 > ^ -9 > ^^^^^^^^^^^^^^-> -1 >) { -2 > if -3 > -4 > ( -5 > true -6 > ) -7 > -8 > { -1 >Emitted(47, 21) Source(47, 59) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -2 >Emitted(47, 23) Source(47, 61) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -3 >Emitted(47, 24) Source(47, 62) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -4 >Emitted(47, 25) Source(47, 63) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -5 >Emitted(47, 29) Source(47, 67) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -6 >Emitted(47, 30) Source(47, 68) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -7 >Emitted(47, 31) Source(47, 69) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -8 >Emitted(47, 32) Source(47, 70) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) ---- ->>> return runner(this); -1->^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^ -5 > ^ -6 > ^^^^ -7 > ^ -8 > ^ -1-> -2 > return -3 > -4 > runner -5 > ( -6 > this -7 > ) -8 > ; -1->Emitted(48, 25) Source(47, 70) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -2 >Emitted(48, 31) Source(47, 76) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -3 >Emitted(48, 32) Source(47, 77) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -4 >Emitted(48, 38) Source(47, 83) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -5 >Emitted(48, 39) Source(47, 84) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -6 >Emitted(48, 43) Source(47, 88) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -7 >Emitted(48, 44) Source(47, 89) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -8 >Emitted(48, 45) Source(47, 90) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) ---- ->>> } -1 >^^^^^^^^^^^^^^^^^^^^ -2 > ^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^^^^ +7 > ^ +8 > ^ 1 > -2 > } -1 >Emitted(49, 21) Source(47, 90) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -2 >Emitted(49, 22) Source(47, 91) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +2 > return +3 > +4 > runner +5 > ( +6 > this +7 > ) +8 > ; +1 >Emitted(45, 21) Source(47, 70) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +2 >Emitted(45, 27) Source(47, 76) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +3 >Emitted(45, 28) Source(47, 77) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +4 >Emitted(45, 34) Source(47, 83) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +5 >Emitted(45, 35) Source(47, 84) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +6 >Emitted(45, 39) Source(47, 88) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +7 >Emitted(45, 40) Source(47, 89) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +8 >Emitted(45, 41) Source(47, 90) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) --- ->>> }; +>>> } }; 1 >^^^^^^^^^^^^^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 > } -1 >Emitted(50, 17) Source(47, 91) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -2 >Emitted(50, 18) Source(47, 92) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +3 > +4 > } +1 >Emitted(46, 17) Source(47, 90) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +2 >Emitted(46, 18) Source(47, 91) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +3 >Emitted(46, 19) Source(47, 91) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +4 >Emitted(46, 20) Source(47, 92) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) --- >>> FindWidget.prototype.getDomNode = function () { 1->^^^^^^^^^^^^^^^^ @@ -932,9 +922,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > getDomNode 3 > -1->Emitted(51, 17) Source(55, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(51, 48) Source(55, 20) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -3 >Emitted(51, 51) Source(55, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +1->Emitted(47, 17) Source(55, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(47, 48) Source(55, 20) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +3 >Emitted(47, 51) Source(55, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) --- >>> return domNode; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -948,11 +938,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > domNode 5 > ; -1 >Emitted(52, 21) Source(56, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) -2 >Emitted(52, 27) Source(56, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) -3 >Emitted(52, 28) Source(56, 11) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) -4 >Emitted(52, 35) Source(56, 18) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) -5 >Emitted(52, 36) Source(56, 19) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +1 >Emitted(48, 21) Source(56, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +2 >Emitted(48, 27) Source(56, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +3 >Emitted(48, 28) Source(56, 11) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +4 >Emitted(48, 35) Source(56, 18) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +5 >Emitted(48, 36) Source(56, 19) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) --- >>> }; 1 >^^^^^^^^^^^^^^^^ @@ -961,8 +951,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(53, 17) Source(57, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) -2 >Emitted(53, 18) Source(57, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +1 >Emitted(49, 17) Source(57, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +2 >Emitted(49, 18) Source(57, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) --- >>> FindWidget.prototype.destroy = function () { 1->^^^^^^^^^^^^^^^^ @@ -973,9 +963,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > destroy 3 > -1->Emitted(54, 17) Source(59, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(54, 45) Source(59, 17) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -3 >Emitted(54, 48) Source(59, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +1->Emitted(50, 17) Source(59, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(50, 45) Source(59, 17) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +3 >Emitted(50, 48) Source(59, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) --- >>> }; 1 >^^^^^^^^^^^^^^^^ @@ -985,8 +975,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1 >Emitted(55, 17) Source(61, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.destroy) -2 >Emitted(55, 18) Source(61, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.destroy) +1 >Emitted(51, 17) Source(61, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.destroy) +2 >Emitted(51, 18) Source(61, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.destroy) --- >>> return FindWidget; 1->^^^^^^^^^^^^^^^^ @@ -995,8 +985,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1->Emitted(56, 17) Source(63, 2) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(56, 34) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +1->Emitted(52, 17) Source(63, 2) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(52, 34) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) --- >>> })(); 1 >^^^^^^^^^^^^ @@ -1026,10 +1016,10 @@ sourceFile:recursiveClassReferenceTest.ts > } > > } -1 >Emitted(57, 13) Source(63, 2) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(57, 14) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -3 >Emitted(57, 14) Source(45, 2) + SourceIndex(0) name (Sample.Thing.Widgets) -4 >Emitted(57, 18) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) +1 >Emitted(53, 13) Source(63, 2) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(53, 14) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +3 >Emitted(53, 14) Source(45, 2) + SourceIndex(0) name (Sample.Thing.Widgets) +4 >Emitted(53, 18) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) --- >>> Widgets.FindWidget = FindWidget; 1->^^^^^^^^^^^^ @@ -1061,11 +1051,11 @@ sourceFile:recursiveClassReferenceTest.ts > > } 5 > -1->Emitted(58, 13) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) -2 >Emitted(58, 31) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets) -3 >Emitted(58, 34) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) -4 >Emitted(58, 44) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) -5 >Emitted(58, 45) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) +1->Emitted(54, 13) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) +2 >Emitted(54, 31) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets) +3 >Emitted(54, 34) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) +4 >Emitted(54, 44) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) +5 >Emitted(54, 45) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) --- >>> })(Widgets = Thing.Widgets || (Thing.Widgets = {})); 1->^^^^^^^^ @@ -1107,15 +1097,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(59, 9) Source(64, 1) + SourceIndex(0) name (Sample.Thing.Widgets) -2 >Emitted(59, 10) Source(64, 2) + SourceIndex(0) name (Sample.Thing.Widgets) -3 >Emitted(59, 12) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -4 >Emitted(59, 19) Source(44, 28) + SourceIndex(0) name (Sample.Thing) -5 >Emitted(59, 22) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -6 >Emitted(59, 35) Source(44, 28) + SourceIndex(0) name (Sample.Thing) -7 >Emitted(59, 40) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -8 >Emitted(59, 53) Source(44, 28) + SourceIndex(0) name (Sample.Thing) -9 >Emitted(59, 61) Source(64, 2) + SourceIndex(0) name (Sample.Thing) +1->Emitted(55, 9) Source(64, 1) + SourceIndex(0) name (Sample.Thing.Widgets) +2 >Emitted(55, 10) Source(64, 2) + SourceIndex(0) name (Sample.Thing.Widgets) +3 >Emitted(55, 12) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +4 >Emitted(55, 19) Source(44, 28) + SourceIndex(0) name (Sample.Thing) +5 >Emitted(55, 22) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +6 >Emitted(55, 35) Source(44, 28) + SourceIndex(0) name (Sample.Thing) +7 >Emitted(55, 40) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +8 >Emitted(55, 53) Source(44, 28) + SourceIndex(0) name (Sample.Thing) +9 >Emitted(55, 61) Source(64, 2) + SourceIndex(0) name (Sample.Thing) --- >>> })(Thing = Sample.Thing || (Sample.Thing = {})); 1 >^^^^ @@ -1156,15 +1146,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(60, 5) Source(64, 1) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(60, 6) Source(64, 2) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(60, 8) Source(44, 15) + SourceIndex(0) name (Sample) -4 >Emitted(60, 13) Source(44, 20) + SourceIndex(0) name (Sample) -5 >Emitted(60, 16) Source(44, 15) + SourceIndex(0) name (Sample) -6 >Emitted(60, 28) Source(44, 20) + SourceIndex(0) name (Sample) -7 >Emitted(60, 33) Source(44, 15) + SourceIndex(0) name (Sample) -8 >Emitted(60, 45) Source(44, 20) + SourceIndex(0) name (Sample) -9 >Emitted(60, 53) Source(64, 2) + SourceIndex(0) name (Sample) +1 >Emitted(56, 5) Source(64, 1) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(56, 6) Source(64, 2) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(56, 8) Source(44, 15) + SourceIndex(0) name (Sample) +4 >Emitted(56, 13) Source(44, 20) + SourceIndex(0) name (Sample) +5 >Emitted(56, 16) Source(44, 15) + SourceIndex(0) name (Sample) +6 >Emitted(56, 28) Source(44, 20) + SourceIndex(0) name (Sample) +7 >Emitted(56, 33) Source(44, 15) + SourceIndex(0) name (Sample) +8 >Emitted(56, 45) Source(44, 20) + SourceIndex(0) name (Sample) +9 >Emitted(56, 53) Source(64, 2) + SourceIndex(0) name (Sample) --- >>>})(Sample || (Sample = {})); 1 > @@ -1202,13 +1192,13 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(61, 1) Source(64, 1) + SourceIndex(0) name (Sample) -2 >Emitted(61, 2) Source(64, 2) + SourceIndex(0) name (Sample) -3 >Emitted(61, 4) Source(44, 8) + SourceIndex(0) -4 >Emitted(61, 10) Source(44, 14) + SourceIndex(0) -5 >Emitted(61, 15) Source(44, 8) + SourceIndex(0) -6 >Emitted(61, 21) Source(44, 14) + SourceIndex(0) -7 >Emitted(61, 29) Source(64, 2) + SourceIndex(0) +1 >Emitted(57, 1) Source(64, 1) + SourceIndex(0) name (Sample) +2 >Emitted(57, 2) Source(64, 2) + SourceIndex(0) name (Sample) +3 >Emitted(57, 4) Source(44, 8) + SourceIndex(0) +4 >Emitted(57, 10) Source(44, 14) + SourceIndex(0) +5 >Emitted(57, 15) Source(44, 8) + SourceIndex(0) +6 >Emitted(57, 21) Source(44, 14) + SourceIndex(0) +7 >Emitted(57, 29) Source(64, 2) + SourceIndex(0) --- >>>var AbstractMode = (function () { 1-> @@ -1221,9 +1211,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 >class 3 > AbstractMode -1->Emitted(62, 1) Source(67, 1) + SourceIndex(0) -2 >Emitted(62, 5) Source(67, 7) + SourceIndex(0) -3 >Emitted(62, 17) Source(67, 19) + SourceIndex(0) +1->Emitted(58, 1) Source(67, 1) + SourceIndex(0) +2 >Emitted(58, 5) Source(67, 7) + SourceIndex(0) +3 >Emitted(58, 17) Source(67, 19) + SourceIndex(0) --- >>> function AbstractMode() { 1->^^^^ @@ -1232,63 +1222,58 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > class 3 > AbstractMode -1->Emitted(63, 5) Source(67, 1) + SourceIndex(0) name (AbstractMode) -2 >Emitted(63, 14) Source(67, 7) + SourceIndex(0) name (AbstractMode) -3 >Emitted(63, 26) Source(67, 19) + SourceIndex(0) name (AbstractMode) +1->Emitted(59, 5) Source(67, 1) + SourceIndex(0) name (AbstractMode) +2 >Emitted(59, 14) Source(67, 7) + SourceIndex(0) name (AbstractMode) +3 >Emitted(59, 26) Source(67, 19) + SourceIndex(0) name (AbstractMode) --- >>> } 1 >^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > implements IMode { public getInitialState(): IState { return null;} 2 > } -1 >Emitted(64, 5) Source(67, 88) + SourceIndex(0) name (AbstractMode.constructor) -2 >Emitted(64, 6) Source(67, 89) + SourceIndex(0) name (AbstractMode.constructor) +1 >Emitted(60, 5) Source(67, 88) + SourceIndex(0) name (AbstractMode.constructor) +2 >Emitted(60, 6) Source(67, 89) + SourceIndex(0) name (AbstractMode.constructor) --- ->>> AbstractMode.prototype.getInitialState = function () { +>>> AbstractMode.prototype.getInitialState = function () { return null; }; 1->^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^ +8 > ^ +9 > ^ +10> ^ 1-> 2 > getInitialState 3 > -1->Emitted(65, 5) Source(67, 46) + SourceIndex(0) name (AbstractMode) -2 >Emitted(65, 43) Source(67, 61) + SourceIndex(0) name (AbstractMode) -3 >Emitted(65, 46) Source(67, 39) + SourceIndex(0) name (AbstractMode) ---- ->>> return null; -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^ -1 >public getInitialState(): IState { -2 > return -3 > -4 > null -5 > ; -1 >Emitted(66, 9) Source(67, 74) + SourceIndex(0) name (AbstractMode.getInitialState) -2 >Emitted(66, 15) Source(67, 80) + SourceIndex(0) name (AbstractMode.getInitialState) -3 >Emitted(66, 16) Source(67, 81) + SourceIndex(0) name (AbstractMode.getInitialState) -4 >Emitted(66, 20) Source(67, 85) + SourceIndex(0) name (AbstractMode.getInitialState) -5 >Emitted(66, 21) Source(67, 86) + SourceIndex(0) name (AbstractMode.getInitialState) ---- ->>> }; -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -1 >Emitted(67, 5) Source(67, 86) + SourceIndex(0) name (AbstractMode.getInitialState) -2 >Emitted(67, 6) Source(67, 87) + SourceIndex(0) name (AbstractMode.getInitialState) +4 > public getInitialState(): IState { +5 > return +6 > +7 > null +8 > ; +9 > +10> } +1->Emitted(61, 5) Source(67, 46) + SourceIndex(0) name (AbstractMode) +2 >Emitted(61, 43) Source(67, 61) + SourceIndex(0) name (AbstractMode) +3 >Emitted(61, 46) Source(67, 39) + SourceIndex(0) name (AbstractMode) +4 >Emitted(61, 60) Source(67, 74) + SourceIndex(0) name (AbstractMode.getInitialState) +5 >Emitted(61, 66) Source(67, 80) + SourceIndex(0) name (AbstractMode.getInitialState) +6 >Emitted(61, 67) Source(67, 81) + SourceIndex(0) name (AbstractMode.getInitialState) +7 >Emitted(61, 71) Source(67, 85) + SourceIndex(0) name (AbstractMode.getInitialState) +8 >Emitted(61, 72) Source(67, 86) + SourceIndex(0) name (AbstractMode.getInitialState) +9 >Emitted(61, 73) Source(67, 86) + SourceIndex(0) name (AbstractMode.getInitialState) +10>Emitted(61, 74) Source(67, 87) + SourceIndex(0) name (AbstractMode.getInitialState) --- >>> return AbstractMode; -1->^^^^ +1 >^^^^ 2 > ^^^^^^^^^^^^^^^^^^^ -1-> +1 > 2 > } -1->Emitted(68, 5) Source(67, 88) + SourceIndex(0) name (AbstractMode) -2 >Emitted(68, 24) Source(67, 89) + SourceIndex(0) name (AbstractMode) +1 >Emitted(62, 5) Source(67, 88) + SourceIndex(0) name (AbstractMode) +2 >Emitted(62, 24) Source(67, 89) + SourceIndex(0) name (AbstractMode) --- >>>})(); 1 > @@ -1300,10 +1285,10 @@ sourceFile:recursiveClassReferenceTest.ts 2 >} 3 > 4 > class AbstractMode implements IMode { public getInitialState(): IState { return null;} } -1 >Emitted(69, 1) Source(67, 88) + SourceIndex(0) name (AbstractMode) -2 >Emitted(69, 2) Source(67, 89) + SourceIndex(0) name (AbstractMode) -3 >Emitted(69, 2) Source(67, 1) + SourceIndex(0) -4 >Emitted(69, 6) Source(67, 89) + SourceIndex(0) +1 >Emitted(63, 1) Source(67, 88) + SourceIndex(0) name (AbstractMode) +2 >Emitted(63, 2) Source(67, 89) + SourceIndex(0) name (AbstractMode) +3 >Emitted(63, 2) Source(67, 1) + SourceIndex(0) +4 >Emitted(63, 6) Source(67, 89) + SourceIndex(0) --- >>>var Sample; 1-> @@ -1348,10 +1333,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(70, 1) Source(76, 1) + SourceIndex(0) -2 >Emitted(70, 5) Source(76, 8) + SourceIndex(0) -3 >Emitted(70, 11) Source(76, 14) + SourceIndex(0) -4 >Emitted(70, 12) Source(100, 2) + SourceIndex(0) +1->Emitted(64, 1) Source(76, 1) + SourceIndex(0) +2 >Emitted(64, 5) Source(76, 8) + SourceIndex(0) +3 >Emitted(64, 11) Source(76, 14) + SourceIndex(0) +4 >Emitted(64, 12) Source(100, 2) + SourceIndex(0) --- >>>(function (Sample) { 1-> @@ -1360,9 +1345,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 >module 3 > Sample -1->Emitted(71, 1) Source(76, 1) + SourceIndex(0) -2 >Emitted(71, 12) Source(76, 8) + SourceIndex(0) -3 >Emitted(71, 18) Source(76, 14) + SourceIndex(0) +1->Emitted(65, 1) Source(76, 1) + SourceIndex(0) +2 >Emitted(65, 12) Source(76, 8) + SourceIndex(0) +3 >Emitted(65, 18) Source(76, 14) + SourceIndex(0) --- >>> var Thing; 1 >^^^^ @@ -1398,10 +1383,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(72, 5) Source(76, 15) + SourceIndex(0) name (Sample) -2 >Emitted(72, 9) Source(76, 15) + SourceIndex(0) name (Sample) -3 >Emitted(72, 14) Source(76, 20) + SourceIndex(0) name (Sample) -4 >Emitted(72, 15) Source(100, 2) + SourceIndex(0) name (Sample) +1 >Emitted(66, 5) Source(76, 15) + SourceIndex(0) name (Sample) +2 >Emitted(66, 9) Source(76, 15) + SourceIndex(0) name (Sample) +3 >Emitted(66, 14) Source(76, 20) + SourceIndex(0) name (Sample) +4 >Emitted(66, 15) Source(100, 2) + SourceIndex(0) name (Sample) --- >>> (function (Thing) { 1->^^^^ @@ -1411,9 +1396,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Thing -1->Emitted(73, 5) Source(76, 15) + SourceIndex(0) name (Sample) -2 >Emitted(73, 16) Source(76, 15) + SourceIndex(0) name (Sample) -3 >Emitted(73, 21) Source(76, 20) + SourceIndex(0) name (Sample) +1->Emitted(67, 5) Source(76, 15) + SourceIndex(0) name (Sample) +2 >Emitted(67, 16) Source(76, 15) + SourceIndex(0) name (Sample) +3 >Emitted(67, 21) Source(76, 20) + SourceIndex(0) name (Sample) --- >>> var Languages; 1->^^^^^^^^ @@ -1449,10 +1434,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(74, 9) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(74, 13) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(74, 22) Source(76, 30) + SourceIndex(0) name (Sample.Thing) -4 >Emitted(74, 23) Source(100, 2) + SourceIndex(0) name (Sample.Thing) +1->Emitted(68, 9) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(68, 13) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(68, 22) Source(76, 30) + SourceIndex(0) name (Sample.Thing) +4 >Emitted(68, 23) Source(100, 2) + SourceIndex(0) name (Sample.Thing) --- >>> (function (Languages) { 1->^^^^^^^^ @@ -1461,9 +1446,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Languages -1->Emitted(75, 9) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(75, 20) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(75, 29) Source(76, 30) + SourceIndex(0) name (Sample.Thing) +1->Emitted(69, 9) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(69, 20) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(69, 29) Source(76, 30) + SourceIndex(0) name (Sample.Thing) --- >>> var PlainText; 1 >^^^^^^^^^^^^ @@ -1499,10 +1484,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(76, 13) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -2 >Emitted(76, 17) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -3 >Emitted(76, 26) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) -4 >Emitted(76, 27) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) +1 >Emitted(70, 13) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +2 >Emitted(70, 17) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +3 >Emitted(70, 26) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) +4 >Emitted(70, 27) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) --- >>> (function (PlainText) { 1->^^^^^^^^^^^^ @@ -1516,11 +1501,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > PlainText 4 > 5 > { -1->Emitted(77, 13) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -2 >Emitted(77, 24) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -3 >Emitted(77, 33) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) -4 >Emitted(77, 35) Source(76, 41) + SourceIndex(0) name (Sample.Thing.Languages) -5 >Emitted(77, 36) Source(76, 42) + SourceIndex(0) name (Sample.Thing.Languages) +1->Emitted(71, 13) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +2 >Emitted(71, 24) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +3 >Emitted(71, 33) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) +4 >Emitted(71, 35) Source(76, 41) + SourceIndex(0) name (Sample.Thing.Languages) +5 >Emitted(71, 36) Source(76, 42) + SourceIndex(0) name (Sample.Thing.Languages) --- >>> var State = (function () { 1->^^^^^^^^^^^^^^^^ @@ -1532,9 +1517,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 > export class 3 > State -1->Emitted(78, 17) Source(78, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -2 >Emitted(78, 21) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -3 >Emitted(78, 26) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1->Emitted(72, 17) Source(78, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +2 >Emitted(72, 21) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +3 >Emitted(72, 26) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> function State(mode) { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1550,11 +1535,11 @@ sourceFile:recursiveClassReferenceTest.ts 4 > implements IState { > constructor(private 5 > mode: IMode -1->Emitted(79, 21) Source(79, 9) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(79, 30) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -3 >Emitted(79, 35) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -4 >Emitted(79, 36) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -5 >Emitted(79, 40) Source(79, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +1->Emitted(73, 21) Source(79, 9) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(73, 30) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +3 >Emitted(73, 35) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +4 >Emitted(73, 36) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +5 >Emitted(73, 40) Source(79, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) --- >>> this.mode = mode; 1->^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1567,11 +1552,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > mode 5 > : IMode -1->Emitted(80, 25) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) -2 >Emitted(80, 34) Source(79, 33) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) -3 >Emitted(80, 37) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) -4 >Emitted(80, 41) Source(79, 33) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) -5 >Emitted(80, 42) Source(79, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +1->Emitted(74, 25) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +2 >Emitted(74, 34) Source(79, 33) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +3 >Emitted(74, 37) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +4 >Emitted(74, 41) Source(79, 33) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +5 >Emitted(74, 42) Source(79, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) --- >>> } 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1579,8 +1564,8 @@ sourceFile:recursiveClassReferenceTest.ts 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 >) { 2 > } -1 >Emitted(81, 21) Source(79, 44) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) -2 >Emitted(81, 22) Source(79, 45) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +1 >Emitted(75, 21) Source(79, 44) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +2 >Emitted(75, 22) Source(79, 45) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) --- >>> State.prototype.clone = function () { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1590,9 +1575,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > clone 3 > -1->Emitted(82, 21) Source(80, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(82, 42) Source(80, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -3 >Emitted(82, 45) Source(80, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +1->Emitted(76, 21) Source(80, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(76, 42) Source(80, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +3 >Emitted(76, 45) Source(80, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) --- >>> return this; 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1606,11 +1591,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > this 5 > ; -1 >Emitted(83, 25) Source(81, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) -2 >Emitted(83, 31) Source(81, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) -3 >Emitted(83, 32) Source(81, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) -4 >Emitted(83, 36) Source(81, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) -5 >Emitted(83, 37) Source(81, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +1 >Emitted(77, 25) Source(81, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +2 >Emitted(77, 31) Source(81, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +3 >Emitted(77, 32) Source(81, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +4 >Emitted(77, 36) Source(81, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +5 >Emitted(77, 37) Source(81, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1619,8 +1604,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(84, 21) Source(82, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) -2 >Emitted(84, 22) Source(82, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +1 >Emitted(78, 21) Source(82, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +2 >Emitted(78, 22) Source(82, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) --- >>> State.prototype.equals = function (other) { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1635,11 +1620,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > public equals( 5 > other:IState -1->Emitted(85, 21) Source(84, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(85, 43) Source(84, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -3 >Emitted(85, 46) Source(84, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -4 >Emitted(85, 56) Source(84, 17) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -5 >Emitted(85, 61) Source(84, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +1->Emitted(79, 21) Source(84, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(79, 43) Source(84, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +3 >Emitted(79, 46) Source(84, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +4 >Emitted(79, 56) Source(84, 17) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +5 >Emitted(79, 61) Source(84, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) --- >>> return this === other; 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1657,71 +1642,66 @@ sourceFile:recursiveClassReferenceTest.ts 5 > === 6 > other 7 > ; -1 >Emitted(86, 25) Source(85, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -2 >Emitted(86, 31) Source(85, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -3 >Emitted(86, 32) Source(85, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -4 >Emitted(86, 36) Source(85, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -5 >Emitted(86, 41) Source(85, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -6 >Emitted(86, 46) Source(85, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -7 >Emitted(86, 47) Source(85, 26) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +1 >Emitted(80, 25) Source(85, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +2 >Emitted(80, 31) Source(85, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +3 >Emitted(80, 32) Source(85, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +4 >Emitted(80, 36) Source(85, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +5 >Emitted(80, 41) Source(85, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +6 >Emitted(80, 46) Source(85, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +7 >Emitted(80, 47) Source(85, 26) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 > } -1 >Emitted(87, 21) Source(86, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -2 >Emitted(87, 22) Source(86, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +1 >Emitted(81, 21) Source(86, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +2 >Emitted(81, 22) Source(86, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) --- ->>> State.prototype.getMode = function () { +>>> State.prototype.getMode = function () { return mode; }; 1->^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^ +8 > ^ +9 > ^ +10> ^ 1-> > > public 2 > getMode 3 > -1->Emitted(88, 21) Source(88, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(88, 44) Source(88, 17) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -3 >Emitted(88, 47) Source(88, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) ---- ->>> return mode; -1 >^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^ -1 >public getMode(): IMode { -2 > return -3 > -4 > mode -5 > ; -1 >Emitted(89, 25) Source(88, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) -2 >Emitted(89, 31) Source(88, 35) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) -3 >Emitted(89, 32) Source(88, 36) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) -4 >Emitted(89, 36) Source(88, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) -5 >Emitted(89, 37) Source(88, 41) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) ---- ->>> }; -1 >^^^^^^^^^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1 > -2 > } -1 >Emitted(90, 21) Source(88, 42) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) -2 >Emitted(90, 22) Source(88, 43) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +4 > public getMode(): IMode { +5 > return +6 > +7 > mode +8 > ; +9 > +10> } +1->Emitted(82, 21) Source(88, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(82, 44) Source(88, 17) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +3 >Emitted(82, 47) Source(88, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +4 >Emitted(82, 61) Source(88, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +5 >Emitted(82, 67) Source(88, 35) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +6 >Emitted(82, 68) Source(88, 36) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +7 >Emitted(82, 72) Source(88, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +8 >Emitted(82, 73) Source(88, 41) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +9 >Emitted(82, 74) Source(88, 42) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +10>Emitted(82, 75) Source(88, 43) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) --- >>> return State; -1->^^^^^^^^^^^^^^^^^^^^ +1 >^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^ -1-> +1 > > 2 > } -1->Emitted(91, 21) Source(89, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(91, 33) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +1 >Emitted(83, 21) Source(89, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(83, 33) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) --- >>> })(); 1 >^^^^^^^^^^^^^^^^ @@ -1744,10 +1724,10 @@ sourceFile:recursiveClassReferenceTest.ts > > public getMode(): IMode { return mode; } > } -1 >Emitted(92, 17) Source(89, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(92, 18) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -3 >Emitted(92, 18) Source(78, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -4 >Emitted(92, 22) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1 >Emitted(84, 17) Source(89, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(84, 18) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +3 >Emitted(84, 18) Source(78, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +4 >Emitted(84, 22) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> PlainText.State = State; 1->^^^^^^^^^^^^^^^^ @@ -1772,11 +1752,11 @@ sourceFile:recursiveClassReferenceTest.ts > public getMode(): IMode { return mode; } > } 5 > -1->Emitted(93, 17) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -2 >Emitted(93, 32) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -3 >Emitted(93, 35) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -4 >Emitted(93, 40) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -5 >Emitted(93, 41) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1->Emitted(85, 17) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +2 >Emitted(85, 32) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +3 >Emitted(85, 35) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +4 >Emitted(85, 40) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +5 >Emitted(85, 41) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> var Mode = (function (_super) { 1->^^^^^^^^^^^^^^^^ @@ -1788,9 +1768,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 > export class 3 > Mode -1->Emitted(94, 17) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -2 >Emitted(94, 21) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -3 >Emitted(94, 25) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1->Emitted(86, 17) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +2 >Emitted(86, 21) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +3 >Emitted(86, 25) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> __extends(Mode, _super); 1->^^^^^^^^^^^^^^^^^^^^ @@ -1801,10 +1781,10 @@ sourceFile:recursiveClassReferenceTest.ts 2 > 3 > Mode 4 > extends AbstractMode -1->Emitted(95, 21) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(95, 31) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -3 >Emitted(95, 35) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -4 >Emitted(95, 45) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +1->Emitted(87, 21) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(87, 31) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +3 >Emitted(87, 35) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +4 >Emitted(87, 45) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) --- >>> function Mode() { 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1814,17 +1794,17 @@ sourceFile:recursiveClassReferenceTest.ts 1 > 2 > export class 3 > Mode -1 >Emitted(96, 21) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(96, 30) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -3 >Emitted(96, 34) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +1 >Emitted(88, 21) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(88, 30) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +3 >Emitted(88, 34) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) --- >>> _super.apply(this, arguments); 1->^^^^^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> extends 2 > AbstractMode -1->Emitted(97, 25) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) -2 >Emitted(97, 55) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) +1->Emitted(89, 25) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) +2 >Emitted(89, 55) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) --- >>> } 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1840,8 +1820,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1 >Emitted(98, 21) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) -2 >Emitted(98, 22) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) +1 >Emitted(90, 21) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) +2 >Emitted(90, 22) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) --- >>> // scenario 2 1->^^^^^^^^^^^^^^^^^^^^ @@ -1849,8 +1829,8 @@ sourceFile:recursiveClassReferenceTest.ts 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> 2 > // scenario 2 -1->Emitted(99, 21) Source(93, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(99, 34) Source(93, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +1->Emitted(91, 21) Source(93, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(91, 34) Source(93, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) --- >>> Mode.prototype.getInitialState = function () { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1860,9 +1840,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > getInitialState 3 > -1->Emitted(100, 21) Source(94, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(100, 51) Source(94, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -3 >Emitted(100, 54) Source(94, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +1->Emitted(92, 21) Source(94, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(92, 51) Source(94, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +3 >Emitted(92, 54) Source(94, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) --- >>> return new State(self); 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1884,15 +1864,15 @@ sourceFile:recursiveClassReferenceTest.ts 7 > self 8 > ) 9 > ; -1 >Emitted(101, 25) Source(95, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -2 >Emitted(101, 31) Source(95, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -3 >Emitted(101, 32) Source(95, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -4 >Emitted(101, 36) Source(95, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -5 >Emitted(101, 41) Source(95, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -6 >Emitted(101, 42) Source(95, 21) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -7 >Emitted(101, 46) Source(95, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -8 >Emitted(101, 47) Source(95, 26) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -9 >Emitted(101, 48) Source(95, 27) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +1 >Emitted(93, 25) Source(95, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +2 >Emitted(93, 31) Source(95, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +3 >Emitted(93, 32) Source(95, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +4 >Emitted(93, 36) Source(95, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +5 >Emitted(93, 41) Source(95, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +6 >Emitted(93, 42) Source(95, 21) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +7 >Emitted(93, 46) Source(95, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +8 >Emitted(93, 47) Source(95, 26) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +9 >Emitted(93, 48) Source(95, 27) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1901,8 +1881,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(102, 21) Source(96, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -2 >Emitted(102, 22) Source(96, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +1 >Emitted(94, 21) Source(96, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +2 >Emitted(94, 22) Source(96, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) --- >>> return Mode; 1->^^^^^^^^^^^^^^^^^^^^ @@ -1913,8 +1893,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1->Emitted(103, 21) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(103, 32) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +1->Emitted(95, 21) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(95, 32) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) --- >>> })(AbstractMode); 1->^^^^^^^^^^^^^^^^ @@ -1938,12 +1918,12 @@ sourceFile:recursiveClassReferenceTest.ts > > > } -1->Emitted(104, 17) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(104, 18) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -3 >Emitted(104, 18) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -4 >Emitted(104, 20) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -5 >Emitted(104, 32) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -6 >Emitted(104, 34) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1->Emitted(96, 17) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(96, 18) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +3 >Emitted(96, 18) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +4 >Emitted(96, 20) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +5 >Emitted(96, 32) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +6 >Emitted(96, 34) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> PlainText.Mode = Mode; 1->^^^^^^^^^^^^^^^^ @@ -1965,11 +1945,11 @@ sourceFile:recursiveClassReferenceTest.ts > > } 5 > -1->Emitted(105, 17) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -2 >Emitted(105, 31) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -3 >Emitted(105, 34) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -4 >Emitted(105, 38) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -5 >Emitted(105, 39) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1->Emitted(97, 17) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +2 >Emitted(97, 31) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +3 >Emitted(97, 34) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +4 >Emitted(97, 38) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +5 >Emitted(97, 39) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> })(PlainText = Languages.PlainText || (Languages.PlainText = {})); 1->^^^^^^^^^^^^ @@ -2015,15 +1995,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(106, 13) Source(100, 1) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -2 >Emitted(106, 14) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -3 >Emitted(106, 16) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -4 >Emitted(106, 25) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) -5 >Emitted(106, 28) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -6 >Emitted(106, 47) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) -7 >Emitted(106, 52) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -8 >Emitted(106, 71) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) -9 >Emitted(106, 79) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) +1->Emitted(98, 13) Source(100, 1) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +2 >Emitted(98, 14) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +3 >Emitted(98, 16) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +4 >Emitted(98, 25) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) +5 >Emitted(98, 28) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +6 >Emitted(98, 47) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) +7 >Emitted(98, 52) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +8 >Emitted(98, 71) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) +9 >Emitted(98, 79) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) --- >>> })(Languages = Thing.Languages || (Thing.Languages = {})); 1 >^^^^^^^^ @@ -2068,15 +2048,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(107, 9) Source(100, 1) + SourceIndex(0) name (Sample.Thing.Languages) -2 >Emitted(107, 10) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) -3 >Emitted(107, 12) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -4 >Emitted(107, 21) Source(76, 30) + SourceIndex(0) name (Sample.Thing) -5 >Emitted(107, 24) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -6 >Emitted(107, 39) Source(76, 30) + SourceIndex(0) name (Sample.Thing) -7 >Emitted(107, 44) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -8 >Emitted(107, 59) Source(76, 30) + SourceIndex(0) name (Sample.Thing) -9 >Emitted(107, 67) Source(100, 2) + SourceIndex(0) name (Sample.Thing) +1 >Emitted(99, 9) Source(100, 1) + SourceIndex(0) name (Sample.Thing.Languages) +2 >Emitted(99, 10) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) +3 >Emitted(99, 12) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +4 >Emitted(99, 21) Source(76, 30) + SourceIndex(0) name (Sample.Thing) +5 >Emitted(99, 24) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +6 >Emitted(99, 39) Source(76, 30) + SourceIndex(0) name (Sample.Thing) +7 >Emitted(99, 44) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +8 >Emitted(99, 59) Source(76, 30) + SourceIndex(0) name (Sample.Thing) +9 >Emitted(99, 67) Source(100, 2) + SourceIndex(0) name (Sample.Thing) --- >>> })(Thing = Sample.Thing || (Sample.Thing = {})); 1 >^^^^ @@ -2121,15 +2101,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(108, 5) Source(100, 1) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(108, 6) Source(100, 2) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(108, 8) Source(76, 15) + SourceIndex(0) name (Sample) -4 >Emitted(108, 13) Source(76, 20) + SourceIndex(0) name (Sample) -5 >Emitted(108, 16) Source(76, 15) + SourceIndex(0) name (Sample) -6 >Emitted(108, 28) Source(76, 20) + SourceIndex(0) name (Sample) -7 >Emitted(108, 33) Source(76, 15) + SourceIndex(0) name (Sample) -8 >Emitted(108, 45) Source(76, 20) + SourceIndex(0) name (Sample) -9 >Emitted(108, 53) Source(100, 2) + SourceIndex(0) name (Sample) +1 >Emitted(100, 5) Source(100, 1) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(100, 6) Source(100, 2) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(100, 8) Source(76, 15) + SourceIndex(0) name (Sample) +4 >Emitted(100, 13) Source(76, 20) + SourceIndex(0) name (Sample) +5 >Emitted(100, 16) Source(76, 15) + SourceIndex(0) name (Sample) +6 >Emitted(100, 28) Source(76, 20) + SourceIndex(0) name (Sample) +7 >Emitted(100, 33) Source(76, 15) + SourceIndex(0) name (Sample) +8 >Emitted(100, 45) Source(76, 20) + SourceIndex(0) name (Sample) +9 >Emitted(100, 53) Source(100, 2) + SourceIndex(0) name (Sample) --- >>>})(Sample || (Sample = {})); 1 > @@ -2171,12 +2151,12 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(109, 1) Source(100, 1) + SourceIndex(0) name (Sample) -2 >Emitted(109, 2) Source(100, 2) + SourceIndex(0) name (Sample) -3 >Emitted(109, 4) Source(76, 8) + SourceIndex(0) -4 >Emitted(109, 10) Source(76, 14) + SourceIndex(0) -5 >Emitted(109, 15) Source(76, 8) + SourceIndex(0) -6 >Emitted(109, 21) Source(76, 14) + SourceIndex(0) -7 >Emitted(109, 29) Source(100, 2) + SourceIndex(0) +1 >Emitted(101, 1) Source(100, 1) + SourceIndex(0) name (Sample) +2 >Emitted(101, 2) Source(100, 2) + SourceIndex(0) name (Sample) +3 >Emitted(101, 4) Source(76, 8) + SourceIndex(0) +4 >Emitted(101, 10) Source(76, 14) + SourceIndex(0) +5 >Emitted(101, 15) Source(76, 8) + SourceIndex(0) +6 >Emitted(101, 21) Source(76, 14) + SourceIndex(0) +7 >Emitted(101, 29) Source(100, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=recursiveClassReferenceTest.js.map \ No newline at end of file diff --git a/tests/baselines/reference/recursiveFunctionTypes.js b/tests/baselines/reference/recursiveFunctionTypes.js index 1158fb539d0..040c323066d 100644 --- a/tests/baselines/reference/recursiveFunctionTypes.js +++ b/tests/baselines/reference/recursiveFunctionTypes.js @@ -45,9 +45,7 @@ f7(""); // ok (function takes an any param) f7(); // ok //// [recursiveFunctionTypes.js] -function fn() { - return 1; -} +function fn() { return 1; } var x = fn; // error var y = fn; // ok var f; @@ -55,9 +53,7 @@ var g; function f1(d) { } function f2() { } function g2() { } -function f3() { - return f3; -} +function f3() { return f3; } var a = f3; // error var C = (function () { function C() { @@ -68,12 +64,8 @@ var C = (function () { C.g(3); // error var f4; f4 = 3; // error -function f5() { - return f5; -} -function f6(a) { - return f6; -} +function f5() { return f5; } +function f6(a) { return f6; } f6("", 3); // error (arity mismatch) f6(""); // ok (function takes an any param) f6(); // ok diff --git a/tests/baselines/reference/recursiveGetterAccess.js b/tests/baselines/reference/recursiveGetterAccess.js index cf042c2c1a0..1dea2e02d3a 100644 --- a/tests/baselines/reference/recursiveGetterAccess.js +++ b/tests/baselines/reference/recursiveGetterAccess.js @@ -10,9 +10,7 @@ var MyClass = (function () { function MyClass() { } Object.defineProperty(MyClass.prototype, "testProp", { - get: function () { - return this.testProp; - }, + get: function () { return this.testProp; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/recursiveIdenticalOverloadResolution.js b/tests/baselines/reference/recursiveIdenticalOverloadResolution.js index e1ea203ac5b..3c53c2b2a0a 100644 --- a/tests/baselines/reference/recursiveIdenticalOverloadResolution.js +++ b/tests/baselines/reference/recursiveIdenticalOverloadResolution.js @@ -20,9 +20,7 @@ module M { //// [recursiveIdenticalOverloadResolution.js] var M; (function (M) { - function f(p) { - return f; - } + function f(p) { return f; } ; var i; f(i); diff --git a/tests/baselines/reference/recursiveInference1.js b/tests/baselines/reference/recursiveInference1.js index 839e13130f2..3a26ead542d 100644 --- a/tests/baselines/reference/recursiveInference1.js +++ b/tests/baselines/reference/recursiveInference1.js @@ -3,7 +3,5 @@ function fib(x:number) { return x <= 1 ? x : fib(x - 1) + fib(x - 2); } var result = fib(5); //// [recursiveInference1.js] -function fib(x) { - return x <= 1 ? x : fib(x - 1) + fib(x - 2); -} +function fib(x) { return x <= 1 ? x : fib(x - 1) + fib(x - 2); } var result = fib(5); diff --git a/tests/baselines/reference/recursiveInferenceBug.js b/tests/baselines/reference/recursiveInferenceBug.js index ff9b1c31434..5b4d4f0c0a1 100644 --- a/tests/baselines/reference/recursiveInferenceBug.js +++ b/tests/baselines/reference/recursiveInferenceBug.js @@ -18,7 +18,5 @@ function f(x) { } var zz = { g: function () { }, - get f() { - return "abc"; - } + get f() { return "abc"; } }; diff --git a/tests/baselines/reference/recursiveInheritance3.js b/tests/baselines/reference/recursiveInheritance3.js index 710b691fa94..bc9fb6cb4f9 100644 --- a/tests/baselines/reference/recursiveInheritance3.js +++ b/tests/baselines/reference/recursiveInheritance3.js @@ -13,8 +13,6 @@ var C = (function () { function C() { this.x = 1; } - C.prototype.foo = function (x) { - return x; - }; + C.prototype.foo = function (x) { return x; }; return C; })(); diff --git a/tests/baselines/reference/recursiveProperties.js b/tests/baselines/reference/recursiveProperties.js index 63644484956..84d9ebcd27c 100644 --- a/tests/baselines/reference/recursiveProperties.js +++ b/tests/baselines/reference/recursiveProperties.js @@ -12,9 +12,7 @@ var A = (function () { function A() { } Object.defineProperty(A.prototype, "testProp", { - get: function () { - return this.testProp; - }, + get: function () { return this.testProp; }, enumerable: true, configurable: true }); @@ -24,9 +22,7 @@ var B = (function () { function B() { } Object.defineProperty(B.prototype, "testProp", { - set: function (value) { - this.testProp = value; - }, + set: function (value) { this.testProp = value; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/recursiveReturns.js b/tests/baselines/reference/recursiveReturns.js index d01825f8cbf..18c9ed4dd7c 100644 --- a/tests/baselines/reference/recursiveReturns.js +++ b/tests/baselines/reference/recursiveReturns.js @@ -20,9 +20,7 @@ function R1() { R1(); return; } -function R2() { - R2(); -} +function R2() { R2(); } function R3(n) { if (n == 0) { } diff --git a/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.js b/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.js index 0d972d3e86c..0cef9be47ab 100644 --- a/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.js +++ b/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.js @@ -61,9 +61,7 @@ function foo2(x) { function other() { function foo3(x) { } function foo4(x) { } - function foo5(x) { - return null; - } + function foo5(x) { return null; } var list; var myList; var r = foo5(list); diff --git a/tests/baselines/reference/redefineArray.js b/tests/baselines/reference/redefineArray.js index 93494232436..080d2b1a2d2 100644 --- a/tests/baselines/reference/redefineArray.js +++ b/tests/baselines/reference/redefineArray.js @@ -2,6 +2,4 @@ Array = function (n:number, s:string) {return n;}; //// [redefineArray.js] -Array = function (n, s) { - return n; -}; +Array = function (n, s) { return n; }; diff --git a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js index 608090e8722..24f0e7f1bcb 100644 --- a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js +++ b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js @@ -1036,41 +1036,31 @@ var rionegrensis; caniventer.prototype.salomonseni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; caniventer.prototype.uchidai = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; caniventer.prototype.raffrayana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; caniventer.prototype.Uranium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; caniventer.prototype.nayaur = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return caniventer; @@ -1084,41 +1074,31 @@ var rionegrensis; veraecrucis.prototype.naso = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; veraecrucis.prototype.vancouverensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; veraecrucis.prototype.africana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; veraecrucis.prototype.palliolata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; veraecrucis.prototype.nivicola = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return veraecrucis; @@ -1139,41 +1119,31 @@ var julianae; nudicaudus.prototype.brandtii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nudicaudus.prototype.maxwellii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nudicaudus.prototype.endoi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nudicaudus.prototype.venezuelae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nudicaudus.prototype.zamicrus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return nudicaudus; @@ -1185,57 +1155,43 @@ var julianae; galapagoensis.prototype.isabellae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.rueppellii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.peregusna = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.gliroides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.banakrisi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.rozendaali = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.stuhlmanni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return galapagoensis; @@ -1247,57 +1203,43 @@ var julianae; albidens.prototype.mattheyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.Astatine = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.vincenti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.hirta = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.virginianus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.macrophyllum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.porcellus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return albidens; @@ -1311,105 +1253,79 @@ var julianae; oralis.prototype.cepapi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.porteri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.bindi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.puda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.mindorensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.ignitus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.rufus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.monax = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.unalascensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.wuchihensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.leucippe = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.ordii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.eisentrauti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return oralis; @@ -1423,57 +1339,43 @@ var julianae; sumatrana.prototype.wolffsohni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.geata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.awashensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.sturdeei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.pachyurus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.lyelli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.neohibernicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return sumatrana; @@ -1485,89 +1387,67 @@ var julianae; gerbillus.prototype.pundti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.tristrami = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.swarthi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.horsfieldii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.diazi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.rennelli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.maulinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.muscina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.pelengensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.abramus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.reevesi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return gerbillus; @@ -1579,97 +1459,73 @@ var julianae; acariensis.prototype.levicula = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.minous = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.cinereiventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.longicaudatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.baeodon = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.soricoides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.datae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.spixii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.anakuma = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.kihaulei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.gymnura = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.olchonensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return acariensis; @@ -1683,25 +1539,19 @@ var julianae; durangae.prototype.Californium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; durangae.prototype.Flerovium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; durangae.prototype.phrudus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return durangae; @@ -1716,17 +1566,13 @@ var ruatanica; hector.prototype.humulis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; hector.prototype.eurycerus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return hector; @@ -1741,25 +1587,19 @@ var Lanthanum; suillus.prototype.spilosoma = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; suillus.prototype.tumbalensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; suillus.prototype.anatolicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return suillus; @@ -1773,81 +1613,61 @@ var Lanthanum; nitidus.prototype.granatensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.negligens = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.lewisi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.arge = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.dominicensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.taurus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.tonganus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.silvatica = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.midas = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.bicornis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return nitidus; @@ -1861,65 +1681,49 @@ var Lanthanum; megalonyx.prototype.phillipsii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.melanogaster = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.elaphus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.elater = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.ourebi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.caraccioli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.parva = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.albipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return megalonyx; @@ -1931,113 +1735,85 @@ var Lanthanum; jugularis.prototype.torrei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.revoili = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.macrobullatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.compactus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.talpinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.stramineus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.dartmouthi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.ogilbyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.incomtus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.surdaster = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.melanorhinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.picticaudata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.pomona = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.ileile = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return jugularis; @@ -2054,113 +1830,85 @@ var rendalli; zuluensis.prototype.telfairi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.keyensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.occasius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.damarensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.Neptunium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.griseoflavus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.thar = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.alborufus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.fusicaudus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.gordonorum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.ruber = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.desmarestianus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.lutillus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.salocco = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return zuluensis; @@ -2172,81 +1920,61 @@ var rendalli; moojeni.prototype.floweri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.montosa = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.miletus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.heaneyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.marchei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.budini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.maggietaylorae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.poliocephalus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.zibethicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.biacensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return moojeni; @@ -2260,25 +1988,19 @@ var rendalli; crenulata.prototype.salvanius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; crenulata.prototype.maritimus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; crenulata.prototype.edax = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return crenulata; @@ -2293,65 +2015,49 @@ var trivirgatus; tumidifrons.prototype.nivalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.vestitus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.aequatorius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.scherman = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.improvisum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.cervinipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.audax = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.vallinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return tumidifrons; @@ -2365,57 +2071,43 @@ var trivirgatus; mixtus.prototype.ochrogaster = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.bryophilus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.liechtensteini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.crawfordi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.hypsibia = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.matacus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.demidoff = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return mixtus; @@ -2427,17 +2119,13 @@ var trivirgatus; lotor.prototype.balensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lotor.prototype.pullata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return lotor; @@ -2449,57 +2137,43 @@ var trivirgatus; falconeri.prototype.cabrali = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.gouldi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.fuscicollis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.martiensseni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.gaoligongensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.shawi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.gmelini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return falconeri; @@ -2511,113 +2185,85 @@ var trivirgatus; oconnelli.prototype.youngsoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.terrestris = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.chrysopus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.fuscomurina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.hellwaldii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.aenea = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.perrini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.entellus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.krebsii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.cephalotes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.molossinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.luisi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.ceylonicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.ralli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return oconnelli; @@ -2632,33 +2278,25 @@ var quasiater; bobrinskoi.prototype.crassicaudatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; bobrinskoi.prototype.mulatta = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; bobrinskoi.prototype.ansorgei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; bobrinskoi.prototype.Copper = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return bobrinskoi; @@ -2675,33 +2313,25 @@ var ruatanica; americanus.prototype.nasoloi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; americanus.prototype.mystacalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; americanus.prototype.fardoulisi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; americanus.prototype.tumidus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return americanus; @@ -2718,105 +2348,79 @@ var lavali; wilsoni.prototype.setiger = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.lorentzii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.antisensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.blossevillii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.bontanus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.caligata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.franqueti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.roberti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.degelidus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.amoenus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.kob = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.csorbai = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.dorsata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return wilsoni; @@ -2836,105 +2440,79 @@ var lavali; otion.prototype.bonaerensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.dussumieri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.osvaldoreigi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.grevyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.hirtula = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.cristatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.darlingtoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.fontanierii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.umbrosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.chiriquinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.orarius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.ilaeus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.musschenbroekii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return otion; @@ -2946,97 +2524,73 @@ var lavali; xanthognathus.prototype.nanulus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.albigena = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.onca = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.gunnii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.apeco = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.variegates = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.goudotii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.pohlei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.ineptus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.euryotis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.maurisca = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.coyhaiquensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return xanthognathus; @@ -3050,65 +2604,49 @@ var lavali; thaeleri.prototype.coromandra = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.parvipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.sponsorius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.vates = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.roosmalenorum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.rubicola = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.ikonnikovi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.paramicrus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return thaeleri; @@ -3122,17 +2660,13 @@ var lavali; lepturus.prototype.ferrumequinum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lepturus.prototype.aequalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return lepturus; @@ -3149,73 +2683,55 @@ var dogramacii; robustulus.prototype.fossor = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.humboldti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.mexicana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.martini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.beatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.leporina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.pearsonii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.keaysi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.hindei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return robustulus; @@ -3227,9 +2743,7 @@ var dogramacii; koepckeae.prototype.culturatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return koepckeae; @@ -3241,105 +2755,79 @@ var dogramacii; kaiseri.prototype.bedfordiae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.paramorum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.rubidus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.juninensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.marginata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.Meitnerium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.pinetorum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.hoolock = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.poeyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.Thulium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.patrius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.quadraticauda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.ater = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return kaiseri; @@ -3351,65 +2839,49 @@ var dogramacii; aurata.prototype.grunniens = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.howensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.karlkoopmani = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.mirapitanga = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.ophiodon = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.landeri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.sonomae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.erythromos = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return aurata; @@ -3426,113 +2898,85 @@ var lutreolus; schlegeli.prototype.mittendorfi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.blicki = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.culionensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.scrofa = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.fernandoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.Tin = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.marmorata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.tavaratra = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.peregrina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.frontalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.cuniculus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.magdalenae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.andamanensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.dispar = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return schlegeli; @@ -3547,89 +2991,67 @@ var argurus; dauricus.prototype.chinensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.duodecimcostatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.foxi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.macleayii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.darienensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.hardwickii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.albifrons = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.jacobitus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.guentheri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.mahomet = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.misionensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return dauricus; @@ -3644,65 +3066,49 @@ var nigra; dolichurus.prototype.solomonis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.alfredi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.morrisi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.lekaguli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.dimissus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.phaeotis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.ustus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.sagei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return dolichurus; @@ -3719,49 +3125,37 @@ var panglima; amphibius.prototype.bottegi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amphibius.prototype.jerdoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amphibius.prototype.camtschatica = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amphibius.prototype.spadix = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amphibius.prototype.luismanueli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amphibius.prototype.aceramarcae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return amphibius; @@ -3775,25 +3169,19 @@ var panglima; fundatus.prototype.crassulus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fundatus.prototype.flamarioni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fundatus.prototype.mirabilis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return fundatus; @@ -3807,41 +3195,31 @@ var panglima; abidi.prototype.greyii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; abidi.prototype.macedonicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; abidi.prototype.galili = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; abidi.prototype.thierryi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; abidi.prototype.ega = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return abidi; @@ -3856,57 +3234,43 @@ var quasiater; carolinensis.prototype.concinna = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.aeneus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.aloysiisabaudiae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.tenellus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.andium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.persephone = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.patrizii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return carolinensis; @@ -3923,97 +3287,73 @@ var minutus; himalayana.prototype.simoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.lobata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.rusticus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.latona = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.famulus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.flaviceps = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.paradoxolophus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.Osmium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.vulgaris = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.betsileoensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.vespuccii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.olympus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return himalayana; @@ -4030,65 +3370,49 @@ var caurinus; mahaganus.prototype.martiniquensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.devius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.masalai = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.kathleenae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.simulus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.nigrovittatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.senegalensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.acticola = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return mahaganus; @@ -4103,9 +3427,7 @@ var macrorhinos; marmosurus.prototype.tansaniana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return marmosurus; @@ -4122,9 +3444,7 @@ var howi; angulatus.prototype.pennatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return angulatus; @@ -4148,65 +3468,49 @@ var nigra; thalia.prototype.dichotomus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.arnuxii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.verheyeni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.dauuricus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.tristriatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.lasiura = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.gangetica = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.brucei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return thalia; @@ -4223,9 +3527,7 @@ var sagitta; walkeri.prototype.maracajuensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return walkeri; @@ -4242,9 +3544,7 @@ var minutus; inez.prototype.vexillaris = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return inez; @@ -4272,73 +3572,55 @@ var panamensis; linulus.prototype.goslingi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.taki = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.fumosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.rufinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.lami = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.regina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.nanilla = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.enganus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.gomantongensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return linulus; @@ -4353,105 +3635,79 @@ var nigra; gracilis.prototype.weddellii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.echinothrix = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.garridoi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.rouxii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.aurita = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.geoffrensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.theresa = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.melanocarpus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.dubiaquercus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.pectoralis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.apoensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.grisescens = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.ramirohitra = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return gracilis; @@ -4468,105 +3724,79 @@ var samarensis; pelurus.prototype.Palladium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.castanea = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.chamek = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.nigriceps = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.lunatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.madurae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.chinchilla = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.eliasi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.proditor = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.gambianus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.petteri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.nusatenggara = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.olitor = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return pelurus; @@ -4580,113 +3810,85 @@ var samarensis; fuscus.prototype.planifrons = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.badia = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.prymnolopha = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.natalensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.hunteri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.sapiens = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.macrocercus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.nimbae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.suricatta = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.jagorii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.beecrofti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.imaizumii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.colocolo = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.wolfi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return fuscus; @@ -4698,33 +3900,25 @@ var samarensis; pallidus.prototype.oblativa = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pallidus.prototype.watersi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pallidus.prototype.glacialis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pallidus.prototype.viaria = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return pallidus; @@ -4736,41 +3930,31 @@ var samarensis; cahirinus.prototype.alashanicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cahirinus.prototype.flaviventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cahirinus.prototype.bottai = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cahirinus.prototype.pinetis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cahirinus.prototype.saussurei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return cahirinus; @@ -4787,41 +3971,31 @@ var sagitta; leptoceros.prototype.victus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; leptoceros.prototype.hoplomyoides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; leptoceros.prototype.gratiosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; leptoceros.prototype.rex = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; leptoceros.prototype.bolami = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return leptoceros; @@ -4838,9 +4012,7 @@ var daubentonii; nigricans.prototype.woosnami = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return nigricans; @@ -4866,25 +4038,19 @@ var argurus; pygmaea.prototype.pajeros = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pygmaea.prototype.capucinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pygmaea.prototype.cuvieri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return pygmaea; @@ -4901,57 +4067,43 @@ var chrysaeolus; sarasinorum.prototype.belzebul = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.hinpoon = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.kandti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.cynosuros = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.Germanium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.Ununoctium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.princeps = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return sarasinorum; @@ -4966,57 +4118,43 @@ var argurus; wetmorei.prototype.leucoptera = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.ochraventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.tephromelas = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.cracens = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.jamaicensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.gymnocaudus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.mayori = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return wetmorei; @@ -5033,65 +4171,49 @@ var argurus; oreas.prototype.salamonis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.paniscus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.fagani = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.papuanus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.timidus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.nghetinhensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.barbei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.univittatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return oreas; @@ -5106,97 +4228,73 @@ var daubentonii; arboreus.prototype.capreolus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.moreni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.hypoleucos = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.paedulcus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.pucheranii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.stella = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.brasiliensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.brevicaudata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.vitticollis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.huangensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.cameroni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.tianshanica = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return arboreus; @@ -5211,105 +4309,79 @@ var patas; uralensis.prototype.cartilagonodus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.pyrrhinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.insulans = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.nigricauda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.muricauda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.albicaudus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.fallax = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.attenuata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.megalura = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.neblina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.citellus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.tanezumi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.albiventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return uralensis; @@ -5326,17 +4398,13 @@ var provocax; melanoleuca.prototype.Neodymium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanoleuca.prototype.baeri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return melanoleuca; @@ -5351,17 +4419,13 @@ var sagitta; sicarius.prototype.Chlorine = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sicarius.prototype.simulator = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return sicarius; @@ -5378,113 +4442,85 @@ var howi; marcanoi.prototype.formosae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.dudui = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.leander = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.martinsi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.beatrix = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.griseoventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.zerda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.yucatanicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.nigrita = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.jouvenetae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.indefessus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.vuquangensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.Zirconium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.hyaena = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return marcanoi; @@ -5499,97 +4535,73 @@ var argurus; gilbertii.prototype.nasutus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.poecilops = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.sondaicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.auriventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.cherriei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.lindberghi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.pipistrellus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.paranus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.dubosti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.opossum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.oreopolus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.amurensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return gilbertii; @@ -5613,105 +4625,79 @@ var lutreolus; punicus.prototype.strandi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.lar = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.erica = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.trichura = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.lemniscatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.aspalax = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.marshalli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.Zinc = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.monochromos = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.purinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.ischyrus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.tenuis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.Helium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return punicus; @@ -5726,49 +4712,37 @@ var macrorhinos; daphaenodon.prototype.bredanensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; daphaenodon.prototype.othus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; daphaenodon.prototype.hammondi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; daphaenodon.prototype.aureocollaris = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; daphaenodon.prototype.flavipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; daphaenodon.prototype.callosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return daphaenodon; @@ -5783,97 +4757,73 @@ var sagitta; cinereus.prototype.zunigae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.microps = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.guaporensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.tonkeana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.montensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.sphinx = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.glis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.dorsalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.fimbriatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.sara = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.epimelas = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.pittieri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return cinereus; @@ -5905,81 +4855,61 @@ var gabriellae; amicus.prototype.pirrensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.phaeura = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.voratus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.satarae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.hooperi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.perrensi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.ridei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.audeberti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.Lutetium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.atrox = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return amicus; @@ -5991,9 +4921,7 @@ var gabriellae; echinatus.prototype.tenuipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return echinatus; @@ -6008,49 +4936,37 @@ var imperfecta; lasiurus.prototype.marisae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lasiurus.prototype.fulvus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lasiurus.prototype.paranaensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lasiurus.prototype.didactylus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lasiurus.prototype.schreibersii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lasiurus.prototype.orii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return lasiurus; @@ -6062,89 +4978,67 @@ var imperfecta; subspinosus.prototype.monticularis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.Gadolinium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.oasicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.paterculus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.punctata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.invictus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.stangeri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.siskiyou = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.welwitschii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.Polonium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.harpia = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return subspinosus; @@ -6158,25 +5052,19 @@ var imperfecta; ciliolabrum.prototype.leschenaultii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; ciliolabrum.prototype.ludia = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; ciliolabrum.prototype.sinicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return ciliolabrum; @@ -6191,33 +5079,25 @@ var quasiater; wattsi.prototype.lagotis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wattsi.prototype.hussoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wattsi.prototype.bilarni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wattsi.prototype.cabrerae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return wattsi; @@ -6234,73 +5114,55 @@ var petrophilus; sodyi.prototype.saundersiae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.imberbis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.cansdalei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.Lawrencium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.catta = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.breviceps = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.transitionalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.heptneri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.bairdii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return sodyi; @@ -6317,65 +5179,49 @@ var caurinus; megaphyllus.prototype.montana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.amatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.bucculentus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.lepida = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.graecus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.forsteri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.perotensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.cirrhosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return megaphyllus; @@ -6390,25 +5236,19 @@ var minutus; portoricensis.prototype.relictus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; portoricensis.prototype.aequatorianus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; portoricensis.prototype.rhinogradoides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return portoricensis; @@ -6423,105 +5263,79 @@ var lutreolus; foina.prototype.tarfayensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.Promethium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.salinae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.kerri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.scotti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.camerunensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.affinis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.siebersi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.maquassiensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.layardi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.bishopi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.apodemoides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.argentiventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return foina; @@ -6538,81 +5352,61 @@ var lutreolus; cor.prototype.antinorii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.voi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.mussoi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.truncatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.achates = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.praedatrix = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.mzabi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.xanthinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.tapoatafa = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.castroviejoi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return cor; @@ -6627,17 +5421,13 @@ var howi; coludo.prototype.bernhardi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; coludo.prototype.isseli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return coludo; @@ -6654,17 +5444,13 @@ var argurus; germaini.prototype.sharpei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; germaini.prototype.palmarum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return germaini; @@ -6679,89 +5465,67 @@ var sagitta; stolzmanni.prototype.riparius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.dhofarensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.tricolor = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.gardneri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.walleri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.talpoides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.pallipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.lagurus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.hipposideros = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.griselda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.florium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return stolzmanni; @@ -6778,105 +5542,79 @@ var dammermani; melanops.prototype.blarina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.harwoodi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.ashaninka = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.wiedii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.godmani = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.condorensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.xerophila = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.laminatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.archeri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.hidalgo = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.unicolor = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.philippii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.bocagei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return melanops; @@ -6893,65 +5631,49 @@ var argurus; peninsulae.prototype.aitkeni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.novaeangliae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.olallae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.anselli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.timminsi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.sordidus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.telfordi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.cavernarum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return peninsulae; @@ -6966,105 +5688,79 @@ var argurus; netscheri.prototype.gravis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.ruschii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.tricuspidatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.fernandezi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.colletti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.microbullatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.eburneae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.tatei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.millardi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.pruinosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.delator = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.nyikae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.ruemmleri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return netscheri; @@ -7081,105 +5777,79 @@ var ruatanica; Praseodymium.prototype.clara = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.spectabilis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.kamensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.ruddi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.bartelsii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.yerbabuenae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.davidi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.pilirostris = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.catherinae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.frontata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.Terbium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.thomensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.soricinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return Praseodymium; @@ -7196,9 +5866,7 @@ var caurinus; johorensis.prototype.maini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return johorensis; @@ -7213,9 +5881,7 @@ var argurus; luctuosa.prototype.loriae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return luctuosa; @@ -7230,65 +5896,49 @@ var panamensis; setulosus.prototype.duthieae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.guereza = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.buselaphus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.nuttalli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.pelii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.tunneyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.lamula = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.vampyrus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return setulosus; @@ -7303,41 +5953,31 @@ var petrophilus; rosalia.prototype.palmeri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; rosalia.prototype.baeops = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; rosalia.prototype.ozensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; rosalia.prototype.creaghi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; rosalia.prototype.montivaga = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return rosalia; @@ -7354,49 +5994,37 @@ var caurinus; psilurus.prototype.socialis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; psilurus.prototype.lundi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; psilurus.prototype.araeum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; psilurus.prototype.calamianensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; psilurus.prototype.petersoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; psilurus.prototype.nitela = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return psilurus; diff --git a/tests/baselines/reference/restElementWithNullInitializer.errors.txt b/tests/baselines/reference/restElementWithNullInitializer.errors.txt new file mode 100644 index 00000000000..7beb7b9a642 --- /dev/null +++ b/tests/baselines/reference/restElementWithNullInitializer.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(1,15): error TS2461: Type 'null' is not an array type. +tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(4,15): error TS2461: Type 'undefined' is not an array type. +tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(7,15): error TS2461: Type '{ [x: number]: undefined; }' is not an array type. + + +==== tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts (3 errors) ==== + function foo1([...r] = null) { + ~~~~~~ +!!! error TS2461: Type 'null' is not an array type. + } + + function foo2([...r] = undefined) { + ~~~~~~ +!!! error TS2461: Type 'undefined' is not an array type. + } + + function foo3([...r] = {}) { + ~~~~~~ +!!! error TS2461: Type '{ [x: number]: undefined; }' is not an array type. + } + + function foo4([...r] = []) { + } + \ No newline at end of file diff --git a/tests/baselines/reference/restElementWithNullInitializer.js b/tests/baselines/reference/restElementWithNullInitializer.js new file mode 100644 index 00000000000..9f326602fb8 --- /dev/null +++ b/tests/baselines/reference/restElementWithNullInitializer.js @@ -0,0 +1,27 @@ +//// [restElementWithNullInitializer.ts] +function foo1([...r] = null) { +} + +function foo2([...r] = undefined) { +} + +function foo3([...r] = {}) { +} + +function foo4([...r] = []) { +} + + +//// [restElementWithNullInitializer.js] +function foo1(_a) { + var _b = _a === void 0 ? null : _a, r = _b.slice(0); +} +function foo2(_a) { + var _b = _a === void 0 ? undefined : _a, r = _b.slice(0); +} +function foo3(_a) { + var _b = _a === void 0 ? {} : _a, r = _b.slice(0); +} +function foo4(_a) { + var _b = _a === void 0 ? [] : _a, r = _b.slice(0); +} diff --git a/tests/baselines/reference/returnStatements.js b/tests/baselines/reference/returnStatements.js index 59a91566043..77b6ae1f774 100644 --- a/tests/baselines/reference/returnStatements.js +++ b/tests/baselines/reference/returnStatements.js @@ -32,30 +32,14 @@ var __extends = this.__extends || function (d, b) { d.prototype = new __(); }; // all the following should be valid -function fn1() { - return 1; -} -function fn2() { - return ''; -} -function fn3() { - return undefined; -} -function fn4() { - return; -} -function fn5() { - return true; -} -function fn6() { - return new Date(12); -} -function fn7() { - return null; -} -function fn8() { - return; -} // OK, eq. to 'return undefined' +function fn1() { return 1; } +function fn2() { return ''; } +function fn3() { return undefined; } +function fn4() { return; } +function fn5() { return true; } +function fn6() { return new Date(12); } +function fn7() { return null; } +function fn8() { return; } // OK, eq. to 'return undefined' var C = (function () { function C() { } @@ -69,15 +53,7 @@ var D = (function (_super) { } return D; })(C); -function fn10() { - return { id: 12 }; -} -function fn11() { - return new C(); -} -function fn12() { - return new D(); -} -function fn13() { - return null; -} +function fn10() { return { id: 12 }; } +function fn11() { return new C(); } +function fn12() { return new D(); } +function fn13() { return null; } diff --git a/tests/baselines/reference/returnTypeParameter.js b/tests/baselines/reference/returnTypeParameter.js index 75e8a998942..d5f46cba776 100644 --- a/tests/baselines/reference/returnTypeParameter.js +++ b/tests/baselines/reference/returnTypeParameter.js @@ -4,6 +4,4 @@ function f2(a: T): T { return T; } // bug was that this satisfied the return //// [returnTypeParameter.js] function f(a) { } // error, no return statement -function f2(a) { - return T; -} // bug was that this satisfied the return statement requirement +function f2(a) { return T; } // bug was that this satisfied the return statement requirement diff --git a/tests/baselines/reference/returnTypeParameterWithModules.js b/tests/baselines/reference/returnTypeParameterWithModules.js index 2894774de01..4790fe1341b 100644 --- a/tests/baselines/reference/returnTypeParameterWithModules.js +++ b/tests/baselines/reference/returnTypeParameterWithModules.js @@ -33,9 +33,7 @@ var M2; M2.compose = compose; ; function compose2(g, f) { - return function (x) { - return g(f(x)); - }; + return function (x) { return g(f(x)); }; } M2.compose2 = compose2; ; diff --git a/tests/baselines/reference/returnTypeTypeArguments.js b/tests/baselines/reference/returnTypeTypeArguments.js index 5be549d2f34..b374cb1c581 100644 --- a/tests/baselines/reference/returnTypeTypeArguments.js +++ b/tests/baselines/reference/returnTypeTypeArguments.js @@ -92,65 +92,31 @@ var Three = (function () { } return Three; })(); -function A1() { - return null; -} -function A2() { - return null; -} -function A3() { - return null; -} -function B1() { - return null; -} -function B2() { - return null; -} -function B3() { - return null; -} +function A1() { return null; } +function A2() { return null; } +function A3() { return null; } +function B1() { return null; } +function B2() { return null; } +function B3() { return null; } var C = (function () { function C() { } - C.prototype.A1 = function () { - return null; - }; - C.prototype.A2 = function () { - return null; - }; - C.prototype.A3 = function () { - return null; - }; - C.prototype.B1 = function () { - return null; - }; - C.prototype.B2 = function () { - return null; - }; - C.prototype.B3 = function () { - return null; - }; + C.prototype.A1 = function () { return null; }; + C.prototype.A2 = function () { return null; }; + C.prototype.A3 = function () { return null; }; + C.prototype.B1 = function () { return null; }; + C.prototype.B2 = function () { return null; }; + C.prototype.B3 = function () { return null; }; return C; })(); var D = (function () { function D() { } - D.prototype.A2 = function () { - return null; - }; - D.prototype.A3 = function () { - return null; - }; - D.prototype.B1 = function () { - return null; - }; - D.prototype.B2 = function () { - return null; - }; - D.prototype.B3 = function () { - return null; - }; + D.prototype.A2 = function () { return null; }; + D.prototype.A3 = function () { return null; }; + D.prototype.B1 = function () { return null; }; + D.prototype.B2 = function () { return null; }; + D.prototype.B3 = function () { return null; }; return D; })(); var Y = (function () { diff --git a/tests/baselines/reference/reverseInferenceInContextualInstantiation.js b/tests/baselines/reference/reverseInferenceInContextualInstantiation.js index 7108029ac54..f9c3242e1ea 100644 --- a/tests/baselines/reference/reverseInferenceInContextualInstantiation.js +++ b/tests/baselines/reference/reverseInferenceInContextualInstantiation.js @@ -5,8 +5,6 @@ x.sort(compare); // Error, but shouldn't be //// [reverseInferenceInContextualInstantiation.js] -function compare(a, b) { - return 0; -} +function compare(a, b) { return 0; } var x; x.sort(compare); // Error, but shouldn't be diff --git a/tests/baselines/reference/scannertest1.js b/tests/baselines/reference/scannertest1.js index dc003e95a8f..8c9d805c5f2 100644 --- a/tests/baselines/reference/scannertest1.js +++ b/tests/baselines/reference/scannertest1.js @@ -33,7 +33,9 @@ var CharacterInfo = (function () { return c >= CharacterCodes._0 && c <= CharacterCodes._9; }; CharacterInfo.isHexDigit = function (c) { - return isDecimalDigit(c) || (c >= CharacterCodes.A && c <= CharacterCodes.F) || (c >= CharacterCodes.a && c <= CharacterCodes.f); + return isDecimalDigit(c) || + (c >= CharacterCodes.A && c <= CharacterCodes.F) || + (c >= CharacterCodes.a && c <= CharacterCodes.f); }; CharacterInfo.hexValue = function (c) { Debug.assert(isHexDigit(c)); diff --git a/tests/baselines/reference/selfInCallback.js b/tests/baselines/reference/selfInCallback.js index 85f16390f96..25228b03187 100644 --- a/tests/baselines/reference/selfInCallback.js +++ b/tests/baselines/reference/selfInCallback.js @@ -12,14 +12,10 @@ var C = (function () { function C() { this.p1 = 0; } - C.prototype.callback = function (cb) { - cb(); - }; + C.prototype.callback = function (cb) { cb(); }; C.prototype.doit = function () { var _this = this; - this.callback(function () { - _this.p1 + 1; - }); + this.callback(function () { _this.p1 + 1; }); }; return C; })(); diff --git a/tests/baselines/reference/shadowingViaLocalValue.errors.txt b/tests/baselines/reference/shadowingViaLocalValue.errors.txt new file mode 100644 index 00000000000..8e6f16b91cc --- /dev/null +++ b/tests/baselines/reference/shadowingViaLocalValue.errors.txt @@ -0,0 +1,30 @@ +tests/cases/compiler/shadowingViaLocalValue.ts(2,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. +tests/cases/compiler/shadowingViaLocalValue.ts(4,13): error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. +tests/cases/compiler/shadowingViaLocalValue.ts(9,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. +tests/cases/compiler/shadowingViaLocalValue.ts(11,18): error TS2481: Cannot initialize outer scoped variable 'x1' in the same scope as block scoped declaration 'x1'. + + +==== tests/cases/compiler/shadowingViaLocalValue.ts (4 errors) ==== + { + let x; + ~~~ +!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. + { + var x = 1; + ~ +!!! error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. + } + } + + { + let x1; + ~~~ +!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. + { + for (var x1 = 0; ;); + ~~ +!!! error TS2481: Cannot initialize outer scoped variable 'x1' in the same scope as block scoped declaration 'x1'. + } + } + + \ No newline at end of file diff --git a/tests/baselines/reference/shadowingViaLocalValue.js b/tests/baselines/reference/shadowingViaLocalValue.js new file mode 100644 index 00000000000..f99a209f0de --- /dev/null +++ b/tests/baselines/reference/shadowingViaLocalValue.js @@ -0,0 +1,31 @@ +//// [shadowingViaLocalValue.ts] +{ + let x; + { + var x = 1; + } +} + +{ + let x1; + { + for (var x1 = 0; ;); + } +} + + + +//// [shadowingViaLocalValue.js] +{ + let x; + { + var x = 1; + } +} +{ + let x1; + { + for (var x1 = 0;;) + ; + } +} diff --git a/tests/baselines/reference/sourceMap-FileWithComments.js b/tests/baselines/reference/sourceMap-FileWithComments.js index 6143ff95fb8..e9755f6c048 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.js +++ b/tests/baselines/reference/sourceMap-FileWithComments.js @@ -48,9 +48,7 @@ var Shapes; this.y = y; } // Instance member - Point.prototype.getDist = function () { - return Math.sqrt(this.x * this.x + this.y * this.y); - }; + Point.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; // Static member Point.origin = new Point(0, 0); return Point; diff --git a/tests/baselines/reference/sourceMap-FileWithComments.js.map b/tests/baselines/reference/sourceMap-FileWithComments.js.map index 7405d21eb85..28d4566efc7 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.js.map +++ b/tests/baselines/reference/sourceMap-FileWithComments.js.map @@ -1,2 +1,2 @@ //// [sourceMap-FileWithComments.js.map] -{"version":3,"file":"sourceMap-FileWithComments.js","sourceRoot":"","sources":["sourceMap-FileWithComments.ts"],"names":["Shapes","Shapes.Point","Shapes.Point.constructor","Shapes.Point.getDist","Shapes.foo"],"mappings":"AAOA,AADA,SAAS;AACT,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM,EAAC,CAAC;IAGXA,AADAA,QAAQA;QACKA,KAAKA;QACdC,cAAcA;QACdA,SAFSA,KAAKA,CAEKA,CAASA,EAASA,CAASA;YAA3BC,MAACA,GAADA,CAACA,CAAQA;YAASA,MAACA,GAADA,CAACA,CAAQA;QAAIA,CAACA;QAEnDD,kBAAkBA;QAClBA,uBAAOA,GAAPA;YAAYE,MAAMA,CAACA,IAAIA,CAACA,IAAIA,CAACA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,CAACA,CAACA;QAACA,CAACA;QAElEF,gBAAgBA;QACTA,YAAMA,GAAGA,IAAIA,KAAKA,CAACA,CAACA,EAAEA,CAACA,CAACA,CAACA;QACpCA,YAACA;IAADA,CAACA,AATDD,IASCA;IATYA,YAAKA,GAALA,KASZA,CAAAA;IAGDA,AADAA,+BAA+BA;QAC3BA,CAACA,GAAGA,EAAEA,CAACA;IAEXA,SAAgBA,GAAGA;IACnBI,CAACA;IADeJ,UAAGA,GAAHA,GACfA,CAAAA;IAKDA,AAHAA;;MAEEA;QACEA,CAACA,GAAGA,EAAEA,CAACA;AACfA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ;AAGD,AADA,qBAAqB;IACjB,CAAC,GAAW,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,IAAI,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMap-FileWithComments.js","sourceRoot":"","sources":["sourceMap-FileWithComments.ts"],"names":["Shapes","Shapes.Point","Shapes.Point.constructor","Shapes.Point.getDist","Shapes.foo"],"mappings":"AAOA,AADA,SAAS;AACT,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM,EAAC,CAAC;IAGXA,AADAA,QAAQA;QACKA,KAAKA;QACdC,cAAcA;QACdA,SAFSA,KAAKA,CAEKA,CAASA,EAASA,CAASA;YAA3BC,MAACA,GAADA,CAACA,CAAQA;YAASA,MAACA,GAADA,CAACA,CAAQA;QAAIA,CAACA;QAEnDD,kBAAkBA;QAClBA,uBAAOA,GAAPA,cAAYE,MAAMA,CAACA,IAAIA,CAACA,IAAIA,CAACA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,CAACA,CAACA,CAACA,CAACA;QAElEF,gBAAgBA;QACTA,YAAMA,GAAGA,IAAIA,KAAKA,CAACA,CAACA,EAAEA,CAACA,CAACA,CAACA;QACpCA,YAACA;IAADA,CAACA,AATDD,IASCA;IATYA,YAAKA,GAALA,KASZA,CAAAA;IAGDA,AADAA,+BAA+BA;QAC3BA,CAACA,GAAGA,EAAEA,CAACA;IAEXA,SAAgBA,GAAGA;IACnBI,CAACA;IADeJ,UAAGA,GAAHA,GACfA,CAAAA;IAKDA,AAHAA;;MAEEA;QACEA,CAACA,GAAGA,EAAEA,CAACA;AACfA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ;AAGD,AADA,qBAAqB;IACjB,CAAC,GAAW,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,IAAI,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt b/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt index 8dc11688ab0..c0e46430688 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt +++ b/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt @@ -192,7 +192,7 @@ sourceFile:sourceMap-FileWithComments.ts >>> // Instance member 1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @@ -200,112 +200,106 @@ sourceFile:sourceMap-FileWithComments.ts 1->Emitted(11, 9) Source(15, 9) + SourceIndex(0) name (Shapes.Point) 2 >Emitted(11, 27) Source(15, 27) + SourceIndex(0) name (Shapes.Point) --- ->>> Point.prototype.getDist = function () { +>>> Point.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; 1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^ +8 > ^ +9 > ^^^^ +10> ^ +11> ^^^^ +12> ^ +13> ^ +14> ^^^ +15> ^^^^ +16> ^ +17> ^ +18> ^^^ +19> ^^^^ +20> ^ +21> ^ +22> ^^^ +23> ^^^^ +24> ^ +25> ^ +26> ^ +27> ^ +28> ^ +29> ^ 1-> > 2 > getDist 3 > +4 > getDist() { +5 > return +6 > +7 > Math +8 > . +9 > sqrt +10> ( +11> this +12> . +13> x +14> * +15> this +16> . +17> x +18> + +19> this +20> . +21> y +22> * +23> this +24> . +25> y +26> ) +27> ; +28> +29> } 1->Emitted(12, 9) Source(16, 9) + SourceIndex(0) name (Shapes.Point) 2 >Emitted(12, 32) Source(16, 16) + SourceIndex(0) name (Shapes.Point) 3 >Emitted(12, 35) Source(16, 9) + SourceIndex(0) name (Shapes.Point) ---- ->>> return Math.sqrt(this.x * this.x + this.y * this.y); -1->^^^^^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^ -6 > ^^^^ -7 > ^ -8 > ^^^^ -9 > ^ -10> ^ -11> ^^^ -12> ^^^^ -13> ^ -14> ^ -15> ^^^ -16> ^^^^ -17> ^ -18> ^ -19> ^^^ -20> ^^^^ -21> ^ -22> ^ -23> ^ -24> ^ -1->getDist() { -2 > return -3 > -4 > Math -5 > . -6 > sqrt -7 > ( -8 > this -9 > . -10> x -11> * -12> this -13> . -14> x -15> + -16> this -17> . -18> y -19> * -20> this -21> . -22> y -23> ) -24> ; -1->Emitted(13, 13) Source(16, 21) + SourceIndex(0) name (Shapes.Point.getDist) -2 >Emitted(13, 19) Source(16, 27) + SourceIndex(0) name (Shapes.Point.getDist) -3 >Emitted(13, 20) Source(16, 28) + SourceIndex(0) name (Shapes.Point.getDist) -4 >Emitted(13, 24) Source(16, 32) + SourceIndex(0) name (Shapes.Point.getDist) -5 >Emitted(13, 25) Source(16, 33) + SourceIndex(0) name (Shapes.Point.getDist) -6 >Emitted(13, 29) Source(16, 37) + SourceIndex(0) name (Shapes.Point.getDist) -7 >Emitted(13, 30) Source(16, 38) + SourceIndex(0) name (Shapes.Point.getDist) -8 >Emitted(13, 34) Source(16, 42) + SourceIndex(0) name (Shapes.Point.getDist) -9 >Emitted(13, 35) Source(16, 43) + SourceIndex(0) name (Shapes.Point.getDist) -10>Emitted(13, 36) Source(16, 44) + SourceIndex(0) name (Shapes.Point.getDist) -11>Emitted(13, 39) Source(16, 47) + SourceIndex(0) name (Shapes.Point.getDist) -12>Emitted(13, 43) Source(16, 51) + SourceIndex(0) name (Shapes.Point.getDist) -13>Emitted(13, 44) Source(16, 52) + SourceIndex(0) name (Shapes.Point.getDist) -14>Emitted(13, 45) Source(16, 53) + SourceIndex(0) name (Shapes.Point.getDist) -15>Emitted(13, 48) Source(16, 56) + SourceIndex(0) name (Shapes.Point.getDist) -16>Emitted(13, 52) Source(16, 60) + SourceIndex(0) name (Shapes.Point.getDist) -17>Emitted(13, 53) Source(16, 61) + SourceIndex(0) name (Shapes.Point.getDist) -18>Emitted(13, 54) Source(16, 62) + SourceIndex(0) name (Shapes.Point.getDist) -19>Emitted(13, 57) Source(16, 65) + SourceIndex(0) name (Shapes.Point.getDist) -20>Emitted(13, 61) Source(16, 69) + SourceIndex(0) name (Shapes.Point.getDist) -21>Emitted(13, 62) Source(16, 70) + SourceIndex(0) name (Shapes.Point.getDist) -22>Emitted(13, 63) Source(16, 71) + SourceIndex(0) name (Shapes.Point.getDist) -23>Emitted(13, 64) Source(16, 72) + SourceIndex(0) name (Shapes.Point.getDist) -24>Emitted(13, 65) Source(16, 73) + SourceIndex(0) name (Shapes.Point.getDist) ---- ->>> }; -1 >^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > -2 > } -1 >Emitted(14, 9) Source(16, 74) + SourceIndex(0) name (Shapes.Point.getDist) -2 >Emitted(14, 10) Source(16, 75) + SourceIndex(0) name (Shapes.Point.getDist) +4 >Emitted(12, 49) Source(16, 21) + SourceIndex(0) name (Shapes.Point.getDist) +5 >Emitted(12, 55) Source(16, 27) + SourceIndex(0) name (Shapes.Point.getDist) +6 >Emitted(12, 56) Source(16, 28) + SourceIndex(0) name (Shapes.Point.getDist) +7 >Emitted(12, 60) Source(16, 32) + SourceIndex(0) name (Shapes.Point.getDist) +8 >Emitted(12, 61) Source(16, 33) + SourceIndex(0) name (Shapes.Point.getDist) +9 >Emitted(12, 65) Source(16, 37) + SourceIndex(0) name (Shapes.Point.getDist) +10>Emitted(12, 66) Source(16, 38) + SourceIndex(0) name (Shapes.Point.getDist) +11>Emitted(12, 70) Source(16, 42) + SourceIndex(0) name (Shapes.Point.getDist) +12>Emitted(12, 71) Source(16, 43) + SourceIndex(0) name (Shapes.Point.getDist) +13>Emitted(12, 72) Source(16, 44) + SourceIndex(0) name (Shapes.Point.getDist) +14>Emitted(12, 75) Source(16, 47) + SourceIndex(0) name (Shapes.Point.getDist) +15>Emitted(12, 79) Source(16, 51) + SourceIndex(0) name (Shapes.Point.getDist) +16>Emitted(12, 80) Source(16, 52) + SourceIndex(0) name (Shapes.Point.getDist) +17>Emitted(12, 81) Source(16, 53) + SourceIndex(0) name (Shapes.Point.getDist) +18>Emitted(12, 84) Source(16, 56) + SourceIndex(0) name (Shapes.Point.getDist) +19>Emitted(12, 88) Source(16, 60) + SourceIndex(0) name (Shapes.Point.getDist) +20>Emitted(12, 89) Source(16, 61) + SourceIndex(0) name (Shapes.Point.getDist) +21>Emitted(12, 90) Source(16, 62) + SourceIndex(0) name (Shapes.Point.getDist) +22>Emitted(12, 93) Source(16, 65) + SourceIndex(0) name (Shapes.Point.getDist) +23>Emitted(12, 97) Source(16, 69) + SourceIndex(0) name (Shapes.Point.getDist) +24>Emitted(12, 98) Source(16, 70) + SourceIndex(0) name (Shapes.Point.getDist) +25>Emitted(12, 99) Source(16, 71) + SourceIndex(0) name (Shapes.Point.getDist) +26>Emitted(12, 100) Source(16, 72) + SourceIndex(0) name (Shapes.Point.getDist) +27>Emitted(12, 101) Source(16, 73) + SourceIndex(0) name (Shapes.Point.getDist) +28>Emitted(12, 102) Source(16, 74) + SourceIndex(0) name (Shapes.Point.getDist) +29>Emitted(12, 103) Source(16, 75) + SourceIndex(0) name (Shapes.Point.getDist) --- >>> // Static member -1->^^^^^^^^ +1 >^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^ 3 > ^^^^^^^^^^^^^^^^-> -1-> +1 > > > 2 > // Static member -1->Emitted(15, 9) Source(18, 9) + SourceIndex(0) name (Shapes.Point) -2 >Emitted(15, 25) Source(18, 25) + SourceIndex(0) name (Shapes.Point) +1 >Emitted(13, 9) Source(18, 9) + SourceIndex(0) name (Shapes.Point) +2 >Emitted(13, 25) Source(18, 25) + SourceIndex(0) name (Shapes.Point) --- >>> Point.origin = new Point(0, 0); 1->^^^^^^^^ @@ -331,17 +325,17 @@ sourceFile:sourceMap-FileWithComments.ts 9 > 0 10> ) 11> ; -1->Emitted(16, 9) Source(19, 16) + SourceIndex(0) name (Shapes.Point) -2 >Emitted(16, 21) Source(19, 22) + SourceIndex(0) name (Shapes.Point) -3 >Emitted(16, 24) Source(19, 25) + SourceIndex(0) name (Shapes.Point) -4 >Emitted(16, 28) Source(19, 29) + SourceIndex(0) name (Shapes.Point) -5 >Emitted(16, 33) Source(19, 34) + SourceIndex(0) name (Shapes.Point) -6 >Emitted(16, 34) Source(19, 35) + SourceIndex(0) name (Shapes.Point) -7 >Emitted(16, 35) Source(19, 36) + SourceIndex(0) name (Shapes.Point) -8 >Emitted(16, 37) Source(19, 38) + SourceIndex(0) name (Shapes.Point) -9 >Emitted(16, 38) Source(19, 39) + SourceIndex(0) name (Shapes.Point) -10>Emitted(16, 39) Source(19, 40) + SourceIndex(0) name (Shapes.Point) -11>Emitted(16, 40) Source(19, 41) + SourceIndex(0) name (Shapes.Point) +1->Emitted(14, 9) Source(19, 16) + SourceIndex(0) name (Shapes.Point) +2 >Emitted(14, 21) Source(19, 22) + SourceIndex(0) name (Shapes.Point) +3 >Emitted(14, 24) Source(19, 25) + SourceIndex(0) name (Shapes.Point) +4 >Emitted(14, 28) Source(19, 29) + SourceIndex(0) name (Shapes.Point) +5 >Emitted(14, 33) Source(19, 34) + SourceIndex(0) name (Shapes.Point) +6 >Emitted(14, 34) Source(19, 35) + SourceIndex(0) name (Shapes.Point) +7 >Emitted(14, 35) Source(19, 36) + SourceIndex(0) name (Shapes.Point) +8 >Emitted(14, 37) Source(19, 38) + SourceIndex(0) name (Shapes.Point) +9 >Emitted(14, 38) Source(19, 39) + SourceIndex(0) name (Shapes.Point) +10>Emitted(14, 39) Source(19, 40) + SourceIndex(0) name (Shapes.Point) +11>Emitted(14, 40) Source(19, 41) + SourceIndex(0) name (Shapes.Point) --- >>> return Point; 1 >^^^^^^^^ @@ -349,8 +343,8 @@ sourceFile:sourceMap-FileWithComments.ts 1 > > 2 > } -1 >Emitted(17, 9) Source(20, 5) + SourceIndex(0) name (Shapes.Point) -2 >Emitted(17, 21) Source(20, 6) + SourceIndex(0) name (Shapes.Point) +1 >Emitted(15, 9) Source(20, 5) + SourceIndex(0) name (Shapes.Point) +2 >Emitted(15, 21) Source(20, 6) + SourceIndex(0) name (Shapes.Point) --- >>> })(); 1 >^^^^ @@ -371,10 +365,10 @@ sourceFile:sourceMap-FileWithComments.ts > // Static member > static origin = new Point(0, 0); > } -1 >Emitted(18, 5) Source(20, 5) + SourceIndex(0) name (Shapes.Point) -2 >Emitted(18, 6) Source(20, 6) + SourceIndex(0) name (Shapes.Point) -3 >Emitted(18, 6) Source(11, 5) + SourceIndex(0) name (Shapes) -4 >Emitted(18, 10) Source(20, 6) + SourceIndex(0) name (Shapes) +1 >Emitted(16, 5) Source(20, 5) + SourceIndex(0) name (Shapes.Point) +2 >Emitted(16, 6) Source(20, 6) + SourceIndex(0) name (Shapes.Point) +3 >Emitted(16, 6) Source(11, 5) + SourceIndex(0) name (Shapes) +4 >Emitted(16, 10) Source(20, 6) + SourceIndex(0) name (Shapes) --- >>> Shapes.Point = Point; 1->^^^^ @@ -397,11 +391,11 @@ sourceFile:sourceMap-FileWithComments.ts > static origin = new Point(0, 0); > } 5 > -1->Emitted(19, 5) Source(11, 18) + SourceIndex(0) name (Shapes) -2 >Emitted(19, 17) Source(11, 23) + SourceIndex(0) name (Shapes) -3 >Emitted(19, 20) Source(11, 18) + SourceIndex(0) name (Shapes) -4 >Emitted(19, 25) Source(20, 6) + SourceIndex(0) name (Shapes) -5 >Emitted(19, 26) Source(20, 6) + SourceIndex(0) name (Shapes) +1->Emitted(17, 5) Source(11, 18) + SourceIndex(0) name (Shapes) +2 >Emitted(17, 17) Source(11, 23) + SourceIndex(0) name (Shapes) +3 >Emitted(17, 20) Source(11, 18) + SourceIndex(0) name (Shapes) +4 >Emitted(17, 25) Source(20, 6) + SourceIndex(0) name (Shapes) +5 >Emitted(17, 26) Source(20, 6) + SourceIndex(0) name (Shapes) --- >>> // Variable comment after class 1->^^^^ @@ -413,9 +407,9 @@ sourceFile:sourceMap-FileWithComments.ts > 2 > 3 > // Variable comment after class -1->Emitted(20, 5) Source(23, 5) + SourceIndex(0) name (Shapes) -2 >Emitted(20, 5) Source(22, 5) + SourceIndex(0) name (Shapes) -3 >Emitted(20, 36) Source(22, 36) + SourceIndex(0) name (Shapes) +1->Emitted(18, 5) Source(23, 5) + SourceIndex(0) name (Shapes) +2 >Emitted(18, 5) Source(22, 5) + SourceIndex(0) name (Shapes) +3 >Emitted(18, 36) Source(22, 36) + SourceIndex(0) name (Shapes) --- >>> var a = 10; 1 >^^^^^^^^ @@ -430,11 +424,11 @@ sourceFile:sourceMap-FileWithComments.ts 3 > = 4 > 10 5 > ; -1 >Emitted(21, 9) Source(23, 9) + SourceIndex(0) name (Shapes) -2 >Emitted(21, 10) Source(23, 10) + SourceIndex(0) name (Shapes) -3 >Emitted(21, 13) Source(23, 13) + SourceIndex(0) name (Shapes) -4 >Emitted(21, 15) Source(23, 15) + SourceIndex(0) name (Shapes) -5 >Emitted(21, 16) Source(23, 16) + SourceIndex(0) name (Shapes) +1 >Emitted(19, 9) Source(23, 9) + SourceIndex(0) name (Shapes) +2 >Emitted(19, 10) Source(23, 10) + SourceIndex(0) name (Shapes) +3 >Emitted(19, 13) Source(23, 13) + SourceIndex(0) name (Shapes) +4 >Emitted(19, 15) Source(23, 15) + SourceIndex(0) name (Shapes) +5 >Emitted(19, 16) Source(23, 16) + SourceIndex(0) name (Shapes) --- >>> function foo() { 1->^^^^ @@ -445,9 +439,9 @@ sourceFile:sourceMap-FileWithComments.ts > 2 > export function 3 > foo -1->Emitted(22, 5) Source(25, 5) + SourceIndex(0) name (Shapes) -2 >Emitted(22, 14) Source(25, 21) + SourceIndex(0) name (Shapes) -3 >Emitted(22, 17) Source(25, 24) + SourceIndex(0) name (Shapes) +1->Emitted(20, 5) Source(25, 5) + SourceIndex(0) name (Shapes) +2 >Emitted(20, 14) Source(25, 21) + SourceIndex(0) name (Shapes) +3 >Emitted(20, 17) Source(25, 24) + SourceIndex(0) name (Shapes) --- >>> } 1 >^^^^ @@ -456,8 +450,8 @@ sourceFile:sourceMap-FileWithComments.ts 1 >() { > 2 > } -1 >Emitted(23, 5) Source(26, 5) + SourceIndex(0) name (Shapes.foo) -2 >Emitted(23, 6) Source(26, 6) + SourceIndex(0) name (Shapes.foo) +1 >Emitted(21, 5) Source(26, 5) + SourceIndex(0) name (Shapes.foo) +2 >Emitted(21, 6) Source(26, 6) + SourceIndex(0) name (Shapes.foo) --- >>> Shapes.foo = foo; 1->^^^^ @@ -472,11 +466,11 @@ sourceFile:sourceMap-FileWithComments.ts 4 > foo() { > } 5 > -1->Emitted(24, 5) Source(25, 21) + SourceIndex(0) name (Shapes) -2 >Emitted(24, 15) Source(25, 24) + SourceIndex(0) name (Shapes) -3 >Emitted(24, 18) Source(25, 21) + SourceIndex(0) name (Shapes) -4 >Emitted(24, 21) Source(26, 6) + SourceIndex(0) name (Shapes) -5 >Emitted(24, 22) Source(26, 6) + SourceIndex(0) name (Shapes) +1->Emitted(22, 5) Source(25, 21) + SourceIndex(0) name (Shapes) +2 >Emitted(22, 15) Source(25, 24) + SourceIndex(0) name (Shapes) +3 >Emitted(22, 18) Source(25, 21) + SourceIndex(0) name (Shapes) +4 >Emitted(22, 21) Source(26, 6) + SourceIndex(0) name (Shapes) +5 >Emitted(22, 22) Source(26, 6) + SourceIndex(0) name (Shapes) --- >>> /** comment after function 1->^^^^ @@ -489,8 +483,8 @@ sourceFile:sourceMap-FileWithComments.ts > */ > 2 > -1->Emitted(25, 5) Source(31, 5) + SourceIndex(0) name (Shapes) -2 >Emitted(25, 5) Source(28, 5) + SourceIndex(0) name (Shapes) +1->Emitted(23, 5) Source(31, 5) + SourceIndex(0) name (Shapes) +2 >Emitted(23, 5) Source(28, 5) + SourceIndex(0) name (Shapes) --- >>> * this is another comment >>> */ @@ -499,7 +493,7 @@ sourceFile:sourceMap-FileWithComments.ts 1->/** comment after function > * this is another comment > */ -1->Emitted(27, 7) Source(30, 7) + SourceIndex(0) name (Shapes) +1->Emitted(25, 7) Source(30, 7) + SourceIndex(0) name (Shapes) --- >>> var b = 10; 1->^^^^^^^^ @@ -514,11 +508,11 @@ sourceFile:sourceMap-FileWithComments.ts 3 > = 4 > 10 5 > ; -1->Emitted(28, 9) Source(31, 9) + SourceIndex(0) name (Shapes) -2 >Emitted(28, 10) Source(31, 10) + SourceIndex(0) name (Shapes) -3 >Emitted(28, 13) Source(31, 13) + SourceIndex(0) name (Shapes) -4 >Emitted(28, 15) Source(31, 15) + SourceIndex(0) name (Shapes) -5 >Emitted(28, 16) Source(31, 16) + SourceIndex(0) name (Shapes) +1->Emitted(26, 9) Source(31, 9) + SourceIndex(0) name (Shapes) +2 >Emitted(26, 10) Source(31, 10) + SourceIndex(0) name (Shapes) +3 >Emitted(26, 13) Source(31, 13) + SourceIndex(0) name (Shapes) +4 >Emitted(26, 15) Source(31, 15) + SourceIndex(0) name (Shapes) +5 >Emitted(26, 16) Source(31, 16) + SourceIndex(0) name (Shapes) --- >>>})(Shapes || (Shapes = {})); 1-> @@ -560,13 +554,13 @@ sourceFile:sourceMap-FileWithComments.ts > */ > var b = 10; > } -1->Emitted(29, 1) Source(32, 1) + SourceIndex(0) name (Shapes) -2 >Emitted(29, 2) Source(32, 2) + SourceIndex(0) name (Shapes) -3 >Emitted(29, 4) Source(8, 8) + SourceIndex(0) -4 >Emitted(29, 10) Source(8, 14) + SourceIndex(0) -5 >Emitted(29, 15) Source(8, 8) + SourceIndex(0) -6 >Emitted(29, 21) Source(8, 14) + SourceIndex(0) -7 >Emitted(29, 29) Source(32, 2) + SourceIndex(0) +1->Emitted(27, 1) Source(32, 1) + SourceIndex(0) name (Shapes) +2 >Emitted(27, 2) Source(32, 2) + SourceIndex(0) name (Shapes) +3 >Emitted(27, 4) Source(8, 8) + SourceIndex(0) +4 >Emitted(27, 10) Source(8, 14) + SourceIndex(0) +5 >Emitted(27, 15) Source(8, 8) + SourceIndex(0) +6 >Emitted(27, 21) Source(8, 14) + SourceIndex(0) +7 >Emitted(27, 29) Source(32, 2) + SourceIndex(0) --- >>>/** Local Variable */ 1 > @@ -579,9 +573,9 @@ sourceFile:sourceMap-FileWithComments.ts > 2 > 3 >/** Local Variable */ -1 >Emitted(30, 1) Source(35, 1) + SourceIndex(0) -2 >Emitted(30, 1) Source(34, 1) + SourceIndex(0) -3 >Emitted(30, 22) Source(34, 22) + SourceIndex(0) +1 >Emitted(28, 1) Source(35, 1) + SourceIndex(0) +2 >Emitted(28, 1) Source(34, 1) + SourceIndex(0) +3 >Emitted(28, 22) Source(34, 22) + SourceIndex(0) --- >>>var p = new Shapes.Point(3, 4); 1->^^^^ @@ -611,19 +605,19 @@ sourceFile:sourceMap-FileWithComments.ts 11> 4 12> ) 13> ; -1->Emitted(31, 5) Source(35, 5) + SourceIndex(0) -2 >Emitted(31, 6) Source(35, 6) + SourceIndex(0) -3 >Emitted(31, 9) Source(35, 17) + SourceIndex(0) -4 >Emitted(31, 13) Source(35, 21) + SourceIndex(0) -5 >Emitted(31, 19) Source(35, 27) + SourceIndex(0) -6 >Emitted(31, 20) Source(35, 28) + SourceIndex(0) -7 >Emitted(31, 25) Source(35, 33) + SourceIndex(0) -8 >Emitted(31, 26) Source(35, 34) + SourceIndex(0) -9 >Emitted(31, 27) Source(35, 35) + SourceIndex(0) -10>Emitted(31, 29) Source(35, 37) + SourceIndex(0) -11>Emitted(31, 30) Source(35, 38) + SourceIndex(0) -12>Emitted(31, 31) Source(35, 39) + SourceIndex(0) -13>Emitted(31, 32) Source(35, 40) + SourceIndex(0) +1->Emitted(29, 5) Source(35, 5) + SourceIndex(0) +2 >Emitted(29, 6) Source(35, 6) + SourceIndex(0) +3 >Emitted(29, 9) Source(35, 17) + SourceIndex(0) +4 >Emitted(29, 13) Source(35, 21) + SourceIndex(0) +5 >Emitted(29, 19) Source(35, 27) + SourceIndex(0) +6 >Emitted(29, 20) Source(35, 28) + SourceIndex(0) +7 >Emitted(29, 25) Source(35, 33) + SourceIndex(0) +8 >Emitted(29, 26) Source(35, 34) + SourceIndex(0) +9 >Emitted(29, 27) Source(35, 35) + SourceIndex(0) +10>Emitted(29, 29) Source(35, 37) + SourceIndex(0) +11>Emitted(29, 30) Source(35, 38) + SourceIndex(0) +12>Emitted(29, 31) Source(35, 39) + SourceIndex(0) +13>Emitted(29, 32) Source(35, 40) + SourceIndex(0) --- >>>var dist = p.getDist(); 1 > @@ -646,14 +640,14 @@ sourceFile:sourceMap-FileWithComments.ts 7 > getDist 8 > () 9 > ; -1 >Emitted(32, 1) Source(36, 1) + SourceIndex(0) -2 >Emitted(32, 5) Source(36, 5) + SourceIndex(0) -3 >Emitted(32, 9) Source(36, 9) + SourceIndex(0) -4 >Emitted(32, 12) Source(36, 12) + SourceIndex(0) -5 >Emitted(32, 13) Source(36, 13) + SourceIndex(0) -6 >Emitted(32, 14) Source(36, 14) + SourceIndex(0) -7 >Emitted(32, 21) Source(36, 21) + SourceIndex(0) -8 >Emitted(32, 23) Source(36, 23) + SourceIndex(0) -9 >Emitted(32, 24) Source(36, 24) + SourceIndex(0) +1 >Emitted(30, 1) Source(36, 1) + SourceIndex(0) +2 >Emitted(30, 5) Source(36, 5) + SourceIndex(0) +3 >Emitted(30, 9) Source(36, 9) + SourceIndex(0) +4 >Emitted(30, 12) Source(36, 12) + SourceIndex(0) +5 >Emitted(30, 13) Source(36, 13) + SourceIndex(0) +6 >Emitted(30, 14) Source(36, 14) + SourceIndex(0) +7 >Emitted(30, 21) Source(36, 21) + SourceIndex(0) +8 >Emitted(30, 23) Source(36, 23) + SourceIndex(0) +9 >Emitted(30, 24) Source(36, 24) + SourceIndex(0) --- >>>//# sourceMappingURL=sourceMap-FileWithComments.js.map \ No newline at end of file diff --git a/tests/baselines/reference/specializationsShouldNotAffectEachOther.js b/tests/baselines/reference/specializationsShouldNotAffectEachOther.js index d56e0938684..3116571166f 100644 --- a/tests/baselines/reference/specializationsShouldNotAffectEachOther.js +++ b/tests/baselines/reference/specializationsShouldNotAffectEachOther.js @@ -28,6 +28,4 @@ function foo() { series2.map(seriesExtent); return null; } -var keyExtent2 = series.data.map(function (d) { - return d; -}); +var keyExtent2 = series.data.map(function (d) { return d; }); diff --git a/tests/baselines/reference/specializeVarArgs1.js b/tests/baselines/reference/specializeVarArgs1.js index 3eac6daa61f..cc09df1daa6 100644 --- a/tests/baselines/reference/specializeVarArgs1.js +++ b/tests/baselines/reference/specializeVarArgs1.js @@ -23,8 +23,6 @@ a.push('Some Value'); //// [specializeVarArgs1.js] -function observableArray() { - return null; -} +function observableArray() { return null; } var a = observableArray(); a.push('Some Value'); diff --git a/tests/baselines/reference/staticFactory1.js b/tests/baselines/reference/staticFactory1.js index af5780d96cf..529cc230d73 100644 --- a/tests/baselines/reference/staticFactory1.js +++ b/tests/baselines/reference/staticFactory1.js @@ -23,9 +23,7 @@ var __extends = this.__extends || function (d, b) { var Base = (function () { function Base() { } - Base.prototype.foo = function () { - return 1; - }; + Base.prototype.foo = function () { return 1; }; Base.create = function () { return new this(); }; @@ -36,9 +34,7 @@ var Derived = (function (_super) { function Derived() { _super.apply(this, arguments); } - Derived.prototype.foo = function () { - return 2; - }; + Derived.prototype.foo = function () { return 2; }; return Derived; })(Base); var d = Derived.create(); diff --git a/tests/baselines/reference/staticGetterAndSetter.js b/tests/baselines/reference/staticGetterAndSetter.js index 64fcc134ad9..5c61af0b7cc 100644 --- a/tests/baselines/reference/staticGetterAndSetter.js +++ b/tests/baselines/reference/staticGetterAndSetter.js @@ -10,9 +10,7 @@ var Foo = (function () { function Foo() { } Object.defineProperty(Foo, "Foo", { - get: function () { - return 0; - }, + get: function () { return 0; }, set: function (n) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/staticMemberExportAccess.js b/tests/baselines/reference/staticMemberExportAccess.js index 5de5a76ca7a..37799356708 100644 --- a/tests/baselines/reference/staticMemberExportAccess.js +++ b/tests/baselines/reference/staticMemberExportAccess.js @@ -24,9 +24,7 @@ Sammy.bar(); var Sammy = (function () { function Sammy() { } - Sammy.prototype.foo = function () { - return "hi"; - }; + Sammy.prototype.foo = function () { return "hi"; }; Sammy.bar = function () { return -1; }; diff --git a/tests/baselines/reference/staticMethodsReferencingClassTypeParameters.js b/tests/baselines/reference/staticMethodsReferencingClassTypeParameters.js index 499e16ec581..76fa7d6249e 100644 --- a/tests/baselines/reference/staticMethodsReferencingClassTypeParameters.js +++ b/tests/baselines/reference/staticMethodsReferencingClassTypeParameters.js @@ -7,8 +7,6 @@ class C { var C = (function () { function C() { } - C.s = function (p) { - return p; - }; + C.s = function (p) { return p; }; return C; })(); diff --git a/tests/baselines/reference/staticPropertyNotInClassType.js b/tests/baselines/reference/staticPropertyNotInClassType.js index 3a00c80e033..e9df2b2158d 100644 --- a/tests/baselines/reference/staticPropertyNotInClassType.js +++ b/tests/baselines/reference/staticPropertyNotInClassType.js @@ -47,13 +47,9 @@ var NonGeneric; this.a = a; this.b = b; } - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; Object.defineProperty(C, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true @@ -77,13 +73,9 @@ var Generic; this.a = a; this.b = b; } - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; Object.defineProperty(C, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/staticVisibility.js b/tests/baselines/reference/staticVisibility.js index 0da2e3dbe2c..7dbf49a2baa 100644 --- a/tests/baselines/reference/staticVisibility.js +++ b/tests/baselines/reference/staticVisibility.js @@ -58,13 +58,9 @@ var C2 = (function () { this.barback = ""; } Object.defineProperty(C2, "Bar", { - get: function () { - return "bar"; - } // ok + get: function () { return "bar"; } // ok , - set: function (bar) { - barback = bar; - } // not ok + set: function (bar) { barback = bar; } // not ok , enumerable: true, configurable: true diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js index b9195403b20..c9278c40446 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js @@ -50,9 +50,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ''; - }; + A.prototype.foo = function () { return ''; }; return A; })(); var B = (function (_super) { @@ -60,9 +58,7 @@ var B = (function (_super) { function B() { _super.apply(this, arguments); } - B.prototype.bar = function () { - return ''; - }; + B.prototype.bar = function () { return ''; }; return B; })(A); var Foo = (function () { diff --git a/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.js b/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.js index 3a6280b15ba..6260493dea0 100644 --- a/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.js +++ b/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.js @@ -113,15 +113,9 @@ function f9(x) { } var C = (function () { function C() { } - C.prototype.toString = function () { - return null; - }; - C.prototype.charAt = function (pos) { - return null; - }; - C.prototype.charCodeAt = function (index) { - return null; - }; + C.prototype.toString = function () { return null; }; + C.prototype.charAt = function (pos) { return null; }; + C.prototype.charCodeAt = function (index) { return null; }; C.prototype.concat = function () { var strings = []; for (var _i = 0; _i < arguments.length; _i++) { @@ -129,51 +123,21 @@ var C = (function () { } return null; }; - C.prototype.indexOf = function (searchString, position) { - return null; - }; - C.prototype.lastIndexOf = function (searchString, position) { - return null; - }; - C.prototype.localeCompare = function (that) { - return null; - }; - C.prototype.match = function (regexp) { - return null; - }; - C.prototype.replace = function (searchValue, replaceValue) { - return null; - }; - C.prototype.search = function (regexp) { - return null; - }; - C.prototype.slice = function (start, end) { - return null; - }; - C.prototype.split = function (separator, limit) { - return null; - }; - C.prototype.substring = function (start, end) { - return null; - }; - C.prototype.toLowerCase = function () { - return null; - }; - C.prototype.toLocaleLowerCase = function () { - return null; - }; - C.prototype.toUpperCase = function () { - return null; - }; - C.prototype.toLocaleUpperCase = function () { - return null; - }; - C.prototype.trim = function () { - return null; - }; - C.prototype.substr = function (from, length) { - return null; - }; + C.prototype.indexOf = function (searchString, position) { return null; }; + C.prototype.lastIndexOf = function (searchString, position) { return null; }; + C.prototype.localeCompare = function (that) { return null; }; + C.prototype.match = function (regexp) { return null; }; + C.prototype.replace = function (searchValue, replaceValue) { return null; }; + C.prototype.search = function (regexp) { return null; }; + C.prototype.slice = function (start, end) { return null; }; + C.prototype.split = function (separator, limit) { return null; }; + C.prototype.substring = function (start, end) { return null; }; + C.prototype.toLowerCase = function () { return null; }; + C.prototype.toLocaleLowerCase = function () { return null; }; + C.prototype.toUpperCase = function () { return null; }; + C.prototype.toLocaleUpperCase = function () { return null; }; + C.prototype.trim = function () { return null; }; + C.prototype.substr = function (from, length) { return null; }; return C; })(); function f10(x) { } diff --git a/tests/baselines/reference/subtypesOfTypeParameter.js b/tests/baselines/reference/subtypesOfTypeParameter.js index 5a5a02733ba..7d739132a77 100644 --- a/tests/baselines/reference/subtypesOfTypeParameter.js +++ b/tests/baselines/reference/subtypesOfTypeParameter.js @@ -178,12 +178,8 @@ function f2(x, y) { var r6 = true ? x : { foo: 1 }; var r7 = true ? function () { } : x; var r7 = true ? x : function () { }; - var r8 = true ? function (x) { - return x; - } : x; - var r8b = true ? x : function (x) { - return x; - }; // type parameters not identical across declarations + var r8 = true ? function (x) { return x; } : x; + var r8b = true ? x : function (x) { return x; }; // type parameters not identical across declarations var i1; var r9 = true ? i1 : x; var r9 = true ? x : i1; diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.js b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.js index 0687a434ae6..df4511fb7ad 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.js @@ -249,12 +249,8 @@ function f11(x) { var r7 = true ? x : function () { }; // ok } function f12(x) { - var r8 = true ? function (x) { - return x; - } : x; // ok - var r8b = true ? x : function (x) { - return x; - }; // ok, type parameters not identical across declarations + var r8 = true ? function (x) { return x; } : x; // ok + var r8b = true ? x : function (x) { return x; }; // ok, type parameters not identical across declarations } function f13(x) { var i1; diff --git a/tests/baselines/reference/superCallInNonStaticMethod.js b/tests/baselines/reference/superCallInNonStaticMethod.js index cf29ac3b1a4..7ef1ce1c62a 100644 --- a/tests/baselines/reference/superCallInNonStaticMethod.js +++ b/tests/baselines/reference/superCallInNonStaticMethod.js @@ -70,9 +70,7 @@ var Other = (function (_super) { var _this = this; _super.call(this); this.propertyInitializer = _super.prototype.instanceMethod.call(this); - this.functionProperty = function () { - _super.prototype.instanceMethod.call(_this); - }; + this.functionProperty = function () { _super.prototype.instanceMethod.call(_this); }; _super.prototype.instanceMethod.call(this); } // in instance method diff --git a/tests/baselines/reference/superErrors.js b/tests/baselines/reference/superErrors.js index 418aeed61ed..ce49da10687 100644 --- a/tests/baselines/reference/superErrors.js +++ b/tests/baselines/reference/superErrors.js @@ -87,9 +87,7 @@ var RegisteredUser = (function (_super) { var x = function () { return super.sayHello.call(this); }; } // super call in a lambda in a function expression in a constructor - (function () { - return function () { return super.; }; - })(); + (function () { return function () { return super.; }; })(); } RegisteredUser.prototype.sayHello = function () { // super call in a method @@ -99,9 +97,7 @@ var RegisteredUser = (function (_super) { var x = function () { return super.sayHello.call(this); }; } // super call in a lambda in a function expression in a constructor - (function () { - return function () { return super.; }; - })(); + (function () { return function () { return super.; }; })(); }; RegisteredUser.staticFunction = function () { var _this = this; diff --git a/tests/baselines/reference/superPropertyAccess.js b/tests/baselines/reference/superPropertyAccess.js index 13dfe1ee3a7..a5419aaf36e 100644 --- a/tests/baselines/reference/superPropertyAccess.js +++ b/tests/baselines/reference/superPropertyAccess.js @@ -49,14 +49,10 @@ var MyBase = (function () { this.d1 = 42; this.d2 = 42; } - MyBase.prototype.m1 = function (a) { - return a; - }; + MyBase.prototype.m1 = function (a) { return a; }; MyBase.prototype.p1 = function () { }; Object.defineProperty(MyBase.prototype, "value", { - get: function () { - return 0; - }, + get: function () { return 0; }, set: function (v) { }, enumerable: true, configurable: true @@ -76,9 +72,7 @@ var MyDerived = (function (_super) { _super.prototype.p1.call(this); // Should error, private not public instance member function var l1 = _super.prototype.d1; // Should error, instance data property not a public instance member function var l1 = _super.prototype.d2; // Should error, instance data property not a public instance member function - _super.prototype.m1 = function (a) { - return ""; - }; // Should be allowed, we will not restrict assignment + _super.prototype.m1 = function (a) { return ""; }; // Should be allowed, we will not restrict assignment _super.prototype.value = 0; // Should error, instance data property not a public instance member function var z = _super.prototype.value; // Should error, instance data property not a public instance member function }; diff --git a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js index 48ae609cdc6..7fd55d221ab 100644 --- a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js +++ b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js @@ -52,9 +52,7 @@ var ObjectLiteral; var F = (function () { function F() { } - F.prototype.test = function () { - return ""; - }; + F.prototype.test = function () { return ""; }; return F; })(); var SuperObjectTest = (function (_super) { diff --git a/tests/baselines/reference/symbolDeclarationEmit1.js b/tests/baselines/reference/symbolDeclarationEmit1.js new file mode 100644 index 00000000000..16d208db5eb --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit1.js @@ -0,0 +1,17 @@ +//// [symbolDeclarationEmit1.ts] +class C { + [Symbol.isRegExp]: number; +} + +//// [symbolDeclarationEmit1.js] +var C = (function () { + function C() { + } + return C; +})(); + + +//// [symbolDeclarationEmit1.d.ts] +declare class C { + [Symbol.isRegExp]: number; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit1.types b/tests/baselines/reference/symbolDeclarationEmit1.types new file mode 100644 index 00000000000..e35bbfe8861 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit1.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit1.ts === +class C { +>C : C + + [Symbol.isRegExp]: number; +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit10.js b/tests/baselines/reference/symbolDeclarationEmit10.js new file mode 100644 index 00000000000..0c46d8750e9 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit10.js @@ -0,0 +1,17 @@ +//// [symbolDeclarationEmit10.ts] +var obj = { + get [Symbol.isConcatSpreadable]() { return '' }, + set [Symbol.isConcatSpreadable](x) { } +} + +//// [symbolDeclarationEmit10.js] +var obj = { + get [Symbol.isConcatSpreadable]() { return ''; }, + set [Symbol.isConcatSpreadable](x) { } +}; + + +//// [symbolDeclarationEmit10.d.ts] +declare var obj: { + [Symbol.isConcatSpreadable]: string; +}; diff --git a/tests/baselines/reference/symbolDeclarationEmit10.types b/tests/baselines/reference/symbolDeclarationEmit10.types new file mode 100644 index 00000000000..194893ef00f --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit10.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit10.ts === +var obj = { +>obj : { [Symbol.isConcatSpreadable]: string; } +>{ get [Symbol.isConcatSpreadable]() { return '' }, set [Symbol.isConcatSpreadable](x) { }} : { [Symbol.isConcatSpreadable]: string; } + + get [Symbol.isConcatSpreadable]() { return '' }, +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol + + set [Symbol.isConcatSpreadable](x) { } +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +>x : string +} diff --git a/tests/baselines/reference/symbolDeclarationEmit11.js b/tests/baselines/reference/symbolDeclarationEmit11.js new file mode 100644 index 00000000000..e5822104bf8 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit11.js @@ -0,0 +1,30 @@ +//// [symbolDeclarationEmit11.ts] +class C { + static [Symbol.iterator] = 0; + static [Symbol.toPrimitive]() { } + static get [Symbol.isRegExp]() { return ""; } + static set [Symbol.isRegExp](x) { } +} + +//// [symbolDeclarationEmit11.js] +var C = (function () { + function C() { + } + C[Symbol.toPrimitive] = function () { }; + Object.defineProperty(C, Symbol.isRegExp, { + get: function () { return ""; }, + set: function (x) { }, + enumerable: true, + configurable: true + }); + C[Symbol.iterator] = 0; + return C; +})(); + + +//// [symbolDeclarationEmit11.d.ts] +declare class C { + static [Symbol.iterator]: number; + static [Symbol.toPrimitive](): void; + static [Symbol.isRegExp]: string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit11.types b/tests/baselines/reference/symbolDeclarationEmit11.types new file mode 100644 index 00000000000..1bf58f205d1 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit11.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit11.ts === +class C { +>C : C + + static [Symbol.iterator] = 0; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + static [Symbol.toPrimitive]() { } +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol + + static get [Symbol.isRegExp]() { return ""; } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + static set [Symbol.isRegExp](x) { } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +>x : string +} diff --git a/tests/baselines/reference/symbolDeclarationEmit12.errors.txt b/tests/baselines/reference/symbolDeclarationEmit12.errors.txt new file mode 100644 index 00000000000..0e2f6b828f6 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit12.errors.txt @@ -0,0 +1,27 @@ +tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts(4,28): error TS4031: Public property '[Symbol.iterator]' of exported class has or is using private name 'I'. +tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts(5,33): error TS4073: Parameter 'x' of public method from exported class has or is using private name 'I'. +tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts(6,40): error TS4055: Return type of public method from exported class has or is using private name 'I'. +tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts(10,34): error TS4037: Parameter '[Symbol.isRegExp]' of public property setter from exported class has or is using private name 'I'. + + +==== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts (4 errors) ==== + module M { + interface I { } + export class C { + [Symbol.iterator]: I; + ~ +!!! error TS4031: Public property '[Symbol.iterator]' of exported class has or is using private name 'I'. + [Symbol.toPrimitive](x: I) { } + ~ +!!! error TS4073: Parameter 'x' of public method from exported class has or is using private name 'I'. + [Symbol.isConcatSpreadable](): I { + ~ +!!! error TS4055: Return type of public method from exported class has or is using private name 'I'. + return undefined + } + get [Symbol.isRegExp]() { return undefined; } + set [Symbol.isRegExp](x: I) { } + ~ +!!! error TS4037: Parameter '[Symbol.isRegExp]' of public property setter from exported class has or is using private name 'I'. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolDeclarationEmit12.js b/tests/baselines/reference/symbolDeclarationEmit12.js new file mode 100644 index 00000000000..68a256bd39d --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit12.js @@ -0,0 +1,34 @@ +//// [symbolDeclarationEmit12.ts] +module M { + interface I { } + export class C { + [Symbol.iterator]: I; + [Symbol.toPrimitive](x: I) { } + [Symbol.isConcatSpreadable](): I { + return undefined + } + get [Symbol.isRegExp]() { return undefined; } + set [Symbol.isRegExp](x: I) { } + } +} + +//// [symbolDeclarationEmit12.js] +var M; +(function (M) { + var C = (function () { + function C() { + } + C.prototype[Symbol.toPrimitive] = function (x) { }; + C.prototype[Symbol.isConcatSpreadable] = function () { + return undefined; + }; + Object.defineProperty(C.prototype, Symbol.isRegExp, { + get: function () { return undefined; }, + set: function (x) { }, + enumerable: true, + configurable: true + }); + return C; + })(); + M.C = C; +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolDeclarationEmit13.js b/tests/baselines/reference/symbolDeclarationEmit13.js new file mode 100644 index 00000000000..acf470ffce1 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit13.js @@ -0,0 +1,29 @@ +//// [symbolDeclarationEmit13.ts] +class C { + get [Symbol.isRegExp]() { return ""; } + set [Symbol.toStringTag](x) { } +} + +//// [symbolDeclarationEmit13.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.isRegExp, { + get: function () { return ""; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, Symbol.toStringTag, { + set: function (x) { }, + enumerable: true, + configurable: true + }); + return C; +})(); + + +//// [symbolDeclarationEmit13.d.ts] +declare class C { + [Symbol.isRegExp]: string; + [Symbol.toStringTag]: any; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit13.types b/tests/baselines/reference/symbolDeclarationEmit13.types new file mode 100644 index 00000000000..6579e49c426 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit13.types @@ -0,0 +1,15 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit13.ts === +class C { +>C : C + + get [Symbol.isRegExp]() { return ""; } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + set [Symbol.toStringTag](x) { } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +>x : any +} diff --git a/tests/baselines/reference/symbolDeclarationEmit14.js b/tests/baselines/reference/symbolDeclarationEmit14.js new file mode 100644 index 00000000000..64330c6ce92 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit14.js @@ -0,0 +1,29 @@ +//// [symbolDeclarationEmit14.ts] +class C { + get [Symbol.isRegExp]() { return ""; } + get [Symbol.toStringTag]() { return ""; } +} + +//// [symbolDeclarationEmit14.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.isRegExp, { + get: function () { return ""; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, Symbol.toStringTag, { + get: function () { return ""; }, + enumerable: true, + configurable: true + }); + return C; +})(); + + +//// [symbolDeclarationEmit14.d.ts] +declare class C { + [Symbol.isRegExp]: string; + [Symbol.toStringTag]: string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit14.types b/tests/baselines/reference/symbolDeclarationEmit14.types new file mode 100644 index 00000000000..f3e7c32047c --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit14.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit14.ts === +class C { +>C : C + + get [Symbol.isRegExp]() { return ""; } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + get [Symbol.toStringTag]() { return ""; } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit2.js b/tests/baselines/reference/symbolDeclarationEmit2.js new file mode 100644 index 00000000000..2112f9e7748 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit2.js @@ -0,0 +1,18 @@ +//// [symbolDeclarationEmit2.ts] +class C { + [Symbol.isRegExp] = ""; +} + +//// [symbolDeclarationEmit2.js] +var C = (function () { + function C() { + this[Symbol.isRegExp] = ""; + } + return C; +})(); + + +//// [symbolDeclarationEmit2.d.ts] +declare class C { + [Symbol.isRegExp]: string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit2.types b/tests/baselines/reference/symbolDeclarationEmit2.types new file mode 100644 index 00000000000..4844b2b8f84 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit2.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit2.ts === +class C { +>C : C + + [Symbol.isRegExp] = ""; +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit3.js b/tests/baselines/reference/symbolDeclarationEmit3.js new file mode 100644 index 00000000000..e3b22d883c8 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit3.js @@ -0,0 +1,21 @@ +//// [symbolDeclarationEmit3.ts] +class C { + [Symbol.isRegExp](x: number); + [Symbol.isRegExp](x: string); + [Symbol.isRegExp](x: any) { } +} + +//// [symbolDeclarationEmit3.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.isRegExp] = function (x) { }; + return C; +})(); + + +//// [symbolDeclarationEmit3.d.ts] +declare class C { + [Symbol.isRegExp](x: number): any; + [Symbol.isRegExp](x: string): any; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit3.types b/tests/baselines/reference/symbolDeclarationEmit3.types new file mode 100644 index 00000000000..0ea55d876b3 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit3.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit3.ts === +class C { +>C : C + + [Symbol.isRegExp](x: number); +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +>x : number + + [Symbol.isRegExp](x: string); +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +>x : string + + [Symbol.isRegExp](x: any) { } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +>x : any +} diff --git a/tests/baselines/reference/symbolDeclarationEmit4.js b/tests/baselines/reference/symbolDeclarationEmit4.js new file mode 100644 index 00000000000..cfe3a14122d --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit4.js @@ -0,0 +1,24 @@ +//// [symbolDeclarationEmit4.ts] +class C { + get [Symbol.isRegExp]() { return ""; } + set [Symbol.isRegExp](x) { } +} + +//// [symbolDeclarationEmit4.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.isRegExp, { + get: function () { return ""; }, + set: function (x) { }, + enumerable: true, + configurable: true + }); + return C; +})(); + + +//// [symbolDeclarationEmit4.d.ts] +declare class C { + [Symbol.isRegExp]: string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit4.types b/tests/baselines/reference/symbolDeclarationEmit4.types new file mode 100644 index 00000000000..aeb24fc146c --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit4.types @@ -0,0 +1,15 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit4.ts === +class C { +>C : C + + get [Symbol.isRegExp]() { return ""; } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + set [Symbol.isRegExp](x) { } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +>x : string +} diff --git a/tests/baselines/reference/symbolDeclarationEmit5.js b/tests/baselines/reference/symbolDeclarationEmit5.js new file mode 100644 index 00000000000..ba1ef9a137c --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit5.js @@ -0,0 +1,12 @@ +//// [symbolDeclarationEmit5.ts] +interface I { + [Symbol.isConcatSpreadable](): string; +} + +//// [symbolDeclarationEmit5.js] + + +//// [symbolDeclarationEmit5.d.ts] +interface I { + [Symbol.isConcatSpreadable](): string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit5.types b/tests/baselines/reference/symbolDeclarationEmit5.types new file mode 100644 index 00000000000..557483cf636 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit5.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit5.ts === +interface I { +>I : I + + [Symbol.isConcatSpreadable](): string; +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit6.js b/tests/baselines/reference/symbolDeclarationEmit6.js new file mode 100644 index 00000000000..2aac05bb6ea --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit6.js @@ -0,0 +1,12 @@ +//// [symbolDeclarationEmit6.ts] +interface I { + [Symbol.isConcatSpreadable]: string; +} + +//// [symbolDeclarationEmit6.js] + + +//// [symbolDeclarationEmit6.d.ts] +interface I { + [Symbol.isConcatSpreadable]: string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit6.types b/tests/baselines/reference/symbolDeclarationEmit6.types new file mode 100644 index 00000000000..714467aba12 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit6.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit6.ts === +interface I { +>I : I + + [Symbol.isConcatSpreadable]: string; +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit7.js b/tests/baselines/reference/symbolDeclarationEmit7.js new file mode 100644 index 00000000000..c53c2110d11 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit7.js @@ -0,0 +1,13 @@ +//// [symbolDeclarationEmit7.ts] +var obj: { + [Symbol.isConcatSpreadable]: string; +} + +//// [symbolDeclarationEmit7.js] +var obj; + + +//// [symbolDeclarationEmit7.d.ts] +declare var obj: { + [Symbol.isConcatSpreadable]: string; +}; diff --git a/tests/baselines/reference/symbolDeclarationEmit7.types b/tests/baselines/reference/symbolDeclarationEmit7.types new file mode 100644 index 00000000000..dff109e8127 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit7.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit7.ts === +var obj: { +>obj : { [Symbol.isConcatSpreadable]: string; } + + [Symbol.isConcatSpreadable]: string; +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit8.js b/tests/baselines/reference/symbolDeclarationEmit8.js new file mode 100644 index 00000000000..428d0a0d60c --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit8.js @@ -0,0 +1,15 @@ +//// [symbolDeclarationEmit8.ts] +var obj = { + [Symbol.isConcatSpreadable]: 0 +} + +//// [symbolDeclarationEmit8.js] +var obj = { + [Symbol.isConcatSpreadable]: 0 +}; + + +//// [symbolDeclarationEmit8.d.ts] +declare var obj: { + [Symbol.isConcatSpreadable]: number; +}; diff --git a/tests/baselines/reference/symbolDeclarationEmit8.types b/tests/baselines/reference/symbolDeclarationEmit8.types new file mode 100644 index 00000000000..75d39748e22 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit8.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit8.ts === +var obj = { +>obj : { [Symbol.isConcatSpreadable]: number; } +>{ [Symbol.isConcatSpreadable]: 0} : { [Symbol.isConcatSpreadable]: number; } + + [Symbol.isConcatSpreadable]: 0 +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit9.js b/tests/baselines/reference/symbolDeclarationEmit9.js new file mode 100644 index 00000000000..d38171767a5 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit9.js @@ -0,0 +1,15 @@ +//// [symbolDeclarationEmit9.ts] +var obj = { + [Symbol.isConcatSpreadable]() { } +} + +//// [symbolDeclarationEmit9.js] +var obj = { + [Symbol.isConcatSpreadable]() { } +}; + + +//// [symbolDeclarationEmit9.d.ts] +declare var obj: { + [Symbol.isConcatSpreadable](): void; +}; diff --git a/tests/baselines/reference/symbolDeclarationEmit9.types b/tests/baselines/reference/symbolDeclarationEmit9.types new file mode 100644 index 00000000000..a7a6b459fcc --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit9.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit9.ts === +var obj = { +>obj : { [Symbol.isConcatSpreadable](): void; } +>{ [Symbol.isConcatSpreadable]() { }} : { [Symbol.isConcatSpreadable](): void; } + + [Symbol.isConcatSpreadable]() { } +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +} diff --git a/tests/baselines/reference/symbolProperty1.js b/tests/baselines/reference/symbolProperty1.js new file mode 100644 index 00000000000..0117dd3b1c2 --- /dev/null +++ b/tests/baselines/reference/symbolProperty1.js @@ -0,0 +1,19 @@ +//// [symbolProperty1.ts] +var s: symbol; +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} + +//// [symbolProperty1.js] +var s; +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +}; diff --git a/tests/baselines/reference/symbolProperty1.types b/tests/baselines/reference/symbolProperty1.types new file mode 100644 index 00000000000..55c86c14f6e --- /dev/null +++ b/tests/baselines/reference/symbolProperty1.types @@ -0,0 +1,20 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty1.ts === +var s: symbol; +>s : symbol + +var x = { +>x : {} +>{ [s]: 0, [s]() { }, get [s]() { return 0; }} : {} + + [s]: 0, +>s : symbol + + [s]() { }, +>s : symbol + + get [s]() { +>s : symbol + + return 0; + } +} diff --git a/tests/baselines/reference/symbolProperty10.errors.txt b/tests/baselines/reference/symbolProperty10.errors.txt new file mode 100644 index 00000000000..513d5792c5e --- /dev/null +++ b/tests/baselines/reference/symbolProperty10.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/es6/Symbols/symbolProperty10.ts(10,5): error TS2322: Type 'I' is not assignable to type 'C'. + Types of property '[Symbol.iterator]' are incompatible. + Type '{ x: any; }' is not assignable to type '{ x: any; y: any; }'. + Property 'y' is missing in type '{ x: any; }'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty10.ts (1 errors) ==== + class C { + [Symbol.iterator]: { x; y }; + } + interface I { + [Symbol.iterator]?: { x }; + } + + var i: I; + i = new C; + var c: C = i; + ~ +!!! error TS2322: Type 'I' is not assignable to type 'C'. +!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. +!!! error TS2322: Type '{ x: any; }' is not assignable to type '{ x: any; y: any; }'. +!!! error TS2322: Property 'y' is missing in type '{ x: any; }'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty10.js b/tests/baselines/reference/symbolProperty10.js new file mode 100644 index 00000000000..5b4e44f11ab --- /dev/null +++ b/tests/baselines/reference/symbolProperty10.js @@ -0,0 +1,21 @@ +//// [symbolProperty10.ts] +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]?: { x }; +} + +var i: I; +i = new C; +var c: C = i; + +//// [symbolProperty10.js] +var C = (function () { + function C() { + } + return C; +})(); +var i; +i = new C; +var c = i; diff --git a/tests/baselines/reference/symbolProperty11.js b/tests/baselines/reference/symbolProperty11.js new file mode 100644 index 00000000000..83a380c79e7 --- /dev/null +++ b/tests/baselines/reference/symbolProperty11.js @@ -0,0 +1,19 @@ +//// [symbolProperty11.ts] +class C { } +interface I { + [Symbol.iterator]?: { x }; +} + +var i: I; +i = new C; +var c: C = i; + +//// [symbolProperty11.js] +var C = (function () { + function C() { + } + return C; +})(); +var i; +i = new C; +var c = i; diff --git a/tests/baselines/reference/symbolProperty11.types b/tests/baselines/reference/symbolProperty11.types new file mode 100644 index 00000000000..109bd969d55 --- /dev/null +++ b/tests/baselines/reference/symbolProperty11.types @@ -0,0 +1,29 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty11.ts === +class C { } +>C : C + +interface I { +>I : I + + [Symbol.iterator]?: { x }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +} + +var i: I; +>i : I +>I : I + +i = new C; +>i = new C : C +>i : I +>new C : C +>C : typeof C + +var c: C = i; +>c : C +>C : C +>i : I + diff --git a/tests/baselines/reference/symbolProperty12.errors.txt b/tests/baselines/reference/symbolProperty12.errors.txt new file mode 100644 index 00000000000..5ec8d645203 --- /dev/null +++ b/tests/baselines/reference/symbolProperty12.errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/es6/Symbols/symbolProperty12.ts(9,1): error TS2322: Type 'C' is not assignable to type 'I'. + Property '[Symbol.iterator]' is private in type 'C' but not in type 'I'. +tests/cases/conformance/es6/Symbols/symbolProperty12.ts(10,5): error TS2322: Type 'I' is not assignable to type 'C'. + Property '[Symbol.iterator]' is private in type 'C' but not in type 'I'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty12.ts (2 errors) ==== + class C { + private [Symbol.iterator]: { x }; + } + interface I { + [Symbol.iterator]: { x }; + } + + var i: I; + i = new C; + ~ +!!! error TS2322: Type 'C' is not assignable to type 'I'. +!!! error TS2322: Property '[Symbol.iterator]' is private in type 'C' but not in type 'I'. + var c: C = i; + ~ +!!! error TS2322: Type 'I' is not assignable to type 'C'. +!!! error TS2322: Property '[Symbol.iterator]' is private in type 'C' but not in type 'I'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty12.js b/tests/baselines/reference/symbolProperty12.js new file mode 100644 index 00000000000..9f63f86bc18 --- /dev/null +++ b/tests/baselines/reference/symbolProperty12.js @@ -0,0 +1,21 @@ +//// [symbolProperty12.ts] +class C { + private [Symbol.iterator]: { x }; +} +interface I { + [Symbol.iterator]: { x }; +} + +var i: I; +i = new C; +var c: C = i; + +//// [symbolProperty12.js] +var C = (function () { + function C() { + } + return C; +})(); +var i; +i = new C; +var c = i; diff --git a/tests/baselines/reference/symbolProperty13.js b/tests/baselines/reference/symbolProperty13.js new file mode 100644 index 00000000000..1cf24a49c7e --- /dev/null +++ b/tests/baselines/reference/symbolProperty13.js @@ -0,0 +1,27 @@ +//// [symbolProperty13.ts] +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); + +//// [symbolProperty13.js] +var C = (function () { + function C() { + } + return C; +})(); +foo(new C); +var i; +bar(i); diff --git a/tests/baselines/reference/symbolProperty13.types b/tests/baselines/reference/symbolProperty13.types new file mode 100644 index 00000000000..1e890a91085 --- /dev/null +++ b/tests/baselines/reference/symbolProperty13.types @@ -0,0 +1,56 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty13.ts === +class C { +>C : C + + [Symbol.iterator]: { x; y }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +>y : any +} +interface I { +>I : I + + [Symbol.iterator]: { x }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +} + +declare function foo(i: I): I; +>foo : { (i: I): I; (a: any): any; } +>i : I +>I : I +>I : I + +declare function foo(a: any): any; +>foo : { (i: I): I; (a: any): any; } +>a : any + +declare function bar(i: C): C; +>bar : { (i: C): C; (a: any): any; } +>i : C +>C : C +>C : C + +declare function bar(a: any): any; +>bar : { (i: C): C; (a: any): any; } +>a : any + +foo(new C); +>foo(new C) : I +>foo : { (i: I): I; (a: any): any; } +>new C : C +>C : typeof C + +var i: I; +>i : I +>I : I + +bar(i); +>bar(i) : any +>bar : { (i: C): C; (a: any): any; } +>i : I + diff --git a/tests/baselines/reference/symbolProperty14.js b/tests/baselines/reference/symbolProperty14.js new file mode 100644 index 00000000000..0283cb01b79 --- /dev/null +++ b/tests/baselines/reference/symbolProperty14.js @@ -0,0 +1,27 @@ +//// [symbolProperty14.ts] +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]?: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); + +//// [symbolProperty14.js] +var C = (function () { + function C() { + } + return C; +})(); +foo(new C); +var i; +bar(i); diff --git a/tests/baselines/reference/symbolProperty14.types b/tests/baselines/reference/symbolProperty14.types new file mode 100644 index 00000000000..5e5469ad915 --- /dev/null +++ b/tests/baselines/reference/symbolProperty14.types @@ -0,0 +1,56 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty14.ts === +class C { +>C : C + + [Symbol.iterator]: { x; y }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +>y : any +} +interface I { +>I : I + + [Symbol.iterator]?: { x }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +} + +declare function foo(i: I): I; +>foo : { (i: I): I; (a: any): any; } +>i : I +>I : I +>I : I + +declare function foo(a: any): any; +>foo : { (i: I): I; (a: any): any; } +>a : any + +declare function bar(i: C): C; +>bar : { (i: C): C; (a: any): any; } +>i : C +>C : C +>C : C + +declare function bar(a: any): any; +>bar : { (i: C): C; (a: any): any; } +>a : any + +foo(new C); +>foo(new C) : I +>foo : { (i: I): I; (a: any): any; } +>new C : C +>C : typeof C + +var i: I; +>i : I +>I : I + +bar(i); +>bar(i) : any +>bar : { (i: C): C; (a: any): any; } +>i : I + diff --git a/tests/baselines/reference/symbolProperty15.js b/tests/baselines/reference/symbolProperty15.js new file mode 100644 index 00000000000..0c198037093 --- /dev/null +++ b/tests/baselines/reference/symbolProperty15.js @@ -0,0 +1,25 @@ +//// [symbolProperty15.ts] +class C { } +interface I { + [Symbol.iterator]?: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); + +//// [symbolProperty15.js] +var C = (function () { + function C() { + } + return C; +})(); +foo(new C); +var i; +bar(i); diff --git a/tests/baselines/reference/symbolProperty15.types b/tests/baselines/reference/symbolProperty15.types new file mode 100644 index 00000000000..b2baa3fccee --- /dev/null +++ b/tests/baselines/reference/symbolProperty15.types @@ -0,0 +1,49 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty15.ts === +class C { } +>C : C + +interface I { +>I : I + + [Symbol.iterator]?: { x }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +} + +declare function foo(i: I): I; +>foo : { (i: I): I; (a: any): any; } +>i : I +>I : I +>I : I + +declare function foo(a: any): any; +>foo : { (i: I): I; (a: any): any; } +>a : any + +declare function bar(i: C): C; +>bar : { (i: C): C; (a: any): any; } +>i : C +>C : C +>C : C + +declare function bar(a: any): any; +>bar : { (i: C): C; (a: any): any; } +>a : any + +foo(new C); +>foo(new C) : any +>foo : { (i: I): I; (a: any): any; } +>new C : C +>C : typeof C + +var i: I; +>i : I +>I : I + +bar(i); +>bar(i) : C +>bar : { (i: C): C; (a: any): any; } +>i : I + diff --git a/tests/baselines/reference/symbolProperty16.js b/tests/baselines/reference/symbolProperty16.js new file mode 100644 index 00000000000..1a1f3f857af --- /dev/null +++ b/tests/baselines/reference/symbolProperty16.js @@ -0,0 +1,27 @@ +//// [symbolProperty16.ts] +class C { + private [Symbol.iterator]: { x }; +} +interface I { + [Symbol.iterator]: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); + +//// [symbolProperty16.js] +var C = (function () { + function C() { + } + return C; +})(); +foo(new C); +var i; +bar(i); diff --git a/tests/baselines/reference/symbolProperty16.types b/tests/baselines/reference/symbolProperty16.types new file mode 100644 index 00000000000..041770aea04 --- /dev/null +++ b/tests/baselines/reference/symbolProperty16.types @@ -0,0 +1,55 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty16.ts === +class C { +>C : C + + private [Symbol.iterator]: { x }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +} +interface I { +>I : I + + [Symbol.iterator]: { x }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any +} + +declare function foo(i: I): I; +>foo : { (i: I): I; (a: any): any; } +>i : I +>I : I +>I : I + +declare function foo(a: any): any; +>foo : { (i: I): I; (a: any): any; } +>a : any + +declare function bar(i: C): C; +>bar : { (i: C): C; (a: any): any; } +>i : C +>C : C +>C : C + +declare function bar(a: any): any; +>bar : { (i: C): C; (a: any): any; } +>a : any + +foo(new C); +>foo(new C) : any +>foo : { (i: I): I; (a: any): any; } +>new C : C +>C : typeof C + +var i: I; +>i : I +>I : I + +bar(i); +>bar(i) : any +>bar : { (i: C): C; (a: any): any; } +>i : I + diff --git a/tests/baselines/reference/symbolProperty17.errors.txt b/tests/baselines/reference/symbolProperty17.errors.txt new file mode 100644 index 00000000000..51f77646f0d --- /dev/null +++ b/tests/baselines/reference/symbolProperty17.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty17.ts(3,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty17.ts (1 errors) ==== + interface I { + [Symbol.iterator]: number; + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + "__@iterator": string; + } + + var i: I; + var it = i[Symbol.iterator]; \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty17.js b/tests/baselines/reference/symbolProperty17.js new file mode 100644 index 00000000000..549577c8d6c --- /dev/null +++ b/tests/baselines/reference/symbolProperty17.js @@ -0,0 +1,13 @@ +//// [symbolProperty17.ts] +interface I { + [Symbol.iterator]: number; + [s: symbol]: string; + "__@iterator": string; +} + +var i: I; +var it = i[Symbol.iterator]; + +//// [symbolProperty17.js] +var i; +var it = i[Symbol.iterator]; diff --git a/tests/baselines/reference/symbolProperty18.js b/tests/baselines/reference/symbolProperty18.js new file mode 100644 index 00000000000..1d0a57e7b50 --- /dev/null +++ b/tests/baselines/reference/symbolProperty18.js @@ -0,0 +1,20 @@ +//// [symbolProperty18.ts] +var i = { + [Symbol.iterator]: 0, + [Symbol.toStringTag]() { return "" }, + set [Symbol.toPrimitive](p: boolean) { } +} + +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); +i[Symbol.toPrimitive] = false; + +//// [symbolProperty18.js] +var i = { + [Symbol.iterator]: 0, + [Symbol.toStringTag]() { return ""; }, + set [Symbol.toPrimitive](p) { } +}; +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); +i[Symbol.toPrimitive] = false; diff --git a/tests/baselines/reference/symbolProperty18.types b/tests/baselines/reference/symbolProperty18.types new file mode 100644 index 00000000000..8dd74112a8d --- /dev/null +++ b/tests/baselines/reference/symbolProperty18.types @@ -0,0 +1,47 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty18.ts === +var i = { +>i : { [Symbol.iterator]: number; [Symbol.toStringTag](): string; [Symbol.toPrimitive]: boolean; } +>{ [Symbol.iterator]: 0, [Symbol.toStringTag]() { return "" }, set [Symbol.toPrimitive](p: boolean) { }} : { [Symbol.iterator]: number; [Symbol.toStringTag](): string; [Symbol.toPrimitive]: boolean; } + + [Symbol.iterator]: 0, +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + [Symbol.toStringTag]() { return "" }, +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + set [Symbol.toPrimitive](p: boolean) { } +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol +>p : boolean +} + +var it = i[Symbol.iterator]; +>it : number +>i[Symbol.iterator] : number +>i : { [Symbol.iterator]: number; [Symbol.toStringTag](): string; [Symbol.toPrimitive]: boolean; } +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +var str = i[Symbol.toStringTag](); +>str : string +>i[Symbol.toStringTag]() : string +>i[Symbol.toStringTag] : () => string +>i : { [Symbol.iterator]: number; [Symbol.toStringTag](): string; [Symbol.toPrimitive]: boolean; } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + +i[Symbol.toPrimitive] = false; +>i[Symbol.toPrimitive] = false : boolean +>i[Symbol.toPrimitive] : boolean +>i : { [Symbol.iterator]: number; [Symbol.toStringTag](): string; [Symbol.toPrimitive]: boolean; } +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol + diff --git a/tests/baselines/reference/symbolProperty19.js b/tests/baselines/reference/symbolProperty19.js new file mode 100644 index 00000000000..5ec7968218a --- /dev/null +++ b/tests/baselines/reference/symbolProperty19.js @@ -0,0 +1,16 @@ +//// [symbolProperty19.ts] +var i = { + [Symbol.iterator]: { p: null }, + [Symbol.toStringTag]() { return { p: undefined }; } +} + +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); + +//// [symbolProperty19.js] +var i = { + [Symbol.iterator]: { p: null }, + [Symbol.toStringTag]() { return { p: undefined }; } +}; +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); diff --git a/tests/baselines/reference/symbolProperty19.types b/tests/baselines/reference/symbolProperty19.types new file mode 100644 index 00000000000..705c2b8bdf7 --- /dev/null +++ b/tests/baselines/reference/symbolProperty19.types @@ -0,0 +1,38 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty19.ts === +var i = { +>i : { [Symbol.iterator]: { p: any; }; [Symbol.toStringTag](): { p: any; }; } +>{ [Symbol.iterator]: { p: null }, [Symbol.toStringTag]() { return { p: undefined }; }} : { [Symbol.iterator]: { p: null; }; [Symbol.toStringTag](): { p: any; }; } + + [Symbol.iterator]: { p: null }, +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>{ p: null } : { p: null; } +>p : null + + [Symbol.toStringTag]() { return { p: undefined }; } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +>{ p: undefined } : { p: undefined; } +>p : undefined +>undefined : undefined +} + +var it = i[Symbol.iterator]; +>it : { p: any; } +>i[Symbol.iterator] : { p: any; } +>i : { [Symbol.iterator]: { p: any; }; [Symbol.toStringTag](): { p: any; }; } +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +var str = i[Symbol.toStringTag](); +>str : { p: any; } +>i[Symbol.toStringTag]() : { p: any; } +>i[Symbol.toStringTag] : () => { p: any; } +>i : { [Symbol.iterator]: { p: any; }; [Symbol.toStringTag](): { p: any; }; } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + diff --git a/tests/baselines/reference/symbolProperty2.js b/tests/baselines/reference/symbolProperty2.js new file mode 100644 index 00000000000..0158366f9d5 --- /dev/null +++ b/tests/baselines/reference/symbolProperty2.js @@ -0,0 +1,19 @@ +//// [symbolProperty2.ts] +var s = Symbol(); +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} + +//// [symbolProperty2.js] +var s = Symbol(); +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +}; diff --git a/tests/baselines/reference/symbolProperty2.types b/tests/baselines/reference/symbolProperty2.types new file mode 100644 index 00000000000..37fe9d13bdb --- /dev/null +++ b/tests/baselines/reference/symbolProperty2.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty2.ts === +var s = Symbol(); +>s : symbol +>Symbol() : symbol +>Symbol : SymbolConstructor + +var x = { +>x : {} +>{ [s]: 0, [s]() { }, get [s]() { return 0; }} : {} + + [s]: 0, +>s : symbol + + [s]() { }, +>s : symbol + + get [s]() { +>s : symbol + + return 0; + } +} diff --git a/tests/baselines/reference/symbolProperty20.js b/tests/baselines/reference/symbolProperty20.js new file mode 100644 index 00000000000..df7516552e0 --- /dev/null +++ b/tests/baselines/reference/symbolProperty20.js @@ -0,0 +1,16 @@ +//// [symbolProperty20.ts] +interface I { + [Symbol.iterator]: (s: string) => string; + [Symbol.toStringTag](s: number): number; +} + +var i: I = { + [Symbol.iterator]: s => s, + [Symbol.toStringTag](n) { return n; } +} + +//// [symbolProperty20.js] +var i = { + [Symbol.iterator]: s => { return s; }, + [Symbol.toStringTag](n) { return n; } +}; diff --git a/tests/baselines/reference/symbolProperty20.types b/tests/baselines/reference/symbolProperty20.types new file mode 100644 index 00000000000..745401142d8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty20.types @@ -0,0 +1,37 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty20.ts === +interface I { +>I : I + + [Symbol.iterator]: (s: string) => string; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>s : string + + [Symbol.toStringTag](s: number): number; +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +>s : number +} + +var i: I = { +>i : I +>I : I +>{ [Symbol.iterator]: s => s, [Symbol.toStringTag](n) { return n; }} : { [Symbol.iterator]: (s: string) => string; [Symbol.toStringTag](n: number): number; } + + [Symbol.iterator]: s => s, +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>s => s : (s: string) => string +>s : string +>s : string + + [Symbol.toStringTag](n) { return n; } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +>n : number +>n : number +} diff --git a/tests/baselines/reference/symbolProperty21.js b/tests/baselines/reference/symbolProperty21.js new file mode 100644 index 00000000000..13eaf06a97b --- /dev/null +++ b/tests/baselines/reference/symbolProperty21.js @@ -0,0 +1,20 @@ +//// [symbolProperty21.ts] +interface I { + [Symbol.unscopables]: T; + [Symbol.isConcatSpreadable]: U; +} + +declare function foo(p: I): { t: T; u: U }; + +foo({ + [Symbol.isConcatSpreadable]: "", + [Symbol.isRegExp]: 0, + [Symbol.unscopables]: true +}); + +//// [symbolProperty21.js] +foo({ + [Symbol.isConcatSpreadable]: "", + [Symbol.isRegExp]: 0, + [Symbol.unscopables]: true +}); diff --git a/tests/baselines/reference/symbolProperty21.types b/tests/baselines/reference/symbolProperty21.types new file mode 100644 index 00000000000..053dae46479 --- /dev/null +++ b/tests/baselines/reference/symbolProperty21.types @@ -0,0 +1,53 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty21.ts === +interface I { +>I : I +>T : T +>U : U + + [Symbol.unscopables]: T; +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol +>T : T + + [Symbol.isConcatSpreadable]: U; +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +>U : U +} + +declare function foo(p: I): { t: T; u: U }; +>foo : (p: I) => { t: T; u: U; } +>T : T +>U : U +>p : I +>I : I +>T : T +>U : U +>t : T +>T : T +>u : U +>U : U + +foo({ +>foo({ [Symbol.isConcatSpreadable]: "", [Symbol.isRegExp]: 0, [Symbol.unscopables]: true}) : { t: boolean; u: string; } +>foo : (p: I) => { t: T; u: U; } +>{ [Symbol.isConcatSpreadable]: "", [Symbol.isRegExp]: 0, [Symbol.unscopables]: true} : { [Symbol.isConcatSpreadable]: string; [Symbol.isRegExp]: number; [Symbol.unscopables]: boolean; } + + [Symbol.isConcatSpreadable]: "", +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol + + [Symbol.isRegExp]: 0, +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + [Symbol.unscopables]: true +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol + +}); diff --git a/tests/baselines/reference/symbolProperty22.js b/tests/baselines/reference/symbolProperty22.js new file mode 100644 index 00000000000..35757182143 --- /dev/null +++ b/tests/baselines/reference/symbolProperty22.js @@ -0,0 +1,11 @@ +//// [symbolProperty22.ts] +interface I { + [Symbol.unscopables](x: T): U; +} + +declare function foo(p1: T, p2: I): U; + +foo("", { [Symbol.unscopables]: s => s.length }); + +//// [symbolProperty22.js] +foo("", { [Symbol.unscopables]: s => { return s.length; } }); diff --git a/tests/baselines/reference/symbolProperty22.types b/tests/baselines/reference/symbolProperty22.types new file mode 100644 index 00000000000..64fb5fc234c --- /dev/null +++ b/tests/baselines/reference/symbolProperty22.types @@ -0,0 +1,40 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty22.ts === +interface I { +>I : I +>T : T +>U : U + + [Symbol.unscopables](x: T): U; +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol +>x : T +>T : T +>U : U +} + +declare function foo(p1: T, p2: I): U; +>foo : (p1: T, p2: I) => U +>T : T +>U : U +>p1 : T +>T : T +>p2 : I +>I : I +>T : T +>U : U +>U : U + +foo("", { [Symbol.unscopables]: s => s.length }); +>foo("", { [Symbol.unscopables]: s => s.length }) : number +>foo : (p1: T, p2: I) => U +>{ [Symbol.unscopables]: s => s.length } : { [Symbol.unscopables]: (s: string) => number; } +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol +>s => s.length : (s: string) => number +>s : string +>s.length : number +>s : string +>length : number + diff --git a/tests/baselines/reference/symbolProperty23.js b/tests/baselines/reference/symbolProperty23.js new file mode 100644 index 00000000000..b3291ad34e8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty23.js @@ -0,0 +1,20 @@ +//// [symbolProperty23.ts] +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toPrimitive]() { + return true; + } +} + +//// [symbolProperty23.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.toPrimitive] = function () { + return true; + }; + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty23.types b/tests/baselines/reference/symbolProperty23.types new file mode 100644 index 00000000000..b28ecb2dbe4 --- /dev/null +++ b/tests/baselines/reference/symbolProperty23.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty23.ts === +interface I { +>I : I + + [Symbol.toPrimitive]: () => boolean; +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol +} + +class C implements I { +>C : C +>I : I + + [Symbol.toPrimitive]() { +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol + + return true; + } +} diff --git a/tests/baselines/reference/symbolProperty24.errors.txt b/tests/baselines/reference/symbolProperty24.errors.txt new file mode 100644 index 00000000000..25cba184e25 --- /dev/null +++ b/tests/baselines/reference/symbolProperty24.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/es6/Symbols/symbolProperty24.ts(5,7): error TS2420: Class 'C' incorrectly implements interface 'I'. + Types of property '[Symbol.toPrimitive]' are incompatible. + Type '() => string' is not assignable to type '() => boolean'. + Type 'string' is not assignable to type 'boolean'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty24.ts (1 errors) ==== + interface I { + [Symbol.toPrimitive]: () => boolean; + } + + class C implements I { + ~ +!!! error TS2420: Class 'C' incorrectly implements interface 'I'. +!!! error TS2420: Types of property '[Symbol.toPrimitive]' are incompatible. +!!! error TS2420: Type '() => string' is not assignable to type '() => boolean'. +!!! error TS2420: Type 'string' is not assignable to type 'boolean'. + [Symbol.toPrimitive]() { + return ""; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty24.js b/tests/baselines/reference/symbolProperty24.js new file mode 100644 index 00000000000..b5d059dd29f --- /dev/null +++ b/tests/baselines/reference/symbolProperty24.js @@ -0,0 +1,20 @@ +//// [symbolProperty24.ts] +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toPrimitive]() { + return ""; + } +} + +//// [symbolProperty24.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.toPrimitive] = function () { + return ""; + }; + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty25.errors.txt b/tests/baselines/reference/symbolProperty25.errors.txt new file mode 100644 index 00000000000..a6cde31c1ad --- /dev/null +++ b/tests/baselines/reference/symbolProperty25.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/Symbols/symbolProperty25.ts(5,7): error TS2420: Class 'C' incorrectly implements interface 'I'. + Property '[Symbol.toPrimitive]' is missing in type 'C'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty25.ts (1 errors) ==== + interface I { + [Symbol.toPrimitive]: () => boolean; + } + + class C implements I { + ~ +!!! error TS2420: Class 'C' incorrectly implements interface 'I'. +!!! error TS2420: Property '[Symbol.toPrimitive]' is missing in type 'C'. + [Symbol.toStringTag]() { + return ""; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty25.js b/tests/baselines/reference/symbolProperty25.js new file mode 100644 index 00000000000..c932da1e3eb --- /dev/null +++ b/tests/baselines/reference/symbolProperty25.js @@ -0,0 +1,20 @@ +//// [symbolProperty25.ts] +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toStringTag]() { + return ""; + } +} + +//// [symbolProperty25.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.toStringTag] = function () { + return ""; + }; + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty26.js b/tests/baselines/reference/symbolProperty26.js new file mode 100644 index 00000000000..9e98027603d --- /dev/null +++ b/tests/baselines/reference/symbolProperty26.js @@ -0,0 +1,38 @@ +//// [symbolProperty26.ts] +class C1 { + [Symbol.toStringTag]() { + return ""; + } +} + +class C2 extends C1 { + [Symbol.toStringTag]() { + return ""; + } +} + +//// [symbolProperty26.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return ""; + }; + return C1; +})(); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + C2.prototype[Symbol.toStringTag] = function () { + return ""; + }; + return C2; +})(C1); diff --git a/tests/baselines/reference/symbolProperty26.types b/tests/baselines/reference/symbolProperty26.types new file mode 100644 index 00000000000..3971ccb402d --- /dev/null +++ b/tests/baselines/reference/symbolProperty26.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty26.ts === +class C1 { +>C1 : C1 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + return ""; + } +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + return ""; + } +} diff --git a/tests/baselines/reference/symbolProperty27.js b/tests/baselines/reference/symbolProperty27.js new file mode 100644 index 00000000000..f19d05233cb --- /dev/null +++ b/tests/baselines/reference/symbolProperty27.js @@ -0,0 +1,38 @@ +//// [symbolProperty27.ts] +class C1 { + [Symbol.toStringTag]() { + return {}; + } +} + +class C2 extends C1 { + [Symbol.toStringTag]() { + return ""; + } +} + +//// [symbolProperty27.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return {}; + }; + return C1; +})(); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + C2.prototype[Symbol.toStringTag] = function () { + return ""; + }; + return C2; +})(C1); diff --git a/tests/baselines/reference/symbolProperty27.types b/tests/baselines/reference/symbolProperty27.types new file mode 100644 index 00000000000..5a5261a11b5 --- /dev/null +++ b/tests/baselines/reference/symbolProperty27.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty27.ts === +class C1 { +>C1 : C1 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + return {}; +>{} : {} + } +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + return ""; + } +} diff --git a/tests/baselines/reference/symbolProperty28.js b/tests/baselines/reference/symbolProperty28.js new file mode 100644 index 00000000000..219a192e381 --- /dev/null +++ b/tests/baselines/reference/symbolProperty28.js @@ -0,0 +1,36 @@ +//// [symbolProperty28.ts] +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} + +class C2 extends C1 { } + +var c: C2; +var obj = c[Symbol.toStringTag]().x; + +//// [symbolProperty28.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + return C2; +})(C1); +var c; +var obj = c[Symbol.toStringTag]().x; diff --git a/tests/baselines/reference/symbolProperty28.types b/tests/baselines/reference/symbolProperty28.types new file mode 100644 index 00000000000..ef5aa0f3003 --- /dev/null +++ b/tests/baselines/reference/symbolProperty28.types @@ -0,0 +1,34 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty28.ts === +class C1 { +>C1 : C1 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + return { x: "" }; +>{ x: "" } : { x: string; } +>x : string + } +} + +class C2 extends C1 { } +>C2 : C2 +>C1 : C1 + +var c: C2; +>c : C2 +>C2 : C2 + +var obj = c[Symbol.toStringTag]().x; +>obj : string +>c[Symbol.toStringTag]().x : string +>c[Symbol.toStringTag]() : { x: string; } +>c[Symbol.toStringTag] : () => { x: string; } +>c : C2 +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +>x : string + diff --git a/tests/baselines/reference/symbolProperty29.errors.txt b/tests/baselines/reference/symbolProperty29.errors.txt new file mode 100644 index 00000000000..1efaeb2b3bf --- /dev/null +++ b/tests/baselines/reference/symbolProperty29.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/es6/Symbols/symbolProperty29.ts(5,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty29.ts (1 errors) ==== + class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: symbol]: () => { x: string }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty29.js b/tests/baselines/reference/symbolProperty29.js new file mode 100644 index 00000000000..f7fee99f6a1 --- /dev/null +++ b/tests/baselines/reference/symbolProperty29.js @@ -0,0 +1,17 @@ +//// [symbolProperty29.ts] +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: symbol]: () => { x: string }; +} + +//// [symbolProperty29.js] +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(); diff --git a/tests/baselines/reference/symbolProperty3.errors.txt b/tests/baselines/reference/symbolProperty3.errors.txt new file mode 100644 index 00000000000..ed557c85a63 --- /dev/null +++ b/tests/baselines/reference/symbolProperty3.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/es6/Symbols/symbolProperty3.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/Symbols/symbolProperty3.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/Symbols/symbolProperty3.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty3.ts (3 errors) ==== + var s = Symbol; + var x = { + [s]: 0, + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [s]() { }, + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + get [s]() { + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty3.js b/tests/baselines/reference/symbolProperty3.js new file mode 100644 index 00000000000..dda9ca23d32 --- /dev/null +++ b/tests/baselines/reference/symbolProperty3.js @@ -0,0 +1,19 @@ +//// [symbolProperty3.ts] +var s = Symbol; +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} + +//// [symbolProperty3.js] +var s = Symbol; +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +}; diff --git a/tests/baselines/reference/symbolProperty30.errors.txt b/tests/baselines/reference/symbolProperty30.errors.txt new file mode 100644 index 00000000000..b839d11d1b8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty30.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/es6/Symbols/symbolProperty30.ts(5,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty30.ts (1 errors) ==== + class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: symbol]: () => { x: number }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty30.js b/tests/baselines/reference/symbolProperty30.js new file mode 100644 index 00000000000..bdb108015cf --- /dev/null +++ b/tests/baselines/reference/symbolProperty30.js @@ -0,0 +1,17 @@ +//// [symbolProperty30.ts] +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: symbol]: () => { x: number }; +} + +//// [symbolProperty30.js] +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(); diff --git a/tests/baselines/reference/symbolProperty31.errors.txt b/tests/baselines/reference/symbolProperty31.errors.txt new file mode 100644 index 00000000000..39735c017b2 --- /dev/null +++ b/tests/baselines/reference/symbolProperty31.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty31.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty31.ts (1 errors) ==== + class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + } + class C2 extends C1 { + [s: symbol]: () => { x: string }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty31.js b/tests/baselines/reference/symbolProperty31.js new file mode 100644 index 00000000000..cf532774652 --- /dev/null +++ b/tests/baselines/reference/symbolProperty31.js @@ -0,0 +1,32 @@ +//// [symbolProperty31.ts] +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 extends C1 { + [s: symbol]: () => { x: string }; +} + +//// [symbolProperty31.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + return C2; +})(C1); diff --git a/tests/baselines/reference/symbolProperty32.errors.txt b/tests/baselines/reference/symbolProperty32.errors.txt new file mode 100644 index 00000000000..4051f8f91c8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty32.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty32.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty32.ts (1 errors) ==== + class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + } + class C2 extends C1 { + [s: symbol]: () => { x: number }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty32.js b/tests/baselines/reference/symbolProperty32.js new file mode 100644 index 00000000000..73e4bffdc01 --- /dev/null +++ b/tests/baselines/reference/symbolProperty32.js @@ -0,0 +1,32 @@ +//// [symbolProperty32.ts] +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 extends C1 { + [s: symbol]: () => { x: number }; +} + +//// [symbolProperty32.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + return C2; +})(C1); diff --git a/tests/baselines/reference/symbolProperty33.errors.txt b/tests/baselines/reference/symbolProperty33.errors.txt new file mode 100644 index 00000000000..25a16b045ab --- /dev/null +++ b/tests/baselines/reference/symbolProperty33.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty33.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty33.ts (1 errors) ==== + class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } + } + class C2 { + [s: symbol]: () => { x: string }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty33.js b/tests/baselines/reference/symbolProperty33.js new file mode 100644 index 00000000000..f5a08010338 --- /dev/null +++ b/tests/baselines/reference/symbolProperty33.js @@ -0,0 +1,32 @@ +//// [symbolProperty33.ts] +class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 { + [s: symbol]: () => { x: string }; +} + +//// [symbolProperty33.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function (_super) { + __extends(C1, _super); + function C1() { + _super.apply(this, arguments); + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(C2); +var C2 = (function () { + function C2() { + } + return C2; +})(); diff --git a/tests/baselines/reference/symbolProperty34.errors.txt b/tests/baselines/reference/symbolProperty34.errors.txt new file mode 100644 index 00000000000..4339af94788 --- /dev/null +++ b/tests/baselines/reference/symbolProperty34.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty34.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty34.ts (1 errors) ==== + class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } + } + class C2 { + [s: symbol]: () => { x: number }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty34.js b/tests/baselines/reference/symbolProperty34.js new file mode 100644 index 00000000000..5b25f487fbf --- /dev/null +++ b/tests/baselines/reference/symbolProperty34.js @@ -0,0 +1,32 @@ +//// [symbolProperty34.ts] +class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 { + [s: symbol]: () => { x: number }; +} + +//// [symbolProperty34.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function (_super) { + __extends(C1, _super); + function C1() { + _super.apply(this, arguments); + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(C2); +var C2 = (function () { + function C2() { + } + return C2; +})(); diff --git a/tests/baselines/reference/symbolProperty35.errors.txt b/tests/baselines/reference/symbolProperty35.errors.txt new file mode 100644 index 00000000000..1558f5a3409 --- /dev/null +++ b/tests/baselines/reference/symbolProperty35.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/Symbols/symbolProperty35.ts(8,11): error TS2320: Interface 'I3' cannot simultaneously extend types 'I1' and 'I2'. + Named property '[Symbol.toStringTag]' of types 'I1' and 'I2' are not identical. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty35.ts (1 errors) ==== + interface I1 { + [Symbol.toStringTag](): { x: string } + } + interface I2 { + [Symbol.toStringTag](): { x: number } + } + + interface I3 extends I1, I2 { } + ~~ +!!! error TS2320: Interface 'I3' cannot simultaneously extend types 'I1' and 'I2'. +!!! error TS2320: Named property '[Symbol.toStringTag]' of types 'I1' and 'I2' are not identical. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty35.js b/tests/baselines/reference/symbolProperty35.js new file mode 100644 index 00000000000..c96e4ce28b1 --- /dev/null +++ b/tests/baselines/reference/symbolProperty35.js @@ -0,0 +1,11 @@ +//// [symbolProperty35.ts] +interface I1 { + [Symbol.toStringTag](): { x: string } +} +interface I2 { + [Symbol.toStringTag](): { x: number } +} + +interface I3 extends I1, I2 { } + +//// [symbolProperty35.js] diff --git a/tests/baselines/reference/symbolProperty36.errors.txt b/tests/baselines/reference/symbolProperty36.errors.txt new file mode 100644 index 00000000000..6fe3299ab90 --- /dev/null +++ b/tests/baselines/reference/symbolProperty36.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/Symbols/symbolProperty36.ts(2,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. +tests/cases/conformance/es6/Symbols/symbolProperty36.ts(3,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty36.ts (2 errors) ==== + var x = { + [Symbol.isConcatSpreadable]: 0, + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + [Symbol.isConcatSpreadable]: 1 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty36.js b/tests/baselines/reference/symbolProperty36.js new file mode 100644 index 00000000000..35d29d4892d --- /dev/null +++ b/tests/baselines/reference/symbolProperty36.js @@ -0,0 +1,11 @@ +//// [symbolProperty36.ts] +var x = { + [Symbol.isConcatSpreadable]: 0, + [Symbol.isConcatSpreadable]: 1 +} + +//// [symbolProperty36.js] +var x = { + [Symbol.isConcatSpreadable]: 0, + [Symbol.isConcatSpreadable]: 1 +}; diff --git a/tests/baselines/reference/symbolProperty37.errors.txt b/tests/baselines/reference/symbolProperty37.errors.txt new file mode 100644 index 00000000000..96e10e7f2a4 --- /dev/null +++ b/tests/baselines/reference/symbolProperty37.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/Symbols/symbolProperty37.ts(2,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. +tests/cases/conformance/es6/Symbols/symbolProperty37.ts(3,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty37.ts (2 errors) ==== + interface I { + [Symbol.isConcatSpreadable]: string; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + [Symbol.isConcatSpreadable]: string; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty37.js b/tests/baselines/reference/symbolProperty37.js new file mode 100644 index 00000000000..2aaf97ef300 --- /dev/null +++ b/tests/baselines/reference/symbolProperty37.js @@ -0,0 +1,7 @@ +//// [symbolProperty37.ts] +interface I { + [Symbol.isConcatSpreadable]: string; + [Symbol.isConcatSpreadable]: string; +} + +//// [symbolProperty37.js] diff --git a/tests/baselines/reference/symbolProperty38.errors.txt b/tests/baselines/reference/symbolProperty38.errors.txt new file mode 100644 index 00000000000..a519f7eb9a3 --- /dev/null +++ b/tests/baselines/reference/symbolProperty38.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/es6/Symbols/symbolProperty38.ts(2,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. +tests/cases/conformance/es6/Symbols/symbolProperty38.ts(5,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty38.ts (2 errors) ==== + interface I { + [Symbol.isConcatSpreadable]: string; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + } + interface I { + [Symbol.isConcatSpreadable]: string; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty38.js b/tests/baselines/reference/symbolProperty38.js new file mode 100644 index 00000000000..b90b4d8081d --- /dev/null +++ b/tests/baselines/reference/symbolProperty38.js @@ -0,0 +1,9 @@ +//// [symbolProperty38.ts] +interface I { + [Symbol.isConcatSpreadable]: string; +} +interface I { + [Symbol.isConcatSpreadable]: string; +} + +//// [symbolProperty38.js] diff --git a/tests/baselines/reference/symbolProperty39.errors.txt b/tests/baselines/reference/symbolProperty39.errors.txt new file mode 100644 index 00000000000..62dbdfc591c --- /dev/null +++ b/tests/baselines/reference/symbolProperty39.errors.txt @@ -0,0 +1,25 @@ +tests/cases/conformance/es6/Symbols/symbolProperty39.ts(2,5): error TS2393: Duplicate function implementation. +tests/cases/conformance/es6/Symbols/symbolProperty39.ts(3,5): error TS2393: Duplicate function implementation. +tests/cases/conformance/es6/Symbols/symbolProperty39.ts(4,5): error TS2393: Duplicate function implementation. +tests/cases/conformance/es6/Symbols/symbolProperty39.ts(7,5): error TS2393: Duplicate function implementation. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty39.ts (4 errors) ==== + class C { + [Symbol.iterator](x: string): string; + ~~~~~~~~~~~~~~~~~ +!!! error TS2393: Duplicate function implementation. + [Symbol.iterator](x: number): number; + ~~~~~~~~~~~~~~~~~ +!!! error TS2393: Duplicate function implementation. + [Symbol.iterator](x: any) { + ~~~~~~~~~~~~~~~~~ +!!! error TS2393: Duplicate function implementation. + return undefined; + } + [Symbol.iterator](x: any) { + ~~~~~~~~~~~~~~~~~ +!!! error TS2393: Duplicate function implementation. + return undefined; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty39.js b/tests/baselines/reference/symbolProperty39.js new file mode 100644 index 00000000000..18551d20c0b --- /dev/null +++ b/tests/baselines/reference/symbolProperty39.js @@ -0,0 +1,24 @@ +//// [symbolProperty39.ts] +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } + [Symbol.iterator](x: any) { + return undefined; + } +} + +//// [symbolProperty39.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function (x) { + return undefined; + }; + C.prototype[Symbol.iterator] = function (x) { + return undefined; + }; + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty4.js b/tests/baselines/reference/symbolProperty4.js new file mode 100644 index 00000000000..6072d6bbf72 --- /dev/null +++ b/tests/baselines/reference/symbolProperty4.js @@ -0,0 +1,17 @@ +//// [symbolProperty4.ts] +var x = { + [Symbol()]: 0, + [Symbol()]() { }, + get [Symbol()]() { + return 0; + } +} + +//// [symbolProperty4.js] +var x = { + [Symbol()]: 0, + [Symbol()]() { }, + get [Symbol()]() { + return 0; + } +}; diff --git a/tests/baselines/reference/symbolProperty4.types b/tests/baselines/reference/symbolProperty4.types new file mode 100644 index 00000000000..b8aac1f2770 --- /dev/null +++ b/tests/baselines/reference/symbolProperty4.types @@ -0,0 +1,20 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty4.ts === +var x = { +>x : {} +>{ [Symbol()]: 0, [Symbol()]() { }, get [Symbol()]() { return 0; }} : {} + + [Symbol()]: 0, +>Symbol() : symbol +>Symbol : SymbolConstructor + + [Symbol()]() { }, +>Symbol() : symbol +>Symbol : SymbolConstructor + + get [Symbol()]() { +>Symbol() : symbol +>Symbol : SymbolConstructor + + return 0; + } +} diff --git a/tests/baselines/reference/symbolProperty40.js b/tests/baselines/reference/symbolProperty40.js new file mode 100644 index 00000000000..15d8c5c6fba --- /dev/null +++ b/tests/baselines/reference/symbolProperty40.js @@ -0,0 +1,26 @@ +//// [symbolProperty40.ts] +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } +} + +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator](0); + + +//// [symbolProperty40.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function (x) { + return undefined; + }; + return C; +})(); +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator](0); diff --git a/tests/baselines/reference/symbolProperty40.types b/tests/baselines/reference/symbolProperty40.types new file mode 100644 index 00000000000..a87a6ea28a8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty40.types @@ -0,0 +1,48 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty40.ts === +class C { +>C : C + + [Symbol.iterator](x: string): string; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : string + + [Symbol.iterator](x: number): number; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : number + + [Symbol.iterator](x: any) { +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any + + return undefined; +>undefined : undefined + } +} + +var c = new C; +>c : C +>new C : C +>C : typeof C + +c[Symbol.iterator](""); +>c[Symbol.iterator]("") : string +>c[Symbol.iterator] : { (x: string): string; (x: number): number; } +>c : C +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +c[Symbol.iterator](0); +>c[Symbol.iterator](0) : number +>c[Symbol.iterator] : { (x: string): string; (x: number): number; } +>c : C +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + diff --git a/tests/baselines/reference/symbolProperty41.js b/tests/baselines/reference/symbolProperty41.js new file mode 100644 index 00000000000..d26b2c7682a --- /dev/null +++ b/tests/baselines/reference/symbolProperty41.js @@ -0,0 +1,26 @@ +//// [symbolProperty41.ts] +class C { + [Symbol.iterator](x: string): { x: string }; + [Symbol.iterator](x: "hello"): { x: string; hello: string }; + [Symbol.iterator](x: any) { + return undefined; + } +} + +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator]("hello"); + + +//// [symbolProperty41.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function (x) { + return undefined; + }; + return C; +})(); +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator]("hello"); diff --git a/tests/baselines/reference/symbolProperty41.types b/tests/baselines/reference/symbolProperty41.types new file mode 100644 index 00000000000..94032c194d6 --- /dev/null +++ b/tests/baselines/reference/symbolProperty41.types @@ -0,0 +1,51 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty41.ts === +class C { +>C : C + + [Symbol.iterator](x: string): { x: string }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : string +>x : string + + [Symbol.iterator](x: "hello"): { x: string; hello: string }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : "hello" +>x : string +>hello : string + + [Symbol.iterator](x: any) { +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any + + return undefined; +>undefined : undefined + } +} + +var c = new C; +>c : C +>new C : C +>C : typeof C + +c[Symbol.iterator](""); +>c[Symbol.iterator]("") : { x: string; } +>c[Symbol.iterator] : { (x: string): { x: string; }; (x: "hello"): { x: string; hello: string; }; } +>c : C +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +c[Symbol.iterator]("hello"); +>c[Symbol.iterator]("hello") : { x: string; hello: string; } +>c[Symbol.iterator] : { (x: string): { x: string; }; (x: "hello"): { x: string; hello: string; }; } +>c : C +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + diff --git a/tests/baselines/reference/symbolProperty42.errors.txt b/tests/baselines/reference/symbolProperty42.errors.txt new file mode 100644 index 00000000000..291c1c1cc50 --- /dev/null +++ b/tests/baselines/reference/symbolProperty42.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/Symbols/symbolProperty42.ts(3,12): error TS2388: Function overload must not be static. +tests/cases/conformance/es6/Symbols/symbolProperty42.ts(4,5): error TS2387: Function overload must be static. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty42.ts (2 errors) ==== + class C { + [Symbol.iterator](x: string): string; + static [Symbol.iterator](x: number): number; + ~~~~~~~~~~~~~~~~~ +!!! error TS2388: Function overload must not be static. + [Symbol.iterator](x: any) { + ~~~~~~~~~~~~~~~~~ +!!! error TS2387: Function overload must be static. + return undefined; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty42.js b/tests/baselines/reference/symbolProperty42.js new file mode 100644 index 00000000000..1990f54066c --- /dev/null +++ b/tests/baselines/reference/symbolProperty42.js @@ -0,0 +1,18 @@ +//// [symbolProperty42.ts] +class C { + [Symbol.iterator](x: string): string; + static [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } +} + +//// [symbolProperty42.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function (x) { + return undefined; + }; + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty43.errors.txt b/tests/baselines/reference/symbolProperty43.errors.txt new file mode 100644 index 00000000000..c5124c4cd22 --- /dev/null +++ b/tests/baselines/reference/symbolProperty43.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/es6/Symbols/symbolProperty43.ts(3,5): error TS2391: Function implementation is missing or not immediately following the declaration. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty43.ts (1 errors) ==== + class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; + ~~~~~~~~~~~~~~~~~ +!!! error TS2391: Function implementation is missing or not immediately following the declaration. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty43.js b/tests/baselines/reference/symbolProperty43.js new file mode 100644 index 00000000000..fcb1fd3f8e5 --- /dev/null +++ b/tests/baselines/reference/symbolProperty43.js @@ -0,0 +1,12 @@ +//// [symbolProperty43.ts] +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; +} + +//// [symbolProperty43.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty44.errors.txt b/tests/baselines/reference/symbolProperty44.errors.txt new file mode 100644 index 00000000000..2cef480e736 --- /dev/null +++ b/tests/baselines/reference/symbolProperty44.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/Symbols/symbolProperty44.ts(2,9): error TS2300: Duplicate identifier '[Symbol.hasInstance]'. +tests/cases/conformance/es6/Symbols/symbolProperty44.ts(5,9): error TS2300: Duplicate identifier '[Symbol.hasInstance]'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty44.ts (2 errors) ==== + class C { + get [Symbol.hasInstance]() { + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.hasInstance]'. + return ""; + } + get [Symbol.hasInstance]() { + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.hasInstance]'. + return ""; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty44.js b/tests/baselines/reference/symbolProperty44.js new file mode 100644 index 00000000000..d4824e79318 --- /dev/null +++ b/tests/baselines/reference/symbolProperty44.js @@ -0,0 +1,23 @@ +//// [symbolProperty44.ts] +class C { + get [Symbol.hasInstance]() { + return ""; + } + get [Symbol.hasInstance]() { + return ""; + } +} + +//// [symbolProperty44.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.hasInstance, { + get: function () { + return ""; + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty45.js b/tests/baselines/reference/symbolProperty45.js new file mode 100644 index 00000000000..d056aba9f56 --- /dev/null +++ b/tests/baselines/reference/symbolProperty45.js @@ -0,0 +1,30 @@ +//// [symbolProperty45.ts] +class C { + get [Symbol.hasInstance]() { + return ""; + } + get [Symbol.toPrimitive]() { + return ""; + } +} + +//// [symbolProperty45.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.hasInstance, { + get: function () { + return ""; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, Symbol.toPrimitive, { + get: function () { + return ""; + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty45.types b/tests/baselines/reference/symbolProperty45.types new file mode 100644 index 00000000000..24a74729aec --- /dev/null +++ b/tests/baselines/reference/symbolProperty45.types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty45.ts === +class C { +>C : C + + get [Symbol.hasInstance]() { +>Symbol.hasInstance : symbol +>Symbol : SymbolConstructor +>hasInstance : symbol + + return ""; + } + get [Symbol.toPrimitive]() { +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol + + return ""; + } +} diff --git a/tests/baselines/reference/symbolProperty46.errors.txt b/tests/baselines/reference/symbolProperty46.errors.txt new file mode 100644 index 00000000000..68f86afc315 --- /dev/null +++ b/tests/baselines/reference/symbolProperty46.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/Symbols/symbolProperty46.ts(10,1): error TS2322: Type 'number' is not assignable to type 'string'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty46.ts (1 errors) ==== + class C { + get [Symbol.hasInstance]() { + return ""; + } + // Should take a string + set [Symbol.hasInstance](x) { + } + } + + (new C)[Symbol.hasInstance] = 0; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. + (new C)[Symbol.hasInstance] = ""; \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty46.js b/tests/baselines/reference/symbolProperty46.js new file mode 100644 index 00000000000..255fbac0809 --- /dev/null +++ b/tests/baselines/reference/symbolProperty46.js @@ -0,0 +1,31 @@ +//// [symbolProperty46.ts] +class C { + get [Symbol.hasInstance]() { + return ""; + } + // Should take a string + set [Symbol.hasInstance](x) { + } +} + +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; + +//// [symbolProperty46.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.hasInstance, { + get: function () { + return ""; + }, + // Should take a string + set: function (x) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; diff --git a/tests/baselines/reference/symbolProperty47.errors.txt b/tests/baselines/reference/symbolProperty47.errors.txt new file mode 100644 index 00000000000..b35650f94bb --- /dev/null +++ b/tests/baselines/reference/symbolProperty47.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/es6/Symbols/symbolProperty47.ts(3,16): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/es6/Symbols/symbolProperty47.ts(11,1): error TS2322: Type 'string' is not assignable to type 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty47.ts (2 errors) ==== + class C { + get [Symbol.hasInstance]() { + return ""; + ~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + } + // Should take a string + set [Symbol.hasInstance](x: number) { + } + } + + (new C)[Symbol.hasInstance] = 0; + (new C)[Symbol.hasInstance] = ""; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty47.js b/tests/baselines/reference/symbolProperty47.js new file mode 100644 index 00000000000..92429c720c1 --- /dev/null +++ b/tests/baselines/reference/symbolProperty47.js @@ -0,0 +1,31 @@ +//// [symbolProperty47.ts] +class C { + get [Symbol.hasInstance]() { + return ""; + } + // Should take a string + set [Symbol.hasInstance](x: number) { + } +} + +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; + +//// [symbolProperty47.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.hasInstance, { + get: function () { + return ""; + }, + // Should take a string + set: function (x) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; diff --git a/tests/baselines/reference/symbolProperty48.errors.txt b/tests/baselines/reference/symbolProperty48.errors.txt new file mode 100644 index 00000000000..8d52fa48a07 --- /dev/null +++ b/tests/baselines/reference/symbolProperty48.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/Symbols/symbolProperty48.ts(5,10): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty48.ts (1 errors) ==== + module M { + var Symbol; + + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty48.js b/tests/baselines/reference/symbolProperty48.js new file mode 100644 index 00000000000..48717470f2f --- /dev/null +++ b/tests/baselines/reference/symbolProperty48.js @@ -0,0 +1,20 @@ +//// [symbolProperty48.ts] +module M { + var Symbol; + + class C { + [Symbol.iterator]() { } + } +} + +//// [symbolProperty48.js] +var M; +(function (M) { + var Symbol; + var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; + })(); +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty49.errors.txt b/tests/baselines/reference/symbolProperty49.errors.txt new file mode 100644 index 00000000000..8a15b359ee7 --- /dev/null +++ b/tests/baselines/reference/symbolProperty49.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/Symbols/symbolProperty49.ts(5,10): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty49.ts (1 errors) ==== + module M { + export var Symbol; + + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty49.js b/tests/baselines/reference/symbolProperty49.js new file mode 100644 index 00000000000..6c115a89ae4 --- /dev/null +++ b/tests/baselines/reference/symbolProperty49.js @@ -0,0 +1,20 @@ +//// [symbolProperty49.ts] +module M { + export var Symbol; + + class C { + [Symbol.iterator]() { } + } +} + +//// [symbolProperty49.js] +var M; +(function (M) { + M.Symbol; + var C = (function () { + function C() { + } + C.prototype[M.Symbol.iterator] = function () { }; + return C; + })(); +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty5.js b/tests/baselines/reference/symbolProperty5.js new file mode 100644 index 00000000000..c7c88681f8a --- /dev/null +++ b/tests/baselines/reference/symbolProperty5.js @@ -0,0 +1,17 @@ +//// [symbolProperty5.ts] +var x = { + [Symbol.iterator]: 0, + [Symbol.isRegExp]() { }, + get [Symbol.toStringTag]() { + return 0; + } +} + +//// [symbolProperty5.js] +var x = { + [Symbol.iterator]: 0, + [Symbol.isRegExp]() { }, + get [Symbol.toStringTag]() { + return 0; + } +}; diff --git a/tests/baselines/reference/symbolProperty5.types b/tests/baselines/reference/symbolProperty5.types new file mode 100644 index 00000000000..7d6a9f05858 --- /dev/null +++ b/tests/baselines/reference/symbolProperty5.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty5.ts === +var x = { +>x : { [Symbol.iterator]: number; [Symbol.isRegExp](): void; [Symbol.toStringTag]: number; } +>{ [Symbol.iterator]: 0, [Symbol.isRegExp]() { }, get [Symbol.toStringTag]() { return 0; }} : { [Symbol.iterator]: number; [Symbol.isRegExp](): void; [Symbol.toStringTag]: number; } + + [Symbol.iterator]: 0, +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + [Symbol.isRegExp]() { }, +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + get [Symbol.toStringTag]() { +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + return 0; + } +} diff --git a/tests/baselines/reference/symbolProperty50.js b/tests/baselines/reference/symbolProperty50.js new file mode 100644 index 00000000000..61ded053938 --- /dev/null +++ b/tests/baselines/reference/symbolProperty50.js @@ -0,0 +1,19 @@ +//// [symbolProperty50.ts] +module M { + interface Symbol { } + + class C { + [Symbol.iterator]() { } + } +} + +//// [symbolProperty50.js] +var M; +(function (M) { + var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; + })(); +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty50.types b/tests/baselines/reference/symbolProperty50.types new file mode 100644 index 00000000000..8258dfe1b72 --- /dev/null +++ b/tests/baselines/reference/symbolProperty50.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty50.ts === +module M { +>M : typeof M + + interface Symbol { } +>Symbol : Symbol + + class C { +>C : C + + [Symbol.iterator]() { } +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + } +} diff --git a/tests/baselines/reference/symbolProperty51.js b/tests/baselines/reference/symbolProperty51.js new file mode 100644 index 00000000000..246dbaaa173 --- /dev/null +++ b/tests/baselines/reference/symbolProperty51.js @@ -0,0 +1,19 @@ +//// [symbolProperty51.ts] +module M { + module Symbol { } + + class C { + [Symbol.iterator]() { } + } +} + +//// [symbolProperty51.js] +var M; +(function (M) { + var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { }; + return C; + })(); +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty51.types b/tests/baselines/reference/symbolProperty51.types new file mode 100644 index 00000000000..6677b3b2e2d --- /dev/null +++ b/tests/baselines/reference/symbolProperty51.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty51.ts === +module M { +>M : typeof M + + module Symbol { } +>Symbol : unknown + + class C { +>C : C + + [Symbol.iterator]() { } +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + } +} diff --git a/tests/baselines/reference/symbolProperty52.errors.txt b/tests/baselines/reference/symbolProperty52.errors.txt new file mode 100644 index 00000000000..5a44918d564 --- /dev/null +++ b/tests/baselines/reference/symbolProperty52.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/es6/Symbols/symbolProperty52.ts(2,13): error TS2339: Property 'nonsense' does not exist on type 'SymbolConstructor'. +tests/cases/conformance/es6/Symbols/symbolProperty52.ts(5,1): error TS2322: Type '{}' is not assignable to type '{ [Symbol.nonsense]: number; }'. + Property '[Symbol.nonsense]' is missing in type '{}'. +tests/cases/conformance/es6/Symbols/symbolProperty52.ts(7,12): error TS2339: Property 'nonsense' does not exist on type 'SymbolConstructor'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty52.ts (3 errors) ==== + var obj = { + [Symbol.nonsense]: 0 + ~~~~~~~~ +!!! error TS2339: Property 'nonsense' does not exist on type 'SymbolConstructor'. + }; + + obj = {}; + ~~~ +!!! error TS2322: Type '{}' is not assignable to type '{ [Symbol.nonsense]: number; }'. +!!! error TS2322: Property '[Symbol.nonsense]' is missing in type '{}'. + + obj[Symbol.nonsense]; + ~~~~~~~~ +!!! error TS2339: Property 'nonsense' does not exist on type 'SymbolConstructor'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty52.js b/tests/baselines/reference/symbolProperty52.js new file mode 100644 index 00000000000..1bf4a47de7f --- /dev/null +++ b/tests/baselines/reference/symbolProperty52.js @@ -0,0 +1,15 @@ +//// [symbolProperty52.ts] +var obj = { + [Symbol.nonsense]: 0 +}; + +obj = {}; + +obj[Symbol.nonsense]; + +//// [symbolProperty52.js] +var obj = { + [Symbol.nonsense]: 0 +}; +obj = {}; +obj[Symbol.nonsense]; diff --git a/tests/baselines/reference/symbolProperty53.errors.txt b/tests/baselines/reference/symbolProperty53.errors.txt new file mode 100644 index 00000000000..7658744eb55 --- /dev/null +++ b/tests/baselines/reference/symbolProperty53.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty53.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/Symbols/symbolProperty53.ts(5,1): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty53.ts (2 errors) ==== + var obj = { + [Symbol.for]: 0 + ~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + }; + + obj[Symbol.for]; + ~~~~~~~~~~~~~~~ +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty53.js b/tests/baselines/reference/symbolProperty53.js new file mode 100644 index 00000000000..71c82d14917 --- /dev/null +++ b/tests/baselines/reference/symbolProperty53.js @@ -0,0 +1,12 @@ +//// [symbolProperty53.ts] +var obj = { + [Symbol.for]: 0 +}; + +obj[Symbol.for]; + +//// [symbolProperty53.js] +var obj = { + [Symbol.for]: 0 +}; +obj[Symbol.for]; diff --git a/tests/baselines/reference/symbolProperty54.errors.txt b/tests/baselines/reference/symbolProperty54.errors.txt new file mode 100644 index 00000000000..b634b4edb0f --- /dev/null +++ b/tests/baselines/reference/symbolProperty54.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/Symbols/symbolProperty54.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty54.ts (1 errors) ==== + var obj = { + [Symbol.prototype]: 0 + ~~~~~~~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + }; \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty54.js b/tests/baselines/reference/symbolProperty54.js new file mode 100644 index 00000000000..ace8a7ca926 --- /dev/null +++ b/tests/baselines/reference/symbolProperty54.js @@ -0,0 +1,9 @@ +//// [symbolProperty54.ts] +var obj = { + [Symbol.prototype]: 0 +}; + +//// [symbolProperty54.js] +var obj = { + [Symbol.prototype]: 0 +}; diff --git a/tests/baselines/reference/symbolProperty55.js b/tests/baselines/reference/symbolProperty55.js new file mode 100644 index 00000000000..e19e2d8e2f6 --- /dev/null +++ b/tests/baselines/reference/symbolProperty55.js @@ -0,0 +1,23 @@ +//// [symbolProperty55.ts] +var obj = { + [Symbol.iterator]: 0 +}; + +module M { + var Symbol: SymbolConstructor; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol.iterator]; +} + +//// [symbolProperty55.js] +var obj = { + [Symbol.iterator]: 0 +}; +var M; +(function (M) { + var Symbol; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol.iterator]; +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty55.types b/tests/baselines/reference/symbolProperty55.types new file mode 100644 index 00000000000..34b32e27eae --- /dev/null +++ b/tests/baselines/reference/symbolProperty55.types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty55.ts === +var obj = { +>obj : { [Symbol.iterator]: number; } +>{ [Symbol.iterator]: 0} : { [Symbol.iterator]: number; } + + [Symbol.iterator]: 0 +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +}; + +module M { +>M : typeof M + + var Symbol: SymbolConstructor; +>Symbol : SymbolConstructor +>SymbolConstructor : SymbolConstructor + + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol.iterator]; +>obj[Symbol.iterator] : any +>obj : { [Symbol.iterator]: number; } +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +} diff --git a/tests/baselines/reference/symbolProperty56.js b/tests/baselines/reference/symbolProperty56.js new file mode 100644 index 00000000000..fea4520c2f8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty56.js @@ -0,0 +1,23 @@ +//// [symbolProperty56.ts] +var obj = { + [Symbol.iterator]: 0 +}; + +module M { + var Symbol: {}; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol["iterator"]]; +} + +//// [symbolProperty56.js] +var obj = { + [Symbol.iterator]: 0 +}; +var M; +(function (M) { + var Symbol; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol["iterator"]]; +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty56.types b/tests/baselines/reference/symbolProperty56.types new file mode 100644 index 00000000000..8fc2e97b751 --- /dev/null +++ b/tests/baselines/reference/symbolProperty56.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty56.ts === +var obj = { +>obj : { [Symbol.iterator]: number; } +>{ [Symbol.iterator]: 0} : { [Symbol.iterator]: number; } + + [Symbol.iterator]: 0 +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +}; + +module M { +>M : typeof M + + var Symbol: {}; +>Symbol : {} + + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol["iterator"]]; +>obj[Symbol["iterator"]] : any +>obj : { [Symbol.iterator]: number; } +>Symbol["iterator"] : any +>Symbol : {} +} diff --git a/tests/baselines/reference/symbolProperty57.js b/tests/baselines/reference/symbolProperty57.js new file mode 100644 index 00000000000..8fffcba3e27 --- /dev/null +++ b/tests/baselines/reference/symbolProperty57.js @@ -0,0 +1,14 @@ +//// [symbolProperty57.ts] +var obj = { + [Symbol.iterator]: 0 +}; + +// Should give type 'any'. +obj[Symbol["nonsense"]]; + +//// [symbolProperty57.js] +var obj = { + [Symbol.iterator]: 0 +}; +// Should give type 'any'. +obj[Symbol["nonsense"]]; diff --git a/tests/baselines/reference/symbolProperty57.types b/tests/baselines/reference/symbolProperty57.types new file mode 100644 index 00000000000..013c008ce12 --- /dev/null +++ b/tests/baselines/reference/symbolProperty57.types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty57.ts === +var obj = { +>obj : { [Symbol.iterator]: number; } +>{ [Symbol.iterator]: 0} : { [Symbol.iterator]: number; } + + [Symbol.iterator]: 0 +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +}; + +// Should give type 'any'. +obj[Symbol["nonsense"]]; +>obj[Symbol["nonsense"]] : any +>obj : { [Symbol.iterator]: number; } +>Symbol["nonsense"] : any +>Symbol : SymbolConstructor + diff --git a/tests/baselines/reference/symbolProperty58.errors.txt b/tests/baselines/reference/symbolProperty58.errors.txt new file mode 100644 index 00000000000..5f8b117a74c --- /dev/null +++ b/tests/baselines/reference/symbolProperty58.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/Symbols/symbolProperty58.ts(6,6): error TS2471: A computed property name of the form 'Symbol.foo' must be of type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty58.ts (1 errors) ==== + interface SymbolConstructor { + foo: string; + } + + var obj = { + [Symbol.foo]: 0 + ~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.foo' must be of type 'symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty58.js b/tests/baselines/reference/symbolProperty58.js new file mode 100644 index 00000000000..94b22156b1a --- /dev/null +++ b/tests/baselines/reference/symbolProperty58.js @@ -0,0 +1,13 @@ +//// [symbolProperty58.ts] +interface SymbolConstructor { + foo: string; +} + +var obj = { + [Symbol.foo]: 0 +} + +//// [symbolProperty58.js] +var obj = { + [Symbol.foo]: 0 +}; diff --git a/tests/baselines/reference/symbolProperty59.errors.txt b/tests/baselines/reference/symbolProperty59.errors.txt new file mode 100644 index 00000000000..dfb2ece3d21 --- /dev/null +++ b/tests/baselines/reference/symbolProperty59.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/Symbols/symbolProperty59.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty59.ts (1 errors) ==== + interface I { + [Symbol.keyFor]: string; + ~~~~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty59.js b/tests/baselines/reference/symbolProperty59.js new file mode 100644 index 00000000000..78d1d212f28 --- /dev/null +++ b/tests/baselines/reference/symbolProperty59.js @@ -0,0 +1,6 @@ +//// [symbolProperty59.ts] +interface I { + [Symbol.keyFor]: string; +} + +//// [symbolProperty59.js] diff --git a/tests/baselines/reference/symbolProperty6.js b/tests/baselines/reference/symbolProperty6.js new file mode 100644 index 00000000000..aee61b97435 --- /dev/null +++ b/tests/baselines/reference/symbolProperty6.js @@ -0,0 +1,25 @@ +//// [symbolProperty6.ts] +class C { + [Symbol.iterator] = 0; + [Symbol.unscopables]: number; + [Symbol.isRegExp]() { } + get [Symbol.toStringTag]() { + return 0; + } +} + +//// [symbolProperty6.js] +var C = (function () { + function C() { + this[Symbol.iterator] = 0; + } + C.prototype[Symbol.isRegExp] = function () { }; + Object.defineProperty(C.prototype, Symbol.toStringTag, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty6.types b/tests/baselines/reference/symbolProperty6.types new file mode 100644 index 00000000000..e5aac6f48da --- /dev/null +++ b/tests/baselines/reference/symbolProperty6.types @@ -0,0 +1,27 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty6.ts === +class C { +>C : C + + [Symbol.iterator] = 0; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + [Symbol.unscopables]: number; +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol + + [Symbol.isRegExp]() { } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + get [Symbol.toStringTag]() { +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + return 0; + } +} diff --git a/tests/baselines/reference/symbolProperty7.errors.txt b/tests/baselines/reference/symbolProperty7.errors.txt new file mode 100644 index 00000000000..652f637d852 --- /dev/null +++ b/tests/baselines/reference/symbolProperty7.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/Symbols/symbolProperty7.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/Symbols/symbolProperty7.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty7.ts (2 errors) ==== + class C { + [Symbol()] = 0; + ~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [Symbol()]: number; + ~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [Symbol()]() { } + get [Symbol()]() { + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty7.js b/tests/baselines/reference/symbolProperty7.js new file mode 100644 index 00000000000..781113572a1 --- /dev/null +++ b/tests/baselines/reference/symbolProperty7.js @@ -0,0 +1,25 @@ +//// [symbolProperty7.ts] +class C { + [Symbol()] = 0; + [Symbol()]: number; + [Symbol()]() { } + get [Symbol()]() { + return 0; + } +} + +//// [symbolProperty7.js] +var C = (function () { + function C() { + this[Symbol()] = 0; + } + C.prototype[Symbol()] = function () { }; + Object.defineProperty(C.prototype, Symbol(), { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty8.js b/tests/baselines/reference/symbolProperty8.js new file mode 100644 index 00000000000..6f3ec6cfa26 --- /dev/null +++ b/tests/baselines/reference/symbolProperty8.js @@ -0,0 +1,7 @@ +//// [symbolProperty8.ts] +interface I { + [Symbol.unscopables]: number; + [Symbol.isRegExp](); +} + +//// [symbolProperty8.js] diff --git a/tests/baselines/reference/symbolProperty8.types b/tests/baselines/reference/symbolProperty8.types new file mode 100644 index 00000000000..d6c2f464b53 --- /dev/null +++ b/tests/baselines/reference/symbolProperty8.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty8.ts === +interface I { +>I : I + + [Symbol.unscopables]: number; +>Symbol.unscopables : symbol +>Symbol : SymbolConstructor +>unscopables : symbol + + [Symbol.isRegExp](); +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +} diff --git a/tests/baselines/reference/symbolProperty9.errors.txt b/tests/baselines/reference/symbolProperty9.errors.txt new file mode 100644 index 00000000000..e621ab6c5a6 --- /dev/null +++ b/tests/baselines/reference/symbolProperty9.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/es6/Symbols/symbolProperty9.ts(10,5): error TS2322: Type 'I' is not assignable to type 'C'. + Types of property '[Symbol.iterator]' are incompatible. + Type '{ x: any; }' is not assignable to type '{ x: any; y: any; }'. + Property 'y' is missing in type '{ x: any; }'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty9.ts (1 errors) ==== + class C { + [Symbol.iterator]: { x; y }; + } + interface I { + [Symbol.iterator]: { x }; + } + + var i: I; + i = new C; + var c: C = i; + ~ +!!! error TS2322: Type 'I' is not assignable to type 'C'. +!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. +!!! error TS2322: Type '{ x: any; }' is not assignable to type '{ x: any; y: any; }'. +!!! error TS2322: Property 'y' is missing in type '{ x: any; }'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty9.js b/tests/baselines/reference/symbolProperty9.js new file mode 100644 index 00000000000..f97a1d44a21 --- /dev/null +++ b/tests/baselines/reference/symbolProperty9.js @@ -0,0 +1,21 @@ +//// [symbolProperty9.ts] +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]: { x }; +} + +var i: I; +i = new C; +var c: C = i; + +//// [symbolProperty9.js] +var C = (function () { + function C() { + } + return C; +})(); +var i; +i = new C; +var c = i; diff --git a/tests/baselines/reference/symbolType1.errors.txt b/tests/baselines/reference/symbolType1.errors.txt new file mode 100644 index 00000000000..00873ccc871 --- /dev/null +++ b/tests/baselines/reference/symbolType1.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/Symbols/symbolType1.ts(1,1): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +tests/cases/conformance/es6/Symbols/symbolType1.ts(2,19): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +tests/cases/conformance/es6/Symbols/symbolType1.ts(4,19): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. + + +==== tests/cases/conformance/es6/Symbols/symbolType1.ts (3 errors) ==== + Symbol() instanceof Symbol; + ~~~~~~~~ +!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. + Symbol instanceof Symbol(); + ~~~~~~~~ +!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. + (Symbol() || {}) instanceof Object; // This one should be okay, it's a valid way of distinguishing types + Symbol instanceof (Symbol() || {}); + ~~~~~~~~~~~~~~~~ +!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType1.js b/tests/baselines/reference/symbolType1.js new file mode 100644 index 00000000000..90fb5405162 --- /dev/null +++ b/tests/baselines/reference/symbolType1.js @@ -0,0 +1,11 @@ +//// [symbolType1.ts] +Symbol() instanceof Symbol; +Symbol instanceof Symbol(); +(Symbol() || {}) instanceof Object; // This one should be okay, it's a valid way of distinguishing types +Symbol instanceof (Symbol() || {}); + +//// [symbolType1.js] +Symbol() instanceof Symbol; +Symbol instanceof Symbol(); +(Symbol() || {}) instanceof Object; // This one should be okay, it's a valid way of distinguishing types +Symbol instanceof (Symbol() || {}); diff --git a/tests/baselines/reference/symbolType10.errors.txt b/tests/baselines/reference/symbolType10.errors.txt new file mode 100644 index 00000000000..852f863bae8 --- /dev/null +++ b/tests/baselines/reference/symbolType10.errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/es6/Symbols/symbolType10.ts(2,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(2,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(3,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(3,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(4,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(4,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(7,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/es6/Symbols/symbolType10.ts (8 errors) ==== + var s = Symbol.for("bitwise"); + s & s; + ~ +!!! 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. + s | s; + ~ +!!! 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. + s ^ s; + ~ +!!! 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. + + s & 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + 0 | s; + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType10.js b/tests/baselines/reference/symbolType10.js new file mode 100644 index 00000000000..378479fb70f --- /dev/null +++ b/tests/baselines/reference/symbolType10.js @@ -0,0 +1,16 @@ +//// [symbolType10.ts] +var s = Symbol.for("bitwise"); +s & s; +s | s; +s ^ s; + +s & 0; +0 | s; + +//// [symbolType10.js] +var s = Symbol.for("bitwise"); +s & s; +s | s; +s ^ s; +s & 0; +0 | s; diff --git a/tests/baselines/reference/symbolType11.js b/tests/baselines/reference/symbolType11.js new file mode 100644 index 00000000000..3328be28d15 --- /dev/null +++ b/tests/baselines/reference/symbolType11.js @@ -0,0 +1,17 @@ +//// [symbolType11.ts] +var s = Symbol.for("logical"); +s && s; +s && []; +0 && s; +s || s; +s || 1; +({}) || s; + +//// [symbolType11.js] +var s = Symbol.for("logical"); +s && s; +s && []; +0 && s; +s || s; +s || 1; +({}) || s; diff --git a/tests/baselines/reference/symbolType11.types b/tests/baselines/reference/symbolType11.types new file mode 100644 index 00000000000..21de110854c --- /dev/null +++ b/tests/baselines/reference/symbolType11.types @@ -0,0 +1,37 @@ +=== tests/cases/conformance/es6/Symbols/symbolType11.ts === +var s = Symbol.for("logical"); +>s : symbol +>Symbol.for("logical") : symbol +>Symbol.for : (key: string) => symbol +>Symbol : SymbolConstructor +>for : (key: string) => symbol + +s && s; +>s && s : symbol +>s : symbol +>s : symbol + +s && []; +>s && [] : undefined[] +>s : symbol +>[] : undefined[] + +0 && s; +>0 && s : symbol +>s : symbol + +s || s; +>s || s : symbol +>s : symbol +>s : symbol + +s || 1; +>s || 1 : number | symbol +>s : symbol + +({}) || s; +>({}) || s : {} +>({}) : {} +>{} : {} +>s : symbol + diff --git a/tests/baselines/reference/symbolType12.errors.txt b/tests/baselines/reference/symbolType12.errors.txt new file mode 100644 index 00000000000..adceb58ae56 --- /dev/null +++ b/tests/baselines/reference/symbolType12.errors.txt @@ -0,0 +1,136 @@ +tests/cases/conformance/es6/Symbols/symbolType12.ts(3,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(3,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(4,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(5,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(5,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(7,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(7,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(8,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(9,1): error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType12.ts(10,1): error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'number'. +tests/cases/conformance/es6/Symbols/symbolType12.ts(11,1): error TS2469: The '+=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType12.ts(12,8): error TS2469: The '+=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType12.ts(13,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(13,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(14,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(15,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(15,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(16,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(17,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(17,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(18,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(19,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(19,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(20,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(21,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(21,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(22,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(23,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(23,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(24,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(25,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(25,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(26,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(28,8): error TS2469: The '+=' operator cannot be applied to type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType12.ts (35 errors) ==== + var s = Symbol.for("assign"); + var str = ""; + s *= s; + ~ +!!! 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. + s *= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s /= s; + ~ +!!! 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. + s /= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s %= s; + ~ +!!! 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. + s %= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s += s; + ~~~~~~ +!!! error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'symbol'. + s += 0; + ~~~~~~ +!!! error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'number'. + s += ""; + ~ +!!! error TS2469: The '+=' operator cannot be applied to type 'symbol'. + str += s; + ~ +!!! error TS2469: The '+=' operator cannot be applied to type 'symbol'. + s -= s; + ~ +!!! 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. + s -= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s <<= s; + ~ +!!! 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. + s <<= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >>= s; + ~ +!!! 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. + s >>= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >>>= s; + ~ +!!! 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. + s >>>= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s &= s; + ~ +!!! 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. + s &= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s ^= s; + ~ +!!! 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. + s ^= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s |= s; + ~ +!!! 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. + s |= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + str += (s || str); + ~~~~~~~~~~ +!!! error TS2469: The '+=' operator cannot be applied to type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType12.js b/tests/baselines/reference/symbolType12.js new file mode 100644 index 00000000000..069846e136f --- /dev/null +++ b/tests/baselines/reference/symbolType12.js @@ -0,0 +1,58 @@ +//// [symbolType12.ts] +var s = Symbol.for("assign"); +var str = ""; +s *= s; +s *= 0; +s /= s; +s /= 0; +s %= s; +s %= 0; +s += s; +s += 0; +s += ""; +str += s; +s -= s; +s -= 0; +s <<= s; +s <<= 0; +s >>= s; +s >>= 0; +s >>>= s; +s >>>= 0; +s &= s; +s &= 0; +s ^= s; +s ^= 0; +s |= s; +s |= 0; + +str += (s || str); + +//// [symbolType12.js] +var s = Symbol.for("assign"); +var str = ""; +s *= s; +s *= 0; +s /= s; +s /= 0; +s %= s; +s %= 0; +s += s; +s += 0; +s += ""; +str += s; +s -= s; +s -= 0; +s <<= s; +s <<= 0; +s >>= s; +s >>= 0; +s >>>= s; +s >>>= 0; +s &= s; +s &= 0; +s ^= s; +s ^= 0; +s |= s; +s |= 0; +str += (s || str); diff --git a/tests/baselines/reference/symbolType13.errors.txt b/tests/baselines/reference/symbolType13.errors.txt new file mode 100644 index 00000000000..68981d0072b --- /dev/null +++ b/tests/baselines/reference/symbolType13.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/Symbols/symbolType13.ts(4,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +tests/cases/conformance/es6/Symbols/symbolType13.ts(5,11): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. +tests/cases/conformance/es6/Symbols/symbolType13.ts(6,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. + + +==== tests/cases/conformance/es6/Symbols/symbolType13.ts (3 errors) ==== + var s = Symbol(); + var x: any; + + for (s in {}) { } + ~ +!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. + for (x in s) { } + ~ +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. + for (var y in s) { } + ~ +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType13.js b/tests/baselines/reference/symbolType13.js new file mode 100644 index 00000000000..afd62079bb5 --- /dev/null +++ b/tests/baselines/reference/symbolType13.js @@ -0,0 +1,14 @@ +//// [symbolType13.ts] +var s = Symbol(); +var x: any; + +for (s in {}) { } +for (x in s) { } +for (var y in s) { } + +//// [symbolType13.js] +var s = Symbol(); +var x; +for (s in {}) { } +for (x in s) { } +for (var y in s) { } diff --git a/tests/baselines/reference/symbolType14.errors.txt b/tests/baselines/reference/symbolType14.errors.txt new file mode 100644 index 00000000000..a31230efe23 --- /dev/null +++ b/tests/baselines/reference/symbolType14.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/Symbols/symbolType14.ts(1,1): error TS2350: Only a void function can be called with the 'new' keyword. + + +==== tests/cases/conformance/es6/Symbols/symbolType14.ts (1 errors) ==== + new Symbol(); + ~~~~~~~~~~~~ +!!! error TS2350: Only a void function can be called with the 'new' keyword. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType14.js b/tests/baselines/reference/symbolType14.js new file mode 100644 index 00000000000..4bbd24f30d9 --- /dev/null +++ b/tests/baselines/reference/symbolType14.js @@ -0,0 +1,5 @@ +//// [symbolType14.ts] +new Symbol(); + +//// [symbolType14.js] +new Symbol(); diff --git a/tests/baselines/reference/symbolType15.errors.txt b/tests/baselines/reference/symbolType15.errors.txt new file mode 100644 index 00000000000..eb63e5798d5 --- /dev/null +++ b/tests/baselines/reference/symbolType15.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/Symbols/symbolType15.ts(5,1): error TS2322: Type 'Symbol' is not assignable to type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType15.ts (1 errors) ==== + var sym: symbol; + var symObj: Symbol; + + symObj = sym; + sym = symObj; + ~~~ +!!! error TS2322: Type 'Symbol' is not assignable to type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType15.js b/tests/baselines/reference/symbolType15.js new file mode 100644 index 00000000000..1c3519d603e --- /dev/null +++ b/tests/baselines/reference/symbolType15.js @@ -0,0 +1,12 @@ +//// [symbolType15.ts] +var sym: symbol; +var symObj: Symbol; + +symObj = sym; +sym = symObj; + +//// [symbolType15.js] +var sym; +var symObj; +symObj = sym; +sym = symObj; diff --git a/tests/baselines/reference/symbolType16.js b/tests/baselines/reference/symbolType16.js new file mode 100644 index 00000000000..65a95dd8365 --- /dev/null +++ b/tests/baselines/reference/symbolType16.js @@ -0,0 +1,11 @@ +//// [symbolType16.ts] +interface Symbol { + newSymbolProp: number; +} + +var sym: symbol; +sym.newSymbolProp; + +//// [symbolType16.js] +var sym; +sym.newSymbolProp; diff --git a/tests/baselines/reference/symbolType16.types b/tests/baselines/reference/symbolType16.types new file mode 100644 index 00000000000..91fdc9978da --- /dev/null +++ b/tests/baselines/reference/symbolType16.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/Symbols/symbolType16.ts === +interface Symbol { +>Symbol : Symbol + + newSymbolProp: number; +>newSymbolProp : number +} + +var sym: symbol; +>sym : symbol + +sym.newSymbolProp; +>sym.newSymbolProp : number +>sym : symbol +>newSymbolProp : number + diff --git a/tests/baselines/reference/symbolType17.js b/tests/baselines/reference/symbolType17.js new file mode 100644 index 00000000000..a00d2cb36f7 --- /dev/null +++ b/tests/baselines/reference/symbolType17.js @@ -0,0 +1,21 @@ +//// [symbolType17.ts] +interface Foo { prop } +var x: symbol | Foo; + +x; +if (typeof x === "symbol") { + x; +} +else { + x; +} + +//// [symbolType17.js] +var x; +x; +if (typeof x === "symbol") { + x; +} +else { + x; +} diff --git a/tests/baselines/reference/symbolType17.types b/tests/baselines/reference/symbolType17.types new file mode 100644 index 00000000000..b86d5a70ff7 --- /dev/null +++ b/tests/baselines/reference/symbolType17.types @@ -0,0 +1,24 @@ +=== tests/cases/conformance/es6/Symbols/symbolType17.ts === +interface Foo { prop } +>Foo : Foo +>prop : any + +var x: symbol | Foo; +>x : symbol | Foo +>Foo : Foo + +x; +>x : symbol | Foo + +if (typeof x === "symbol") { +>typeof x === "symbol" : boolean +>typeof x : string +>x : symbol | Foo + + x; +>x : symbol +} +else { + x; +>x : Foo +} diff --git a/tests/baselines/reference/symbolType18.js b/tests/baselines/reference/symbolType18.js new file mode 100644 index 00000000000..f8a784d2500 --- /dev/null +++ b/tests/baselines/reference/symbolType18.js @@ -0,0 +1,21 @@ +//// [symbolType18.ts] +interface Foo { prop } +var x: symbol | Foo; + +x; +if (typeof x === "object") { + x; +} +else { + x; +} + +//// [symbolType18.js] +var x; +x; +if (typeof x === "object") { + x; +} +else { + x; +} diff --git a/tests/baselines/reference/symbolType18.types b/tests/baselines/reference/symbolType18.types new file mode 100644 index 00000000000..1693c6e2499 --- /dev/null +++ b/tests/baselines/reference/symbolType18.types @@ -0,0 +1,24 @@ +=== tests/cases/conformance/es6/Symbols/symbolType18.ts === +interface Foo { prop } +>Foo : Foo +>prop : any + +var x: symbol | Foo; +>x : symbol | Foo +>Foo : Foo + +x; +>x : symbol | Foo + +if (typeof x === "object") { +>typeof x === "object" : boolean +>typeof x : string +>x : symbol | Foo + + x; +>x : Foo +} +else { + x; +>x : symbol | Foo +} diff --git a/tests/baselines/reference/symbolType19.js b/tests/baselines/reference/symbolType19.js new file mode 100644 index 00000000000..f3ba0e12472 --- /dev/null +++ b/tests/baselines/reference/symbolType19.js @@ -0,0 +1,24 @@ +//// [symbolType19.ts] +enum E { } +var x: symbol | E; + +x; +if (typeof x === "number") { + x; +} +else { + x; +} + +//// [symbolType19.js] +var E; +(function (E) { +})(E || (E = {})); +var x; +x; +if (typeof x === "number") { + x; +} +else { + x; +} diff --git a/tests/baselines/reference/symbolType19.types b/tests/baselines/reference/symbolType19.types new file mode 100644 index 00000000000..d01fbfa87fe --- /dev/null +++ b/tests/baselines/reference/symbolType19.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/es6/Symbols/symbolType19.ts === +enum E { } +>E : E + +var x: symbol | E; +>x : symbol | E +>E : E + +x; +>x : symbol | E + +if (typeof x === "number") { +>typeof x === "number" : boolean +>typeof x : string +>x : symbol | E + + x; +>x : E +} +else { + x; +>x : symbol +} diff --git a/tests/baselines/reference/symbolType2.errors.txt b/tests/baselines/reference/symbolType2.errors.txt new file mode 100644 index 00000000000..441db917718 --- /dev/null +++ b/tests/baselines/reference/symbolType2.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/es6/Symbols/symbolType2.ts(2,7): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter + + +==== tests/cases/conformance/es6/Symbols/symbolType2.ts (1 errors) ==== + Symbol.isConcatSpreadable in {}; + "" in Symbol.toPrimitive; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter \ No newline at end of file diff --git a/tests/baselines/reference/symbolType2.js b/tests/baselines/reference/symbolType2.js new file mode 100644 index 00000000000..e15e4da626e --- /dev/null +++ b/tests/baselines/reference/symbolType2.js @@ -0,0 +1,7 @@ +//// [symbolType2.ts] +Symbol.isConcatSpreadable in {}; +"" in Symbol.toPrimitive; + +//// [symbolType2.js] +Symbol.isConcatSpreadable in {}; +"" in Symbol.toPrimitive; diff --git a/tests/baselines/reference/symbolType20.errors.txt b/tests/baselines/reference/symbolType20.errors.txt new file mode 100644 index 00000000000..41345e371f8 --- /dev/null +++ b/tests/baselines/reference/symbolType20.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/Symbols/symbolType20.ts(1,11): error TS2427: Interface name cannot be 'symbol' + + +==== tests/cases/conformance/es6/Symbols/symbolType20.ts (1 errors) ==== + interface symbol { } + ~~~~~~ +!!! error TS2427: Interface name cannot be 'symbol' \ No newline at end of file diff --git a/tests/baselines/reference/symbolType20.js b/tests/baselines/reference/symbolType20.js new file mode 100644 index 00000000000..cf80d0d30ac --- /dev/null +++ b/tests/baselines/reference/symbolType20.js @@ -0,0 +1,4 @@ +//// [symbolType20.ts] +interface symbol { } + +//// [symbolType20.js] diff --git a/tests/baselines/reference/symbolType3.errors.txt b/tests/baselines/reference/symbolType3.errors.txt new file mode 100644 index 00000000000..7cc9e82b3b3 --- /dev/null +++ b/tests/baselines/reference/symbolType3.errors.txt @@ -0,0 +1,33 @@ +tests/cases/conformance/es6/Symbols/symbolType3.ts(5,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType3.ts(6,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType3.ts(7,3): error TS2469: The '+' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType3.ts(8,3): error TS2469: The '-' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType3.ts(9,3): error TS2469: The '~' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType3.ts(12,2): error TS2469: The '+' operator cannot be applied to type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType3.ts (6 errors) ==== + var s = Symbol(); + delete Symbol.iterator; + void Symbol.toPrimitive; + typeof Symbol.toStringTag; + ++s; + ~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + --s; + ~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + + Symbol(); + ~~~~~~~~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. + - Symbol(); + ~~~~~~~~ +!!! error TS2469: The '-' operator cannot be applied to type 'symbol'. + ~ Symbol(); + ~~~~~~~~ +!!! error TS2469: The '~' operator cannot be applied to type 'symbol'. + ! Symbol(); + + +(Symbol() || 0); + ~~~~~~~~~~~~~~~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType3.js b/tests/baselines/reference/symbolType3.js new file mode 100644 index 00000000000..4f599dacbe0 --- /dev/null +++ b/tests/baselines/reference/symbolType3.js @@ -0,0 +1,26 @@ +//// [symbolType3.ts] +var s = Symbol(); +delete Symbol.iterator; +void Symbol.toPrimitive; +typeof Symbol.toStringTag; +++s; +--s; ++ Symbol(); +- Symbol(); +~ Symbol(); +! Symbol(); + ++(Symbol() || 0); + +//// [symbolType3.js] +var s = Symbol(); +delete Symbol.iterator; +void Symbol.toPrimitive; +typeof Symbol.toStringTag; +++s; +--s; ++Symbol(); +-Symbol(); +~Symbol(); +!Symbol(); ++(Symbol() || 0); diff --git a/tests/baselines/reference/symbolType4.errors.txt b/tests/baselines/reference/symbolType4.errors.txt new file mode 100644 index 00000000000..210fe94b8d7 --- /dev/null +++ b/tests/baselines/reference/symbolType4.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/es6/Symbols/symbolType4.ts(2,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType4.ts(3,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/es6/Symbols/symbolType4.ts (2 errors) ==== + var s = Symbol.for("postfix"); + s++; + ~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + s--; + ~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType4.js b/tests/baselines/reference/symbolType4.js new file mode 100644 index 00000000000..321de5a3bf9 --- /dev/null +++ b/tests/baselines/reference/symbolType4.js @@ -0,0 +1,9 @@ +//// [symbolType4.ts] +var s = Symbol.for("postfix"); +s++; +s--; + +//// [symbolType4.js] +var s = Symbol.for("postfix"); +s++; +s--; diff --git a/tests/baselines/reference/symbolType5.errors.txt b/tests/baselines/reference/symbolType5.errors.txt new file mode 100644 index 00000000000..af70aad0f26 --- /dev/null +++ b/tests/baselines/reference/symbolType5.errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/es6/Symbols/symbolType5.ts(2,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(2,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(3,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(3,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(4,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(4,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(7,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/es6/Symbols/symbolType5.ts (8 errors) ==== + var s = Symbol.for("multiply"); + s * s; + ~ +!!! 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. + s / s; + ~ +!!! 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. + s % s; + ~ +!!! 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. + + s * 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + 0 / s; + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType5.js b/tests/baselines/reference/symbolType5.js new file mode 100644 index 00000000000..ce76e034bd9 --- /dev/null +++ b/tests/baselines/reference/symbolType5.js @@ -0,0 +1,16 @@ +//// [symbolType5.ts] +var s = Symbol.for("multiply"); +s * s; +s / s; +s % s; + +s * 0; +0 / s; + +//// [symbolType5.js] +var s = Symbol.for("multiply"); +s * s; +s / s; +s % s; +s * 0; +0 / s; diff --git a/tests/baselines/reference/symbolType6.errors.txt b/tests/baselines/reference/symbolType6.errors.txt new file mode 100644 index 00000000000..29d894c2afb --- /dev/null +++ b/tests/baselines/reference/symbolType6.errors.txt @@ -0,0 +1,57 @@ +tests/cases/conformance/es6/Symbols/symbolType6.ts(3,1): error TS2365: Operator '+' cannot be applied to types 'symbol' and 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(4,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType6.ts(4,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType6.ts(5,1): error TS2469: The '+' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(6,1): error TS2469: The '+' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(7,1): error TS2365: Operator '+' cannot be applied to types 'symbol' and 'number'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(8,6): error TS2469: The '+' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(9,5): error TS2469: The '+' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(10,1): error TS2365: Operator '+' cannot be applied to types 'number' and 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(11,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType6.ts(12,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType6.ts(14,1): error TS2469: The '+' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(15,6): error TS2469: The '+' operator cannot be applied to type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType6.ts (13 errors) ==== + var s = Symbol.for("add"); + var a: any; + s + s; + ~~~~~ +!!! error TS2365: Operator '+' cannot be applied to types 'symbol' and 'symbol'. + s - s; + ~ +!!! 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. + s + ""; + ~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. + s + a; + ~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. + s + 0; + ~~~~~ +!!! error TS2365: Operator '+' cannot be applied to types 'symbol' and 'number'. + "" + s; + ~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. + a + s; + ~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. + 0 + s; + ~~~~~ +!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'symbol'. + s - 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + 0 - s; + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + (s || "") + ""; + ~~~~~~~~~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. + "" + (s || ""); + ~~~~~~~~~ +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType6.js b/tests/baselines/reference/symbolType6.js new file mode 100644 index 00000000000..b316f48cf03 --- /dev/null +++ b/tests/baselines/reference/symbolType6.js @@ -0,0 +1,32 @@ +//// [symbolType6.ts] +var s = Symbol.for("add"); +var a: any; +s + s; +s - s; +s + ""; +s + a; +s + 0; +"" + s; +a + s; +0 + s; +s - 0; +0 - s; + +(s || "") + ""; +"" + (s || ""); + +//// [symbolType6.js] +var s = Symbol.for("add"); +var a; +s + s; +s - s; +s + ""; +s + a; +s + 0; +"" + s; +a + s; +0 + s; +s - 0; +0 - s; +(s || "") + ""; +"" + (s || ""); diff --git a/tests/baselines/reference/symbolType7.errors.txt b/tests/baselines/reference/symbolType7.errors.txt new file mode 100644 index 00000000000..80ecd2486ff --- /dev/null +++ b/tests/baselines/reference/symbolType7.errors.txt @@ -0,0 +1,37 @@ +tests/cases/conformance/es6/Symbols/symbolType7.ts(2,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(2,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(3,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(4,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(4,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(5,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(6,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(7,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/es6/Symbols/symbolType7.ts (9 errors) ==== + var s = Symbol.for("shift"); + s << s; + ~ +!!! 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. + s << 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >> s; + ~ +!!! 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. + s >> 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >>> s; + ~ +!!! 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. + s >>> 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType7.js b/tests/baselines/reference/symbolType7.js new file mode 100644 index 00000000000..47ace567a3d --- /dev/null +++ b/tests/baselines/reference/symbolType7.js @@ -0,0 +1,17 @@ +//// [symbolType7.ts] +var s = Symbol.for("shift"); +s << s; +s << 0; +s >> s; +s >> 0; +s >>> s; +s >>> 0; + +//// [symbolType7.js] +var s = Symbol.for("shift"); +s << s; +s << 0; +s >> s; +s >> 0; +s >>> s; +s >>> 0; diff --git a/tests/baselines/reference/symbolType8.errors.txt b/tests/baselines/reference/symbolType8.errors.txt new file mode 100644 index 00000000000..8df7db61feb --- /dev/null +++ b/tests/baselines/reference/symbolType8.errors.txt @@ -0,0 +1,45 @@ +tests/cases/conformance/es6/Symbols/symbolType8.ts(2,1): error TS2469: The '<' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(3,1): error TS2469: The '<' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(4,1): error TS2469: The '>' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(5,1): error TS2469: The '>' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(6,1): error TS2469: The '<=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(7,1): error TS2469: The '<=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(8,1): error TS2469: The '>=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(9,1): error TS2469: The '>=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(11,6): error TS2469: The '>=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(12,1): error TS2469: The '>=' operator cannot be applied to type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType8.ts (10 errors) ==== + var s = Symbol.for("compare"); + s < s; + ~ +!!! error TS2469: The '<' operator cannot be applied to type 'symbol'. + s < 0; + ~ +!!! error TS2469: The '<' operator cannot be applied to type 'symbol'. + s > s; + ~ +!!! error TS2469: The '>' operator cannot be applied to type 'symbol'. + s > 0; + ~ +!!! error TS2469: The '>' operator cannot be applied to type 'symbol'. + s <= s; + ~ +!!! error TS2469: The '<=' operator cannot be applied to type 'symbol'. + s <= 0; + ~ +!!! error TS2469: The '<=' operator cannot be applied to type 'symbol'. + s >= s; + ~ +!!! error TS2469: The '>=' operator cannot be applied to type 'symbol'. + s >= 0; + ~ +!!! error TS2469: The '>=' operator cannot be applied to type 'symbol'. + + 0 >= (s || 0); + ~~~~~~~~ +!!! error TS2469: The '>=' operator cannot be applied to type 'symbol'. + (s || 0) >= s; + ~~~~~~~~ +!!! error TS2469: The '>=' operator cannot be applied to type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType8.js b/tests/baselines/reference/symbolType8.js new file mode 100644 index 00000000000..7e56416ca84 --- /dev/null +++ b/tests/baselines/reference/symbolType8.js @@ -0,0 +1,26 @@ +//// [symbolType8.ts] +var s = Symbol.for("compare"); +s < s; +s < 0; +s > s; +s > 0; +s <= s; +s <= 0; +s >= s; +s >= 0; + +0 >= (s || 0); +(s || 0) >= s; + +//// [symbolType8.js] +var s = Symbol.for("compare"); +s < s; +s < 0; +s > s; +s > 0; +s <= s; +s <= 0; +s >= s; +s >= 0; +0 >= (s || 0); +(s || 0) >= s; diff --git a/tests/baselines/reference/symbolType9.errors.txt b/tests/baselines/reference/symbolType9.errors.txt new file mode 100644 index 00000000000..5506fdc6f9d --- /dev/null +++ b/tests/baselines/reference/symbolType9.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/es6/Symbols/symbolType9.ts(3,1): error TS2365: Operator '==' cannot be applied to types 'symbol' and 'boolean'. +tests/cases/conformance/es6/Symbols/symbolType9.ts(5,1): error TS2365: Operator '!=' cannot be applied to types 'number' and 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType9.ts(7,1): error TS2365: Operator '===' cannot be applied to types 'symbol' and 'number'. +tests/cases/conformance/es6/Symbols/symbolType9.ts(9,1): error TS2365: Operator '!==' cannot be applied to types 'boolean' and 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType9.ts (4 errors) ==== + var s = Symbol.for("equal"); + s == s; + s == true; + ~~~~~~~~~ +!!! error TS2365: Operator '==' cannot be applied to types 'symbol' and 'boolean'. + s != s; + 0 != s; + ~~~~~~ +!!! error TS2365: Operator '!=' cannot be applied to types 'number' and 'symbol'. + s === s; + s === 1; + ~~~~~~~ +!!! error TS2365: Operator '===' cannot be applied to types 'symbol' and 'number'. + s !== s; + false !== s; + ~~~~~~~~~~~ +!!! error TS2365: Operator '!==' cannot be applied to types 'boolean' and 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType9.js b/tests/baselines/reference/symbolType9.js new file mode 100644 index 00000000000..c9b0c801cc8 --- /dev/null +++ b/tests/baselines/reference/symbolType9.js @@ -0,0 +1,21 @@ +//// [symbolType9.ts] +var s = Symbol.for("equal"); +s == s; +s == true; +s != s; +0 != s; +s === s; +s === 1; +s !== s; +false !== s; + +//// [symbolType9.js] +var s = Symbol.for("equal"); +s == s; +s == true; +s != s; +0 != s; +s === s; +s === 1; +s !== s; +false !== s; diff --git a/tests/baselines/reference/taggedTemplateContextualTyping1.js b/tests/baselines/reference/taggedTemplateContextualTyping1.js index 173d0f56bb7..17618b50e8b 100644 --- a/tests/baselines/reference/taggedTemplateContextualTyping1.js +++ b/tests/baselines/reference/taggedTemplateContextualTyping1.js @@ -26,28 +26,7 @@ function tempTag1(...rest) { // Otherwise, the arrow functions' parameters will be typed as 'any', // and it is an error to invoke an any-typed value with type arguments, // so this test will error. -tempTag1 `${x => { - x(undefined); - return x; -}}${10}`; -tempTag1 `${x => { - x(undefined); - return x; -}}${y => { - y(undefined); - return y; -}}${10}`; -tempTag1 `${x => { - x(undefined); - return x; -}}${(y) => { - y(undefined); - return y; -}}${undefined}`; -tempTag1 `${(x) => { - x(undefined); - return x; -}}${y => { - y(undefined); - return y; -}}${undefined}`; +tempTag1 `${x => { x(undefined); return x; }}${10}`; +tempTag1 `${x => { x(undefined); return x; }}${y => { y(undefined); return y; }}${10}`; +tempTag1 `${x => { x(undefined); return x; }}${(y) => { y(undefined); return y; }}${undefined}`; +tempTag1 `${(x) => { x(undefined); return x; }}${y => { y(undefined); return y; }}${undefined}`; diff --git a/tests/baselines/reference/taggedTemplateContextualTyping2.js b/tests/baselines/reference/taggedTemplateContextualTyping2.js index 1eed600da4c..8adea53f470 100644 --- a/tests/baselines/reference/taggedTemplateContextualTyping2.js +++ b/tests/baselines/reference/taggedTemplateContextualTyping2.js @@ -25,18 +25,6 @@ function tempTag2(...rest) { // Otherwise, the arrow functions' parameters will be typed as 'any', // and it is an error to invoke an any-typed value with type arguments, // so this test will error. -tempTag2 `${x => { - x(undefined); - return x; -}}${0}`; -tempTag2 `${x => { - x(undefined); - return x; -}}${y => { - y(null); - return y; -}}${"hello"}`; -tempTag2 `${x => { - x(undefined); - return x; -}}${undefined}${"hello"}`; +tempTag2 `${x => { x(undefined); return x; }}${0}`; +tempTag2 `${x => { x(undefined); return x; }}${y => { y(null); return y; }}${"hello"}`; +tempTag2 `${x => { x(undefined); return x; }}${undefined}${"hello"}`; diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js index 14a7015f803..bbcd6637964 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js @@ -136,9 +136,7 @@ someGenerics7 "" + function (n) { return n; } + function (n) { return n; } + fun someGenerics7 "" + function (n) { return n; } + function (n) { return n; } + function (n) { return n; }; someGenerics7 "" + function (n) { return n; } + function (n) { return n; } + function (n) { return n; }; // Generic tag with argument of generic function type -function someGenerics8(strs, n) { - return n; -} +function someGenerics8(strs, n) { return n; } var x = someGenerics8 "" + someGenerics7; x "" + null + null + null; // Generic tag with multiple parameters of generic type passed arguments with no best common type diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.js b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.js index 25203c40d91..3f1817c6419 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.js +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.js @@ -135,9 +135,7 @@ someGenerics7 `${n => { return n; }}${n => { return n; }}${n => { return n; }}`; someGenerics7 `${n => { return n; }}${n => { return n; }}${n => { return n; }}`; someGenerics7 `${(n) => { return n; }}${(n) => { return n; }}${(n) => { return n; }}`; // Generic tag with argument of generic function type -function someGenerics8(strs, n) { - return n; -} +function someGenerics8(strs, n) { return n; } var x = someGenerics8 `${someGenerics7}`; x `${null}${null}${null}`; // Generic tag with multiple parameters of generic type passed arguments with no best common type diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js index a28e0103a7e..c6abf11419a 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js @@ -74,15 +74,11 @@ fn5 `${ (n) => n.substr(0) }`; //// [taggedTemplateStringsWithOverloadResolution3.js] -function fn1() { - return null; -} +function fn1() { return null; } var s = fn1 "" + undefined; // No candidate overloads found fn1 "" + {}; // Error -function fn2() { - return undefined; -} +function fn2() { return undefined; } var d1 = fn2 "" + 0 + undefined; // contextually typed var d2 = fn2 "" + 0 + undefined; // any d1.foo(); // error @@ -91,9 +87,7 @@ d2(); // no error (typed as any) fn2 "" + 0 + ''; // OK // Generic and non-generic overload where non-generic overload is the only candidate fn2 "" + '' + 0; // OK -function fn3() { - return null; -} +function fn3() { return null; } var s = fn3 "" + 3; var s = fn3 "" + '' + 3 + ''; var n = fn3 "" + 5 + 5 + 5; @@ -115,8 +109,6 @@ fn4 "" + null + null; // Error // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints fn4 "" + true + null; fn4 "" + null + true; -function fn5() { - return undefined; -} +function fn5() { return undefined; } fn5 "" + function (n) { return n.toFixed(); }; // will error; 'n' should have type 'string'. fn5 "" + function (n) { return n.substr(0); }; diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.js b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.js index 75a01df6af6..8bcc426627d 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.js +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.js @@ -73,15 +73,11 @@ fn5 `${ (n) => n.substr(0) }`; //// [taggedTemplateStringsWithOverloadResolution3_ES6.js] -function fn1() { - return null; -} +function fn1() { return null; } var s = fn1 `${undefined}`; // No candidate overloads found fn1 `${{}}`; // Error -function fn2() { - return undefined; -} +function fn2() { return undefined; } var d1 = fn2 `${0}${undefined}`; // contextually typed var d2 = fn2 `${0}${undefined}`; // any d1.foo(); // error @@ -90,9 +86,7 @@ d2(); // no error (typed as any) fn2 `${0}${''}`; // OK // Generic and non-generic overload where non-generic overload is the only candidate fn2 `${''}${0}`; // OK -function fn3() { - return null; -} +function fn3() { return null; } var s = fn3 `${3}`; var s = fn3 `${''}${3}${''}`; var n = fn3 `${5}${5}${5}`; @@ -114,8 +108,6 @@ fn4 `${null}${null}`; // Error // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints fn4 `${true}${null}`; fn4 `${null}${true}`; -function fn5() { - return undefined; -} +function fn5() { return undefined; } fn5 `${(n) => { return n.toFixed(); }}`; // will error; 'n' should have type 'string'. fn5 `${(n) => { return n.substr(0); }}`; diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js index eb46f4b603f..a4dd1619642 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js +++ b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js @@ -13,6 +13,4 @@ function foo() { rest[_i - 0] = arguments[_i]; } } -foo "" + function (x) { - x = "bad"; -}; +foo "" + function (x) { x = "bad"; }; diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js index bc18a600458..7691b83b3bc 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js +++ b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js @@ -8,6 +8,4 @@ foo `${function (x: number) { x = "bad"; } }`; //// [taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js] function foo(...rest) { } -foo `${function (x) { - x = "bad"; -}}`; +foo `${function (x) { x = "bad"; }}`; diff --git a/tests/baselines/reference/targetTypeArgs.js b/tests/baselines/reference/targetTypeArgs.js index 1a05a6d6f31..18dff375abe 100644 --- a/tests/baselines/reference/targetTypeArgs.js +++ b/tests/baselines/reference/targetTypeArgs.js @@ -18,24 +18,10 @@ foo(function(x) { x }); function foo(callback) { callback("hello"); } -foo(function (x) { - x; -}); -[1].forEach(function (v, i, a) { - v; -}); -["hello"].every(function (v, i, a) { - return true; -}); -[1].every(function (v, i, a) { - return true; -}); -[1].every(function (v, i, a) { - return true; -}); -["s"].every(function (v, i, a) { - return true; -}); -["s"].forEach(function (v, i, a) { - v; -}); +foo(function (x) { x; }); +[1].forEach(function (v, i, a) { v; }); +["hello"].every(function (v, i, a) { return true; }); +[1].every(function (v, i, a) { return true; }); +[1].every(function (v, i, a) { return true; }); +["s"].every(function (v, i, a) { return true; }); +["s"].forEach(function (v, i, a) { v; }); diff --git a/tests/baselines/reference/targetTypeBaseCalls.js b/tests/baselines/reference/targetTypeBaseCalls.js index b09d4960d01..c886183bacf 100644 --- a/tests/baselines/reference/targetTypeBaseCalls.js +++ b/tests/baselines/reference/targetTypeBaseCalls.js @@ -31,18 +31,12 @@ var Foo = (function () { } return Foo; })(); -foo(function (s) { - s = 5; -}); // Error, can’t assign number to string -new Foo(function (s) { - s = 5; -}); // error, if types are applied correctly +foo(function (s) { s = 5; }); // Error, can’t assign number to string +new Foo(function (s) { s = 5; }); // error, if types are applied correctly var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - _super.call(this, function (s) { - s = 5; - }); + _super.call(this, function (s) { s = 5; }); } return Bar; })(Foo); // error, if types are applied correctly diff --git a/tests/baselines/reference/targetTypeCalls.js b/tests/baselines/reference/targetTypeCalls.js index 302419a2693..168195216ca 100644 --- a/tests/baselines/reference/targetTypeCalls.js +++ b/tests/baselines/reference/targetTypeCalls.js @@ -6,27 +6,7 @@ var fra3: (v:any)=>string = function() { return function() { return function(v) var fra4: (v:any)=>void = function() { return function() { return function(v) {return v;};}(); }() // should work //// [targetTypeCalls.js] -var fra1 = function () { - return function (v) { - return v; - }; -}(); // should work -var fra2 = function () { - return function () { - return 0; - }; -}(); // should work -var fra3 = function () { - return function () { - return function (v) { - return v; - }; - }(); -}(); // should work -var fra4 = function () { - return function () { - return function (v) { - return v; - }; - }(); -}(); // should work +var fra1 = function () { return function (v) { return v; }; }(); // should work +var fra2 = function () { return function () { return 0; }; }(); // should work +var fra3 = function () { return function () { return function (v) { return v; }; }(); }(); // should work +var fra4 = function () { return function () { return function (v) { return v; }; }(); }(); // should work diff --git a/tests/baselines/reference/targetTypeCastTest.js b/tests/baselines/reference/targetTypeCastTest.js index c9a30c6d685..053aced7305 100644 --- a/tests/baselines/reference/targetTypeCastTest.js +++ b/tests/baselines/reference/targetTypeCastTest.js @@ -28,12 +28,8 @@ function Point(x, y) { this.x = x; this.y = y; } -var add = function (x, y) { - return x + y; -}; +var add = function (x, y) { return x + y; }; var add2 = function (x, y) { return 0; }; -function add3(x, y) { - x; -} +function add3(x, y) { x; } diff --git a/tests/baselines/reference/targetTypeTest1.js b/tests/baselines/reference/targetTypeTest1.js index 94af7579fbb..8f9657ee9d0 100644 --- a/tests/baselines/reference/targetTypeTest1.js +++ b/tests/baselines/reference/targetTypeTest1.js @@ -80,9 +80,7 @@ function Point(x, y) { this.x = x; this.y = y; } -function EF1(a, b) { - return a + b; -} +function EF1(a, b) { return a + b; } var x = EF1(1, 2); // Point.origin declared as type Point Point.origin = new Point(0, 0); @@ -110,6 +108,10 @@ function C(a, b) { this.a = a; this.b = b; } -C.prototype = { a: 0, b: 0, C1M1: function (c, d) { - return (this.a + c) + (this.b + d); -} }; +C.prototype = + { a: 0, + b: 0, + C1M1: function (c, d) { + return (this.a + c) + (this.b + d); + } + }; diff --git a/tests/baselines/reference/targetTypeTest2.js b/tests/baselines/reference/targetTypeTest2.js index c6f940572ef..0ba82bc9cce 100644 --- a/tests/baselines/reference/targetTypeTest2.js +++ b/tests/baselines/reference/targetTypeTest2.js @@ -14,9 +14,7 @@ function func2(stuff1:string, stuff2:number, stuff3:number) { //// [targetTypeTest2.js] // Test target typing for array literals and call expressions var a = [1, 2, "3"]; -function func1(stuff) { - return stuff; -} +function func1(stuff) { return stuff; } function func2(stuff1, stuff2, stuff3) { return func1([stuff1, stuff2, stuff3]); } diff --git a/tests/baselines/reference/targetTypeTest3.js b/tests/baselines/reference/targetTypeTest3.js index 53e5691ab49..13972478582 100644 --- a/tests/baselines/reference/targetTypeTest3.js +++ b/tests/baselines/reference/targetTypeTest3.js @@ -14,9 +14,7 @@ function func2(stuff1:string, stuff2:number, stuff3:number) { //// [targetTypeTest3.js] // Test target typing for array literals and call expressions var a = [1, 2, "3"]; // should produce an error -function func1(stuff) { - return stuff; -} +function func1(stuff) { return stuff; } function func2(stuff1, stuff2, stuff3) { return func1([stuff1, stuff2, stuff3]); } diff --git a/tests/baselines/reference/targetTypeVoidFunc.js b/tests/baselines/reference/targetTypeVoidFunc.js index 9913b4bd491..dba2086b0e1 100644 --- a/tests/baselines/reference/targetTypeVoidFunc.js +++ b/tests/baselines/reference/targetTypeVoidFunc.js @@ -9,9 +9,7 @@ var z = new (f1())(); //// [targetTypeVoidFunc.js] function f1() { - return function () { - return; - }; + return function () { return; }; } ; var x = f1(); diff --git a/tests/baselines/reference/targetTypingOnFunctions.js b/tests/baselines/reference/targetTypingOnFunctions.js index 5b11a34ff4d..fad75a4bf6d 100644 --- a/tests/baselines/reference/targetTypingOnFunctions.js +++ b/tests/baselines/reference/targetTypingOnFunctions.js @@ -4,9 +4,5 @@ var fu: (s: string) => string = function (s) { return s.toLowerCase() }; var zu = fu = function (s) { return s.toLowerCase() }; //// [targetTypingOnFunctions.js] -var fu = function (s) { - return s.toLowerCase(); -}; -var zu = fu = function (s) { - return s.toLowerCase(); -}; +var fu = function (s) { return s.toLowerCase(); }; +var zu = fu = function (s) { return s.toLowerCase(); }; diff --git a/tests/baselines/reference/templateStringInEqualityChecks.js b/tests/baselines/reference/templateStringInEqualityChecks.js index 54f5fa610c2..ca9fc2ed80b 100644 --- a/tests/baselines/reference/templateStringInEqualityChecks.js +++ b/tests/baselines/reference/templateStringInEqualityChecks.js @@ -5,4 +5,7 @@ var x = `abc${0}abc` === `abc` || "abc0abc" !== `abc${0}abc`; //// [templateStringInEqualityChecks.js] -var x = "abc" + 0 + "abc" === "abc" || "abc" !== "abc" + 0 + "abc" && "abc" + 0 + "abc" == "abc0abc" && "abc0abc" !== "abc" + 0 + "abc"; +var x = "abc" + 0 + "abc" === "abc" || + "abc" !== "abc" + 0 + "abc" && + "abc" + 0 + "abc" == "abc0abc" && + "abc0abc" !== "abc" + 0 + "abc"; diff --git a/tests/baselines/reference/templateStringInEqualityChecksES6.js b/tests/baselines/reference/templateStringInEqualityChecksES6.js index 317db1ab366..db00827fac5 100644 --- a/tests/baselines/reference/templateStringInEqualityChecksES6.js +++ b/tests/baselines/reference/templateStringInEqualityChecksES6.js @@ -5,4 +5,7 @@ var x = `abc${0}abc` === `abc` || "abc0abc" !== `abc${0}abc`; //// [templateStringInEqualityChecksES6.js] -var x = `abc${0}abc` === `abc` || `abc` !== `abc${0}abc` && `abc${0}abc` == "abc0abc" && "abc0abc" !== `abc${0}abc`; +var x = `abc${0}abc` === `abc` || + `abc` !== `abc${0}abc` && + `abc${0}abc` == "abc0abc" && + "abc0abc" !== `abc${0}abc`; diff --git a/tests/baselines/reference/templateStringInObjectLiteral.js b/tests/baselines/reference/templateStringInObjectLiteral.js index b026aedf4d3..6df5a64d78a 100644 --- a/tests/baselines/reference/templateStringInObjectLiteral.js +++ b/tests/baselines/reference/templateStringInObjectLiteral.js @@ -6,6 +6,5 @@ var x = { //// [templateStringInObjectLiteral.js] var x = { - a: "abc" + 123 + "def" -} "b"; + a: "abc" + 123 + "def" } "b"; 321; diff --git a/tests/baselines/reference/templateStringInObjectLiteralES6.js b/tests/baselines/reference/templateStringInObjectLiteralES6.js index 22144e75247..7de012185a9 100644 --- a/tests/baselines/reference/templateStringInObjectLiteralES6.js +++ b/tests/baselines/reference/templateStringInObjectLiteralES6.js @@ -6,6 +6,5 @@ var x = { //// [templateStringInObjectLiteralES6.js] var x = { - a: `abc${123}def`, -} `b`; + a: `abc${123}def`, } `b`; 321; diff --git a/tests/baselines/reference/templateStringWithEmbeddedFunctionExpression.js b/tests/baselines/reference/templateStringWithEmbeddedFunctionExpression.js index 3447ff87ac3..88a8349d1a4 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedFunctionExpression.js +++ b/tests/baselines/reference/templateStringWithEmbeddedFunctionExpression.js @@ -2,6 +2,4 @@ var x = `abc${ function y() { return y; } }def`; //// [templateStringWithEmbeddedFunctionExpression.js] -var x = "abc" + function y() { - return y; -} + "def"; +var x = "abc" + function y() { return y; } + "def"; diff --git a/tests/baselines/reference/templateStringWithEmbeddedFunctionExpressionES6.js b/tests/baselines/reference/templateStringWithEmbeddedFunctionExpressionES6.js index 46e37c0ac18..f0e2f749cfd 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedFunctionExpressionES6.js +++ b/tests/baselines/reference/templateStringWithEmbeddedFunctionExpressionES6.js @@ -2,6 +2,4 @@ var x = `abc${ function y() { return y; } }def`; //// [templateStringWithEmbeddedFunctionExpressionES6.js] -var x = `abc${function y() { - return y; -}}def`; +var x = `abc${function y() { return y; }}def`; diff --git a/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js b/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js index ef113312060..72d0fd8c8db 100644 --- a/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js +++ b/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js @@ -4,6 +4,4 @@ `${function (x: number) { x = "bad"; } }`; //// [templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js] -"" + function (x) { - x = "bad"; -}; +"" + function (x) { x = "bad"; }; diff --git a/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js b/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js index 9ce47348dc1..18fae66c78a 100644 --- a/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js +++ b/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js @@ -3,6 +3,4 @@ `${function (x: number) { x = "bad"; } }`; //// [templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js] -`${function (x) { - x = "bad"; -}}`; +`${function (x) { x = "bad"; }}`; diff --git a/tests/baselines/reference/thisBinding2.js b/tests/baselines/reference/thisBinding2.js index ced47c0bc7b..76b99797e16 100644 --- a/tests/baselines/reference/thisBinding2.js +++ b/tests/baselines/reference/thisBinding2.js @@ -40,8 +40,6 @@ var messenger = { message: "Hello World", start: function () { var _this = this; - return setTimeout(function () { - var x = _this.message; - }, 3000); + return setTimeout(function () { var x = _this.message; }, 3000); } }; diff --git a/tests/baselines/reference/thisExpressionInCallExpressionWithTypeArguments.js b/tests/baselines/reference/thisExpressionInCallExpressionWithTypeArguments.js index fb917edf753..78b06d30dd2 100644 --- a/tests/baselines/reference/thisExpressionInCallExpressionWithTypeArguments.js +++ b/tests/baselines/reference/thisExpressionInCallExpressionWithTypeArguments.js @@ -10,9 +10,7 @@ var C = (function () { } C.prototype.foo = function () { var _this = this; - [1, 2, 3].map(function (x) { - return _this; - }); + [1, 2, 3].map(function (x) { return _this; }); }; return C; })(); diff --git a/tests/baselines/reference/thisInPropertyBoundDeclarations.js b/tests/baselines/reference/thisInPropertyBoundDeclarations.js index 36ee45b1110..3f1bac98075 100644 --- a/tests/baselines/reference/thisInPropertyBoundDeclarations.js +++ b/tests/baselines/reference/thisInPropertyBoundDeclarations.js @@ -100,15 +100,11 @@ var A = (function () { } }; this.prop4 = { - a: function () { - return this; - } + a: function () { return this; } }; this.prop5 = function () { return { - a: function () { - return this; - } + a: function () { return this; } }; }; } @@ -120,18 +116,17 @@ var B = (function () { this.prop1 = this; this.prop2 = function () { return _this; }; this.prop3 = function () { return function () { return function () { return function () { return _this; }; }; }; }; - this.prop4 = ' ' + function () { - } + ' ' + (function () { return function () { return function () { return _this; }; }; }); + this.prop4 = ' ' + + function () { + } + + ' ' + + (function () { return function () { return function () { return _this; }; }; }); this.prop5 = { - a: function () { - return _this; - } + a: function () { return _this; } }; this.prop6 = function () { return { - a: function () { - return _this; - } + a: function () { return _this; } }; }; } diff --git a/tests/baselines/reference/thisReferencedInFunctionInsideArrowFunction1.js b/tests/baselines/reference/thisReferencedInFunctionInsideArrowFunction1.js index d6718a56106..99341af9f86 100644 --- a/tests/baselines/reference/thisReferencedInFunctionInsideArrowFunction1.js +++ b/tests/baselines/reference/thisReferencedInFunctionInsideArrowFunction1.js @@ -10,7 +10,7 @@ function test() //// [thisReferencedInFunctionInsideArrowFunction1.js] var foo = function (dummy) { }; function test() { - foo(function () { return function () { - return this; - }; }); + foo(function () { + return function () { return this; }; + }); } diff --git a/tests/baselines/reference/throwInEnclosingStatements.js b/tests/baselines/reference/throwInEnclosingStatements.js index b52926e651e..0b072434f33 100644 --- a/tests/baselines/reference/throwInEnclosingStatements.js +++ b/tests/baselines/reference/throwInEnclosingStatements.js @@ -50,9 +50,7 @@ var aa = { function fn(x) { throw x; } -(function (x) { - throw x; -}); +(function (x) { throw x; }); var y; switch (y) { case 'a': diff --git a/tests/baselines/reference/throwStatements.js b/tests/baselines/reference/throwStatements.js index 146d1232792..83663d08cc4 100644 --- a/tests/baselines/reference/throwStatements.js +++ b/tests/baselines/reference/throwStatements.js @@ -97,9 +97,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -108,9 +106,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); var aNumber = 9.9; @@ -155,9 +151,7 @@ throw false; throw null; throw undefined; throw 'a string'; -throw function () { - return 'a string'; -}; +throw function () { return 'a string'; }; throw function (x) { return 42; }; throw { x: 12, y: 13 }; throw []; diff --git a/tests/baselines/reference/tooFewArgumentsInGenericFunctionTypedArgument.js b/tests/baselines/reference/tooFewArgumentsInGenericFunctionTypedArgument.js index 8aa23c82469..4b00c5fd0f2 100644 --- a/tests/baselines/reference/tooFewArgumentsInGenericFunctionTypedArgument.js +++ b/tests/baselines/reference/tooFewArgumentsInGenericFunctionTypedArgument.js @@ -19,10 +19,6 @@ var r1b = _.map(c2, rf1); //// [tooFewArgumentsInGenericFunctionTypedArgument.js] var c2; var _; -var r1a = _.map(c2, function (x) { - return x.toFixed(); -}); -var rf1 = function (x) { - return x.toFixed(); -}; +var r1a = _.map(c2, function (x) { return x.toFixed(); }); +var rf1 = function (x) { return x.toFixed(); }; var r1b = _.map(c2, rf1); diff --git a/tests/baselines/reference/topLevelExports.js b/tests/baselines/reference/topLevelExports.js index 0f539310b15..91e28b6a976 100644 --- a/tests/baselines/reference/topLevelExports.js +++ b/tests/baselines/reference/topLevelExports.js @@ -8,8 +8,6 @@ void log(foo).toString(); //// [topLevelExports.js] define(["require", "exports"], function (require, exports) { exports.foo = 3; - function log(n) { - return n; - } + function log(n) { return n; } void log(exports.foo).toString(); }); diff --git a/tests/baselines/reference/topLevelLambda.js b/tests/baselines/reference/topLevelLambda.js index 756a42b4340..3c4f1a3bc84 100644 --- a/tests/baselines/reference/topLevelLambda.js +++ b/tests/baselines/reference/topLevelLambda.js @@ -8,7 +8,5 @@ module M { var M; (function (M) { var _this = this; - var f = function () { - _this.window; - }; + var f = function () { _this.window; }; })(M || (M = {})); diff --git a/tests/baselines/reference/topLevelLambda3.js b/tests/baselines/reference/topLevelLambda3.js index 1505e38956a..0314b356b0f 100644 --- a/tests/baselines/reference/topLevelLambda3.js +++ b/tests/baselines/reference/topLevelLambda3.js @@ -3,6 +3,4 @@ var f = () => {this.window;} //// [topLevelLambda3.js] var _this = this; -var f = function () { - _this.window; -}; +var f = function () { _this.window; }; diff --git a/tests/baselines/reference/twoAccessorsWithSameName.js b/tests/baselines/reference/twoAccessorsWithSameName.js index 2d15bf6a02a..1e447ea1205 100644 --- a/tests/baselines/reference/twoAccessorsWithSameName.js +++ b/tests/baselines/reference/twoAccessorsWithSameName.js @@ -39,9 +39,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/twoAccessorsWithSameName2.js b/tests/baselines/reference/twoAccessorsWithSameName2.js index b6ef280156d..847f83e6a70 100644 --- a/tests/baselines/reference/twoAccessorsWithSameName2.js +++ b/tests/baselines/reference/twoAccessorsWithSameName2.js @@ -21,9 +21,7 @@ var C = (function () { function C() { } Object.defineProperty(C, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.js b/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.js index be252fe345b..cf5ddb23ccd 100644 --- a/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.js +++ b/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.js @@ -29,8 +29,7 @@ var menuData = [ "type": "image", "link": "", "icon": "modules/menu/logo.svg" - }, - { + }, { "id": "productName", "type": "default", "link": "", diff --git a/tests/baselines/reference/typeArgumentConstraintResolution1.js b/tests/baselines/reference/typeArgumentConstraintResolution1.js index 64b1bfe5b6c..fd661dd812c 100644 --- a/tests/baselines/reference/typeArgumentConstraintResolution1.js +++ b/tests/baselines/reference/typeArgumentConstraintResolution1.js @@ -15,7 +15,5 @@ foo2(""); // Type Date does not satisfy the constraint 'Number' for type p //// [typeArgumentConstraintResolution1.js] function foo1(test) { } foo1(""); // should error -function foo2(test) { - return null; -} +function foo2(test) { return null; } foo2(""); // Type Date does not satisfy the constraint 'Number' for type parameter 'T extends Number' diff --git a/tests/baselines/reference/typeArgumentInference.js b/tests/baselines/reference/typeArgumentInference.js index 65de6ea071f..1d10562ac7c 100644 --- a/tests/baselines/reference/typeArgumentInference.js +++ b/tests/baselines/reference/typeArgumentInference.js @@ -150,9 +150,7 @@ someGenerics7(function (n) { return n; }, function (n) { return n; }, function ( someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); // Generic call with argument of generic function type -function someGenerics8(n) { - return n; -} +function someGenerics8(n) { return n; } var x = someGenerics8(someGenerics7); x(null, null, null); // Generic call with multiple parameters of generic type passed arguments with no best common type diff --git a/tests/baselines/reference/typeArgumentInferenceOrdering.js b/tests/baselines/reference/typeArgumentInferenceOrdering.js index 53917844f66..96978bfd489 100644 --- a/tests/baselines/reference/typeArgumentInferenceOrdering.js +++ b/tests/baselines/reference/typeArgumentInferenceOrdering.js @@ -16,9 +16,7 @@ interface Goo { //// [typeArgumentInferenceOrdering.js] -function foo(f) { - return null; -} +function foo(f) { return null; } var x = foo(new C()).x; // was Error that property x does not exist on type {} var C = (function () { function C() { diff --git a/tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.js b/tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.js index 50d7767b5db..941c9330a5f 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.js +++ b/tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.js @@ -8,9 +8,7 @@ var e: Elephant; f(g, e); // valid because both Giraffe and Elephant satisfy the constraint. T is Animal //// [typeArgumentInferenceWithConstraintAsCommonRoot.js] -function f(x, y) { - return undefined; -} +function f(x, y) { return undefined; } var g; var e; f(g, e); // valid because both Giraffe and Elephant satisfy the constraint. T is Animal diff --git a/tests/baselines/reference/typeArgumentInferenceWithConstraints.js b/tests/baselines/reference/typeArgumentInferenceWithConstraints.js index f2300de8144..b8c051f0c37 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithConstraints.js +++ b/tests/baselines/reference/typeArgumentInferenceWithConstraints.js @@ -160,9 +160,7 @@ someGenerics7(function (n) { return n; }, function (n) { return n; }, function ( someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); // Generic call with argument of generic function type -function someGenerics8(n) { - return n; -} +function someGenerics8(n) { return n; } var x = someGenerics8(someGenerics7); // Error x(null, null, null); // Error // Generic call with multiple parameters of generic type passed arguments with no best common type diff --git a/tests/baselines/reference/typeAssertionToGenericFunctionType.js b/tests/baselines/reference/typeAssertionToGenericFunctionType.js index 1746cee3e85..15e5cf82f26 100644 --- a/tests/baselines/reference/typeAssertionToGenericFunctionType.js +++ b/tests/baselines/reference/typeAssertionToGenericFunctionType.js @@ -9,9 +9,7 @@ x.b(); // error //// [typeAssertionToGenericFunctionType.js] var x = { a: (function (x) { return 1; }), - b: function (x) { - x; - } + b: function (x) { x; } }; x.a(1); // bug was that this caused 'Could not find symbol T' on return type T in the type assertion on x.a's definition x.b(); // error diff --git a/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.js b/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.js index 9d387d850a7..9dad9fb671f 100644 --- a/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.js +++ b/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.js @@ -9,8 +9,8 @@ var functions = [function () { //// [typeCheckingInsideFunctionExpressionInArray.js] var functions = [function () { - var k = 10; - k = new Object(); - [1, 2, 3].NonexistantMethod(); - derp(); -}]; + var k = 10; + k = new Object(); + [1, 2, 3].NonexistantMethod(); + derp(); + }]; diff --git a/tests/baselines/reference/typeGuardsInConditionalExpression.js b/tests/baselines/reference/typeGuardsInConditionalExpression.js index ebe84879d2b..e493df66ce6 100644 --- a/tests/baselines/reference/typeGuardsInConditionalExpression.js +++ b/tests/baselines/reference/typeGuardsInConditionalExpression.js @@ -142,7 +142,8 @@ function foo7(x) { } function foo8(x) { var b; - return typeof x === "string" ? x === "hello" : ((b = x) && (typeof x === "boolean" ? x // boolean + return typeof x === "string" ? x === "hello" : ((b = x) && + (typeof x === "boolean" ? x // boolean : x == 10)); // number } function foo9(x) { diff --git a/tests/baselines/reference/typeInfer1.js b/tests/baselines/reference/typeInfer1.js index f0b14a6b6c9..f9613298838 100644 --- a/tests/baselines/reference/typeInfer1.js +++ b/tests/baselines/reference/typeInfer1.js @@ -19,7 +19,5 @@ var x = { WriteLine: function (s) { } }; var yyyyyyyy = { - Moo: function () { - return "cow"; - } + Moo: function () { return "cow"; } }; diff --git a/tests/baselines/reference/typeMatch2.js b/tests/baselines/reference/typeMatch2.js index f262adb4e18..1fd624e4e5b 100644 --- a/tests/baselines/reference/typeMatch2.js +++ b/tests/baselines/reference/typeMatch2.js @@ -93,12 +93,8 @@ function f4() { a = { x: 1, y: _any }; a = { x: 1, y: _any, z: 1 }; a = { x: 1 }; // error - var mf = function m(n) { - return false; - }; - var zf = function z(n) { - return true; - }; + var mf = function m(n) { return false; }; + var zf = function z(n) { return true; }; mf = zf; mf(_any); zf(_any); diff --git a/tests/baselines/reference/typeParameterAsTypeParameterConstraint.js b/tests/baselines/reference/typeParameterAsTypeParameterConstraint.js index c54e8694c6e..9266f520867 100644 --- a/tests/baselines/reference/typeParameterAsTypeParameterConstraint.js +++ b/tests/baselines/reference/typeParameterAsTypeParameterConstraint.js @@ -29,18 +29,14 @@ foo2(1, ['']); //// [typeParameterAsTypeParameterConstraint.js] // using a type parameter as a constraint for a type parameter is valid // no errors expected except illegal constraints -function foo(x, y) { - return y; -} +function foo(x, y) { return y; } var r = foo(1, 2); var r = foo({}, 1); var a; var b; var r2 = foo(a, b); var r3 = foo({ x: 1 }, { x: 2, y: 3 }); -function foo2(x, y) { - return y; -} +function foo2(x, y) { return y; } foo2(1, ''); foo2({}, { length: 2 }); foo2(1, { width: 3, length: 2 }); diff --git a/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.js b/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.js index 9e1b3b1b3ec..e8066b9ebfa 100644 --- a/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.js +++ b/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.js @@ -21,16 +21,12 @@ foo2([], ['']); //// [typeParameterAsTypeParameterConstraint2.js] // using a type parameter as a constraint for a type parameter is invalid // these should be errors unless otherwise noted -function foo(x, y) { - return y; -} // this is now an error +function foo(x, y) { return y; } // this is now an error foo(1, ''); foo(1, {}); var n; var r3 = foo(1, n); -function foo2(x, y) { - return y; -} // this is now an error +function foo2(x, y) { return y; } // this is now an error foo2(1, { length: '' }); foo2(1, { length: {} }); foo2([], ['']); diff --git a/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively.js b/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively.js index 20cadec3981..bc50363036d 100644 --- a/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively.js +++ b/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively.js @@ -30,18 +30,14 @@ foo(b, b, { foo: 1, bar: '', hm: '' }); var a; var b; var c; -function foo(x, y, z) { - return z; -} +function foo(x, y, z) { return z; } //function foo(x: T, y: U, z: V): V { return z; } foo(1, 2, 3); foo({ x: 1 }, { x: 1, y: '' }, { x: 2, y: '', z: true }); foo(a, b, c); foo(a, b, { foo: 1, bar: '', hm: true }); foo(function (x, y) { }, function (x) { }, function () { }); -function foo2(x, y, z) { - return z; -} +function foo2(x, y, z) { return z; } //function foo2(x: T, y: U, z: V): V { return z; } foo(a, a, a); foo(a, b, c); diff --git a/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively2.js b/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively2.js index c63c1e9e13a..6541cfaa231 100644 --- a/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively2.js +++ b/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively2.js @@ -29,18 +29,14 @@ foo(c, c, a); var a; var b; var c; -function foo(x, y, z) { - return z; -} +function foo(x, y, z) { return z; } //function foo(x: T, y: U, z: V): V { return z; } foo(1, 2, ''); foo({ x: 1 }, { x: 1, y: '' }, { x: 2, y: 2, z: true }); foo(a, b, a); foo(a, { foo: 1, bar: '', hm: true }, b); foo(function (x, y) { }, function (x, y) { }, function () { }); -function foo2(x, y, z) { - return z; -} +function foo2(x, y, z) { return z; } //function foo2(x: T, y: U, z: V): V { return z; } foo(b, a, c); foo(c, c, a); diff --git a/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.js b/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.js index 04fb7b1dc25..7e923941386 100644 --- a/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.js +++ b/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.js @@ -25,14 +25,10 @@ i2 = a2; // no error //// [typeParameterCompatibilityAccrossDeclarations.js] define(["require", "exports"], function (require, exports) { var a = { - x: function (y) { - return null; - } + x: function (y) { return null; } }; var a2 = { - x: function (y) { - return null; - } + x: function (y) { return null; } }; var i; var i2; diff --git a/tests/baselines/reference/typeParametersInStaticAccessors.js b/tests/baselines/reference/typeParametersInStaticAccessors.js index 2f9d8c795ff..c621de910bc 100644 --- a/tests/baselines/reference/typeParametersInStaticAccessors.js +++ b/tests/baselines/reference/typeParametersInStaticAccessors.js @@ -9,9 +9,7 @@ var foo = (function () { function foo() { } Object.defineProperty(foo, "Foo", { - get: function () { - return null; - }, + get: function () { return null; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/typeQueryOnClass.js b/tests/baselines/reference/typeQueryOnClass.js index 5c881a5ced3..1c8b2424a7e 100644 --- a/tests/baselines/reference/typeQueryOnClass.js +++ b/tests/baselines/reference/typeQueryOnClass.js @@ -82,9 +82,7 @@ var C = (function () { enumerable: true, configurable: true }); - C.prototype.baz = function (x) { - return ''; - }; + C.prototype.baz = function (x) { return ''; }; Object.defineProperty(C.prototype, "ic", { get: function () { return 1; diff --git a/tests/baselines/reference/typeofOperatorWithBooleanType.js b/tests/baselines/reference/typeofOperatorWithBooleanType.js index d7c5a1a5edf..82af3eac26f 100644 --- a/tests/baselines/reference/typeofOperatorWithBooleanType.js +++ b/tests/baselines/reference/typeofOperatorWithBooleanType.js @@ -53,15 +53,11 @@ z: typeof M.n; //// [typeofOperatorWithBooleanType.js] // typeof operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/typeofOperatorWithNumberType.js b/tests/baselines/reference/typeofOperatorWithNumberType.js index d40f09ee604..14b45ab518f 100644 --- a/tests/baselines/reference/typeofOperatorWithNumberType.js +++ b/tests/baselines/reference/typeofOperatorWithNumberType.js @@ -61,15 +61,11 @@ z: typeof M.n; // typeof operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -83,9 +79,7 @@ var ResultIsString2 = typeof NUMBER1; // number type literal var ResultIsString3 = typeof 1; var ResultIsString4 = typeof { x: 1, y: 2 }; -var ResultIsString5 = typeof { x: 1, y: function (n) { - return n; -} }; +var ResultIsString5 = typeof { x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsString6 = typeof objA.a; var ResultIsString7 = typeof M.n; diff --git a/tests/baselines/reference/typeofOperatorWithStringType.js b/tests/baselines/reference/typeofOperatorWithStringType.js index b3c3b748df6..381205ff8c1 100644 --- a/tests/baselines/reference/typeofOperatorWithStringType.js +++ b/tests/baselines/reference/typeofOperatorWithStringType.js @@ -61,15 +61,11 @@ z: typeof M.n; // typeof operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -83,9 +79,7 @@ var ResultIsString2 = typeof STRING1; // string type literal var ResultIsString3 = typeof ""; var ResultIsString4 = typeof { x: "", y: "" }; -var ResultIsString5 = typeof { x: "", y: function (s) { - return s; -} }; +var ResultIsString5 = typeof { x: "", y: function (s) { return s; } }; // string type expressions var ResultIsString6 = typeof objA.a; var ResultIsString7 = typeof M.n; diff --git a/tests/baselines/reference/undefinedSymbolReferencedInArrayLiteral1.js b/tests/baselines/reference/undefinedSymbolReferencedInArrayLiteral1.js index 94211010677..f314f9ad111 100644 --- a/tests/baselines/reference/undefinedSymbolReferencedInArrayLiteral1.js +++ b/tests/baselines/reference/undefinedSymbolReferencedInArrayLiteral1.js @@ -11,6 +11,6 @@ var functions = [function() { //// [undefinedSymbolReferencedInArrayLiteral1.js] var tokens = [{ startIndex: deltaOffset }]; var functions = [function () { - [1, 2, 3].NonexistantMethod(); - anotherNonExistingMethod(); -}]; + [1, 2, 3].NonexistantMethod(); + anotherNonExistingMethod(); + }]; diff --git a/tests/baselines/reference/underscoreTest1.js b/tests/baselines/reference/underscoreTest1.js index b9bfe51533c..bbecbac4059 100644 --- a/tests/baselines/reference/underscoreTest1.js +++ b/tests/baselines/reference/underscoreTest1.js @@ -962,21 +962,15 @@ _.range(0, 30, 5); _.range(0, 30, 5); _.range(0); /////////////////////////////////////////////////////////////////////////////////////// -var func = function (greeting) { - return greeting + ': ' + this.name; -}; +var func = function (greeting) { return greeting + ': ' + this.name; }; // need a second var otherwise typescript thinks func signature is the above func type, // instead of the newly returned _bind => func type. var func2 = _.bind(func, { name: 'moe' }, 'hi'); func2(); var buttonView = { label: 'underscore', - onClick: function () { - alert('clicked: ' + this.label); - }, - onHover: function () { - alert('hovering: ' + this.label); - } + onClick: function () { alert('clicked: ' + this.label); }, + onHover: function () { alert('hovering: ' + this.label); } }; _.bindAll(buttonView); $('#underscore_button').bind('click', buttonView.onClick); @@ -985,9 +979,7 @@ var fibonacci = _.memoize(function (n) { }); var log = _.bind(function (message) { }, Date); _.delay(log, 1000, 'logged later'); -_.defer(function () { - alert('deferred'); -}); +_.defer(function () { alert('deferred'); }); var updatePosition = function () { return alert('updating position...'); }; var throttled = _.throttle(updatePosition, 100); $(null).scroll(throttled); @@ -1002,19 +994,11 @@ var notes; var render = function () { return alert("rendering..."); }; var renderNotes = _.after(notes.length, render); _.each(notes, function (note) { return note.asyncSave({ success: renderNotes }); }); -var hello = function (name) { - return "hello: " + name; -}; -hello = _.wrap(hello, function (func, arg) { - return "before, " + func(arg) + ", after"; -}); +var hello = function (name) { return "hello: " + name; }; +hello = _.wrap(hello, function (func, arg) { return "before, " + func(arg) + ", after"; }); hello("moe"); -var greet = function (name) { - return "hi: " + name; -}; -var exclaim = function (statement) { - return statement + "!"; -}; +var greet = function (name) { return "hi: " + name; }; +var exclaim = function (statement) { return statement + "!"; }; var welcome = _.compose(exclaim, greet); welcome('moe'); /////////////////////////////////////////////////////////////////////////////////////// @@ -1029,11 +1013,7 @@ _.omit({ name: 'moe', age: 50, userid: 'moe1' }, 'userid'); var iceCream = { flavor: "chocolate" }; _.defaults(iceCream, { flavor: "vanilla", sprinkles: "lots" }); _.clone({ name: 'moe' }); -_.chain([1, 2, 3, 200]).filter(function (num) { - return num % 2 == 0; -}).tap(alert).map(function (num) { - return num * num; -}).value(); +_.chain([1, 2, 3, 200]).filter(function (num) { return num % 2 == 0; }).tap(alert).map(function (num) { return num * num; }).value(); _.has({ a: 1, b: 2, c: 3 }, "b"); var moe = { name: 'moe', luckyNumbers: [13, 27, 34] }; var clone = { name: 'moe', luckyNumbers: [13, 27, 34] }; @@ -1042,9 +1022,7 @@ _.isEqual(moe, clone); _.isEmpty([1, 2, 3]); _.isEmpty({}); _.isElement($('body')[0]); -(function () { - return _.isArray(arguments); -})(); +(function () { return _.isArray(arguments); })(); _.isArray([1, 2, 3]); _.isObject({}); _.isObject(1); @@ -1069,9 +1047,7 @@ var underscore = _.noConflict(); var moe2 = { name: 'moe' }; moe2 === _.identity(moe); var genie; -_.times(3, function (n) { - genie.grantWishNumber(n); -}); +_.times(3, function (n) { genie.grantWishNumber(n); }); _.random(0, 100); _.mixin({ capitalize: function (string) { @@ -1081,9 +1057,7 @@ _.mixin({ _("fabio").capitalize(); _.uniqueId('contact_'); _.escape('Curly, Larry & Moe'); -var object = { cheese: 'crumpets', stuff: function () { - return 'nonsense'; -} }; +var object = { cheese: 'crumpets', stuff: function () { return 'nonsense'; } }; _.result(object, 'cheese'); _.result(object, 'stuff'); var compiled = _.template("hello: <%= name %>"); diff --git a/tests/baselines/reference/unexpectedStatementBlockTerminator.js b/tests/baselines/reference/unexpectedStatementBlockTerminator.js index c4bf2c51aee..87b4652375a 100644 --- a/tests/baselines/reference/unexpectedStatementBlockTerminator.js +++ b/tests/baselines/reference/unexpectedStatementBlockTerminator.js @@ -18,6 +18,4 @@ var Bar = (function () { } return Bar; })(); -function Goo() { - return { a: 1, b: 2 }; -} +function Goo() { return { a: 1, b: 2 }; } diff --git a/tests/baselines/reference/unknownSymbols2.js b/tests/baselines/reference/unknownSymbols2.js index ba1b92ef71c..b158f5c9503 100644 --- a/tests/baselines/reference/unknownSymbols2.js +++ b/tests/baselines/reference/unknownSymbols2.js @@ -51,9 +51,7 @@ var M; break; } var a = function () { return asdf; }; - var b = function (asdf) { - return qwerty; - }; + var b = function (asdf) { return qwerty; }; var N; (function (N) { var x = 1; diff --git a/tests/baselines/reference/unspecializedConstraints.js b/tests/baselines/reference/unspecializedConstraints.js index f7974578ee2..0ca464a93af 100644 --- a/tests/baselines/reference/unspecializedConstraints.js +++ b/tests/baselines/reference/unspecializedConstraints.js @@ -240,7 +240,9 @@ var ts; this.flags = flags; } Property.prototype.equals = function (other) { - return this.name === other.name && this.flags === other.flags && this.type.equals(other.type); + return this.name === other.name && + this.flags === other.flags && + this.type.equals(other.type); }; return Property; })(Symbol); @@ -258,10 +260,14 @@ var ts; this.returnType = returnType; } Signature.prototype.equalsNoReturn = function (other) { - return this.parameters.length === other.parameters.length && this.typeParameters.length === other.typeParameters.length && arrayEquals(this.parameters, other.parameters) && arrayEquals(this.typeParameters, other.typeParameters); + return this.parameters.length === other.parameters.length && + this.typeParameters.length === other.typeParameters.length && + arrayEquals(this.parameters, other.parameters) && + arrayEquals(this.typeParameters, other.typeParameters); }; Signature.prototype.equals = function (other) { - return this.equalsNoReturn(other) && this.returnType.equals(other.returnType); + return this.equalsNoReturn(other) && + this.returnType.equals(other.returnType); }; return Signature; })(Symbol); @@ -274,7 +280,9 @@ var ts; this.flags = flags; } Parameter.prototype.equals = function (other) { - return this.name === other.name && this.flags === other.flags && this.type.equals(other.type); + return this.name === other.name && + this.flags === other.flags && + this.type.equals(other.type); }; return Parameter; })(Symbol); diff --git a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js index 9ff4a5c469a..9e0ff95536d 100644 --- a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js +++ b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js @@ -51,9 +51,7 @@ var __extends = this.__extends || function (d, b) { d.prototype = new __(); }; // none of these function calls should be allowed -var x = function () { - return; -}; +var x = function () { return; }; var r1 = x(); var y = x; var r2 = y(); diff --git a/tests/baselines/reference/validMultipleVariableDeclarations.js b/tests/baselines/reference/validMultipleVariableDeclarations.js index 5c65d388711..16c47ce8ee2 100644 --- a/tests/baselines/reference/validMultipleVariableDeclarations.js +++ b/tests/baselines/reference/validMultipleVariableDeclarations.js @@ -59,9 +59,7 @@ var p = { x: 1, y: undefined }; var p = { x: 1, y: 2 }; var p = { x: 0, y: undefined }; var p; -var fn = function (s) { - return 42; -}; +var fn = function (s) { return 42; }; var fn = function (s) { return 3; }; var fn; var fn; diff --git a/tests/baselines/reference/voidFunctionAssignmentCompat.js b/tests/baselines/reference/voidFunctionAssignmentCompat.js index 42e0f99ec31..0b7c4b60d89 100644 --- a/tests/baselines/reference/voidFunctionAssignmentCompat.js +++ b/tests/baselines/reference/voidFunctionAssignmentCompat.js @@ -20,39 +20,15 @@ var frv3: (v:any)=>number = (function() { return function () { return 0; } })() //// [voidFunctionAssignmentCompat.js] -var fa = function () { - return 3; -}; +var fa = function () { return 3; }; fa = function () { }; // should not work var fv = function () { }; -fv = function () { - return 0; -}; // should work -function execAny(callback) { - return callback(0); -} +fv = function () { return 0; }; // should work +function execAny(callback) { return callback(0); } execAny(function () { }); // should work -function execVoid(callback) { - callback(0); -} -execVoid(function () { - return 0; -}); // should work -var fra = function () { - return function () { }; -}; // should work -var frv = function () { - return function () { - return 0; - }; -}; // should work -var fra3 = (function () { - return function (v) { - return v; - }; -})(); // should work -var frv3 = (function () { - return function () { - return 0; - }; -})(); // should work +function execVoid(callback) { callback(0); } +execVoid(function () { return 0; }); // should work +var fra = function () { return function () { }; }; // should work +var frv = function () { return function () { return 0; }; }; // should work +var fra3 = (function () { return function (v) { return v; }; })(); // should work +var frv3 = (function () { return function () { return 0; }; })(); // should work diff --git a/tests/baselines/reference/voidOperatorWithBooleanType.js b/tests/baselines/reference/voidOperatorWithBooleanType.js index 64c09e2ea65..69c609c1280 100644 --- a/tests/baselines/reference/voidOperatorWithBooleanType.js +++ b/tests/baselines/reference/voidOperatorWithBooleanType.js @@ -41,15 +41,11 @@ void M.n; //// [voidOperatorWithBooleanType.js] // void operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/voidOperatorWithNumberType.js b/tests/baselines/reference/voidOperatorWithNumberType.js index e37e5a82577..2426690489d 100644 --- a/tests/baselines/reference/voidOperatorWithNumberType.js +++ b/tests/baselines/reference/voidOperatorWithNumberType.js @@ -49,15 +49,11 @@ void objA.a, M.n; // void operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -71,9 +67,7 @@ var ResultIsAny2 = void NUMBER1; // number type literal var ResultIsAny3 = void 1; var ResultIsAny4 = void { x: 1, y: 2 }; -var ResultIsAny5 = void { x: 1, y: function (n) { - return n; -} }; +var ResultIsAny5 = void { x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsAny6 = void objA.a; var ResultIsAny7 = void M.n; diff --git a/tests/baselines/reference/voidOperatorWithStringType.js b/tests/baselines/reference/voidOperatorWithStringType.js index 7954f50bf57..9f30d1fcb0c 100644 --- a/tests/baselines/reference/voidOperatorWithStringType.js +++ b/tests/baselines/reference/voidOperatorWithStringType.js @@ -48,15 +48,11 @@ void objA.a,M.n; // void operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -70,9 +66,7 @@ var ResultIsAny2 = void STRING1; // string type literal var ResultIsAny3 = void ""; var ResultIsAny4 = void { x: "", y: "" }; -var ResultIsAny5 = void { x: "", y: function (s) { - return s; -} }; +var ResultIsAny5 = void { x: "", y: function (s) { return s; } }; // string type expressions var ResultIsAny6 = void objA.a; var ResultIsAny7 = void M.n; diff --git a/tests/baselines/reference/widenedTypes.errors.txt b/tests/baselines/reference/widenedTypes.errors.txt index 7374bd23b77..2277ef6eea7 100644 --- a/tests/baselines/reference/widenedTypes.errors.txt +++ b/tests/baselines/reference/widenedTypes.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/widenedTypes.ts(2,1): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. -tests/cases/compiler/widenedTypes.ts(5,1): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +tests/cases/compiler/widenedTypes.ts(5,1): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/compiler/widenedTypes.ts(6,7): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/compiler/widenedTypes.ts(8,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. tests/cases/compiler/widenedTypes.ts(11,1): error TS2322: Type 'string' is not assignable to type 'number'. @@ -20,7 +20,7 @@ tests/cases/compiler/widenedTypes.ts(24,5): error TS2322: Type '{ [x: string]: n null in {}; ~~~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. "" in null; ~~~~ !!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter diff --git a/tests/baselines/reference/witness.js b/tests/baselines/reference/witness.js index 607c2415044..82a1298f156 100644 --- a/tests/baselines/reference/witness.js +++ b/tests/baselines/reference/witness.js @@ -210,9 +210,7 @@ function fnArg1(x, y) { var x; fnArg1(fnArg1, 0); } -function overload1() { - return undefined; -} +function overload1() { return undefined; } ; function fnArg2() { return overload1(fnArg2); diff --git a/tests/baselines/reference/wrappedAndRecursiveConstraints3.js b/tests/baselines/reference/wrappedAndRecursiveConstraints3.js index 01f591de323..fb0f5388aaa 100644 --- a/tests/baselines/reference/wrappedAndRecursiveConstraints3.js +++ b/tests/baselines/reference/wrappedAndRecursiveConstraints3.js @@ -30,6 +30,6 @@ var C = (function () { })(); var c = new C({ length: 2 }); var r = c.foo({ length: 3, charAt: function (x) { - ''; -} }); + ''; + } }); var r2 = r(''); diff --git a/tests/baselines/reference/wrappedAndRecursiveConstraints4.js b/tests/baselines/reference/wrappedAndRecursiveConstraints4.js index da4117860a7..998c16a9f87 100644 --- a/tests/baselines/reference/wrappedAndRecursiveConstraints4.js +++ b/tests/baselines/reference/wrappedAndRecursiveConstraints4.js @@ -28,5 +28,5 @@ var C = (function () { var c = new C({ length: 2 }); var r = c.foo(''); var r2 = r({ length: 3, charAt: function (x) { - ''; -} }); // error + ''; + } }); // error diff --git a/tests/cases/compiler/APISample_compile.ts b/tests/cases/compiler/APISample_compile.ts index 50ec02ab6f3..f1703835380 100644 --- a/tests/cases/compiler/APISample_compile.ts +++ b/tests/cases/compiler/APISample_compile.ts @@ -21,8 +21,8 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); allDiagnostics.forEach(diagnostic => { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); }); var exitCode = emitResult.emitSkipped ? 1 : 0; diff --git a/tests/cases/compiler/APISample_linter.ts b/tests/cases/compiler/APISample_linter.ts index c95d6273d4e..287a2a56dee 100644 --- a/tests/cases/compiler/APISample_linter.ts +++ b/tests/cases/compiler/APISample_linter.ts @@ -39,7 +39,7 @@ export function delint(sourceFile: ts.SourceFile) { break; case ts.SyntaxKind.BinaryExpression: - var op = (node).operator; + var op = (node).operatorToken.kind; if (op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken) { report(node, "Use '===' and '!=='.") @@ -51,8 +51,8 @@ export function delint(sourceFile: ts.SourceFile) { } function report(node: ts.Node, message: string) { - var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart()); - console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) + var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart()); + console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) } } diff --git a/tests/cases/compiler/APISample_transform.ts b/tests/cases/compiler/APISample_transform.ts index e9d9a46d286..438b9520010 100644 --- a/tests/cases/compiler/APISample_transform.ts +++ b/tests/cases/compiler/APISample_transform.ts @@ -54,7 +54,7 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { return { outputs: outputs, errors: errors.map(function (e) { - return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) }; diff --git a/tests/cases/compiler/APISample_watcher.ts b/tests/cases/compiler/APISample_watcher.ts index 212f83b3935..3b1c83419bf 100644 --- a/tests/cases/compiler/APISample_watcher.ts +++ b/tests/cases/compiler/APISample_watcher.ts @@ -87,8 +87,8 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); diff --git a/tests/cases/compiler/amdDependencyCommentName1.ts b/tests/cases/compiler/amdDependencyCommentName1.ts new file mode 100644 index 00000000000..958d7ff825f --- /dev/null +++ b/tests/cases/compiler/amdDependencyCommentName1.ts @@ -0,0 +1,5 @@ +//@module: commonjs +/// + +import m1 = require("m2") +m1.f(); \ No newline at end of file diff --git a/tests/cases/compiler/amdDependencyCommentName2.ts b/tests/cases/compiler/amdDependencyCommentName2.ts new file mode 100644 index 00000000000..6cd7d5531f1 --- /dev/null +++ b/tests/cases/compiler/amdDependencyCommentName2.ts @@ -0,0 +1,5 @@ +//@module: amd +/// + +import m1 = require("m2") +m1.f(); \ No newline at end of file diff --git a/tests/cases/compiler/amdDependencyCommentName3.ts b/tests/cases/compiler/amdDependencyCommentName3.ts new file mode 100644 index 00000000000..4800aed9639 --- /dev/null +++ b/tests/cases/compiler/amdDependencyCommentName3.ts @@ -0,0 +1,7 @@ +//@module: amd +/// +/// +/// + +import m1 = require("m2") +m1.f(); \ No newline at end of file diff --git a/tests/cases/compiler/letAndVarRedeclaration.ts b/tests/cases/compiler/letAndVarRedeclaration.ts new file mode 100644 index 00000000000..1f901ded520 --- /dev/null +++ b/tests/cases/compiler/letAndVarRedeclaration.ts @@ -0,0 +1,53 @@ +// @target: es6 + +let e0 +var e0; +function e0() { } + +function f0() { + let x1; + var x1; + function x1() { } +} + +function f1() { + let x; + { + var x; + } + { + function x() { } + } +} + +module M0 { + let x2; + var x2; + function x2() { } +} + +module M1 { + let x2; + { + var x2; + } + { + function x2() { } + } +} + +let x11; +for (var x11; ;) { +} + +function f2() { + let x11; + for (var x11; ;) { + } +} + +module M2 { + let x11; + for (var x11; ;) { + } +} \ No newline at end of file diff --git a/tests/cases/compiler/shadowingViaLocalValue.ts b/tests/cases/compiler/shadowingViaLocalValue.ts new file mode 100644 index 00000000000..72bc0f0e33e --- /dev/null +++ b/tests/cases/compiler/shadowingViaLocalValue.ts @@ -0,0 +1,14 @@ +{ + let x; + { + var x = 1; + } +} + +{ + let x1; + { + for (var x1 = 0; ;); + } +} + diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty1.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty1.ts new file mode 100644 index 00000000000..8a9276416c5 --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty1.ts @@ -0,0 +1,11 @@ +//@target: ES5 +interface SymbolConstructor { + foo: string; +} +var Symbol: SymbolConstructor; + +var obj = { + [Symbol.foo]: 0 +} + +obj[Symbol.foo]; \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty2.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty2.ts new file mode 100644 index 00000000000..07c95eb27d9 --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty2.ts @@ -0,0 +1,11 @@ +//@target: ES5 +module M { + var Symbol; + + export class C { + [Symbol.iterator]() { } + } + (new C)[Symbol.iterator]; +} + +(new M.C)[Symbol.iterator]; \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty3.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty3.ts new file mode 100644 index 00000000000..262e47557f8 --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty3.ts @@ -0,0 +1,8 @@ +//@target: ES5 +var Symbol; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty4.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty4.ts new file mode 100644 index 00000000000..2b14e64a33c --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty4.ts @@ -0,0 +1,8 @@ +//@target: ES5 +var Symbol: { iterator: string }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty5.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty5.ts new file mode 100644 index 00000000000..ec46ddad21d --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty5.ts @@ -0,0 +1,8 @@ +//@target: ES5 +var Symbol: { iterator: symbol }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator](0) // Should error \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty6.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty6.ts new file mode 100644 index 00000000000..59b7d2291aa --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty6.ts @@ -0,0 +1,6 @@ +//@target: ES5 +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty7.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty7.ts new file mode 100644 index 00000000000..766b86f9b5d --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty7.ts @@ -0,0 +1,8 @@ +//@target: ES5 +var Symbol: { iterator: any }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolType1.ts b/tests/cases/conformance/Symbols/ES5SymbolType1.ts new file mode 100644 index 00000000000..bfd5592f8e4 --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolType1.ts @@ -0,0 +1,3 @@ +//@target: ES5 +var s: symbol; +s.toString(); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit1.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit1.ts new file mode 100644 index 00000000000..b99806a1eee --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit1.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +class C { + [Symbol.isRegExp]: number; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit10.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit10.ts new file mode 100644 index 00000000000..cf3496c2553 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit10.ts @@ -0,0 +1,6 @@ +//@target: ES6 +//@declaration: true +var obj = { + get [Symbol.isConcatSpreadable]() { return '' }, + set [Symbol.isConcatSpreadable](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit11.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit11.ts new file mode 100644 index 00000000000..4b88ab55980 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit11.ts @@ -0,0 +1,8 @@ +//@target: ES6 +//@declaration: true +class C { + static [Symbol.iterator] = 0; + static [Symbol.toPrimitive]() { } + static get [Symbol.isRegExp]() { return ""; } + static set [Symbol.isRegExp](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts new file mode 100644 index 00000000000..c18b470d35d --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts @@ -0,0 +1,14 @@ +//@target: ES6 +//@declaration: true +module M { + interface I { } + export class C { + [Symbol.iterator]: I; + [Symbol.toPrimitive](x: I) { } + [Symbol.isConcatSpreadable](): I { + return undefined + } + get [Symbol.isRegExp]() { return undefined; } + set [Symbol.isRegExp](x: I) { } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit13.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit13.ts new file mode 100644 index 00000000000..18568e853e8 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit13.ts @@ -0,0 +1,6 @@ +//@target: ES6 +//@declaration: true +class C { + get [Symbol.isRegExp]() { return ""; } + set [Symbol.toStringTag](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit14.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit14.ts new file mode 100644 index 00000000000..312476628b8 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit14.ts @@ -0,0 +1,6 @@ +//@target: ES6 +//@declaration: true +class C { + get [Symbol.isRegExp]() { return ""; } + get [Symbol.toStringTag]() { return ""; } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit2.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit2.ts new file mode 100644 index 00000000000..420e1c84906 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit2.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +class C { + [Symbol.isRegExp] = ""; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit3.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit3.ts new file mode 100644 index 00000000000..b70ee3c15ac --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit3.ts @@ -0,0 +1,7 @@ +//@target: ES6 +//@declaration: true +class C { + [Symbol.isRegExp](x: number); + [Symbol.isRegExp](x: string); + [Symbol.isRegExp](x: any) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit4.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit4.ts new file mode 100644 index 00000000000..dde80577fa4 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit4.ts @@ -0,0 +1,6 @@ +//@target: ES6 +//@declaration: true +class C { + get [Symbol.isRegExp]() { return ""; } + set [Symbol.isRegExp](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit5.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit5.ts new file mode 100644 index 00000000000..e5acf9c9f7c --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit5.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +interface I { + [Symbol.isConcatSpreadable](): string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit6.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit6.ts new file mode 100644 index 00000000000..1d0059f954f --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit6.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +interface I { + [Symbol.isConcatSpreadable]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit7.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit7.ts new file mode 100644 index 00000000000..01f91681b15 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit7.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +var obj: { + [Symbol.isConcatSpreadable]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit8.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit8.ts new file mode 100644 index 00000000000..2682a4940f9 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit8.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +var obj = { + [Symbol.isConcatSpreadable]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit9.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit9.ts new file mode 100644 index 00000000000..2c35a553600 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit9.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +var obj = { + [Symbol.isConcatSpreadable]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty1.ts b/tests/cases/conformance/es6/Symbols/symbolProperty1.ts new file mode 100644 index 00000000000..0e008511be3 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty1.ts @@ -0,0 +1,9 @@ +//@target: ES6 +var s: symbol; +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty10.ts b/tests/cases/conformance/es6/Symbols/symbolProperty10.ts new file mode 100644 index 00000000000..0f63356eaf6 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty10.ts @@ -0,0 +1,11 @@ +//@target: ES6 +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]?: { x }; +} + +var i: I; +i = new C; +var c: C = i; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty11.ts b/tests/cases/conformance/es6/Symbols/symbolProperty11.ts new file mode 100644 index 00000000000..1377970613d --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty11.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C { } +interface I { + [Symbol.iterator]?: { x }; +} + +var i: I; +i = new C; +var c: C = i; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty12.ts b/tests/cases/conformance/es6/Symbols/symbolProperty12.ts new file mode 100644 index 00000000000..5a835a34b62 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty12.ts @@ -0,0 +1,11 @@ +//@target: ES6 +class C { + private [Symbol.iterator]: { x }; +} +interface I { + [Symbol.iterator]: { x }; +} + +var i: I; +i = new C; +var c: C = i; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty13.ts b/tests/cases/conformance/es6/Symbols/symbolProperty13.ts new file mode 100644 index 00000000000..4b5023e1d06 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty13.ts @@ -0,0 +1,17 @@ +//@target: ES6 +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty14.ts b/tests/cases/conformance/es6/Symbols/symbolProperty14.ts new file mode 100644 index 00000000000..0109ec3be25 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty14.ts @@ -0,0 +1,17 @@ +//@target: ES6 +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]?: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty15.ts b/tests/cases/conformance/es6/Symbols/symbolProperty15.ts new file mode 100644 index 00000000000..3ec6c6ecc7a --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty15.ts @@ -0,0 +1,15 @@ +//@target: ES6 +class C { } +interface I { + [Symbol.iterator]?: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty16.ts b/tests/cases/conformance/es6/Symbols/symbolProperty16.ts new file mode 100644 index 00000000000..2b3a976df98 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty16.ts @@ -0,0 +1,17 @@ +//@target: ES6 +class C { + private [Symbol.iterator]: { x }; +} +interface I { + [Symbol.iterator]: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty17.ts b/tests/cases/conformance/es6/Symbols/symbolProperty17.ts new file mode 100644 index 00000000000..737059d0e3b --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty17.ts @@ -0,0 +1,9 @@ +//@target: ES6 +interface I { + [Symbol.iterator]: number; + [s: symbol]: string; + "__@iterator": string; +} + +var i: I; +var it = i[Symbol.iterator]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty18.ts b/tests/cases/conformance/es6/Symbols/symbolProperty18.ts new file mode 100644 index 00000000000..2fabea34960 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty18.ts @@ -0,0 +1,10 @@ +//@target: ES6 +var i = { + [Symbol.iterator]: 0, + [Symbol.toStringTag]() { return "" }, + set [Symbol.toPrimitive](p: boolean) { } +} + +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); +i[Symbol.toPrimitive] = false; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty19.ts b/tests/cases/conformance/es6/Symbols/symbolProperty19.ts new file mode 100644 index 00000000000..df9b99f5ca4 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty19.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var i = { + [Symbol.iterator]: { p: null }, + [Symbol.toStringTag]() { return { p: undefined }; } +} + +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty2.ts b/tests/cases/conformance/es6/Symbols/symbolProperty2.ts new file mode 100644 index 00000000000..44a2ba13874 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty2.ts @@ -0,0 +1,9 @@ +//@target: ES6 +var s = Symbol(); +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty20.ts b/tests/cases/conformance/es6/Symbols/symbolProperty20.ts new file mode 100644 index 00000000000..7180ceec87d --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty20.ts @@ -0,0 +1,10 @@ +//@target: ES6 +interface I { + [Symbol.iterator]: (s: string) => string; + [Symbol.toStringTag](s: number): number; +} + +var i: I = { + [Symbol.iterator]: s => s, + [Symbol.toStringTag](n) { return n; } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty21.ts b/tests/cases/conformance/es6/Symbols/symbolProperty21.ts new file mode 100644 index 00000000000..52e84a00425 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty21.ts @@ -0,0 +1,13 @@ +//@target: ES6 +interface I { + [Symbol.unscopables]: T; + [Symbol.isConcatSpreadable]: U; +} + +declare function foo(p: I): { t: T; u: U }; + +foo({ + [Symbol.isConcatSpreadable]: "", + [Symbol.isRegExp]: 0, + [Symbol.unscopables]: true +}); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty22.ts b/tests/cases/conformance/es6/Symbols/symbolProperty22.ts new file mode 100644 index 00000000000..a0eec6dd471 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty22.ts @@ -0,0 +1,8 @@ +//@target: ES6 +interface I { + [Symbol.unscopables](x: T): U; +} + +declare function foo(p1: T, p2: I): U; + +foo("", { [Symbol.unscopables]: s => s.length }); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty23.ts b/tests/cases/conformance/es6/Symbols/symbolProperty23.ts new file mode 100644 index 00000000000..6d8a2108720 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty23.ts @@ -0,0 +1,10 @@ +//@target: ES6 +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toPrimitive]() { + return true; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty24.ts b/tests/cases/conformance/es6/Symbols/symbolProperty24.ts new file mode 100644 index 00000000000..8e1c35879ab --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty24.ts @@ -0,0 +1,10 @@ +//@target: ES6 +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toPrimitive]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty25.ts b/tests/cases/conformance/es6/Symbols/symbolProperty25.ts new file mode 100644 index 00000000000..ee571174933 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty25.ts @@ -0,0 +1,10 @@ +//@target: ES6 +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toStringTag]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty26.ts b/tests/cases/conformance/es6/Symbols/symbolProperty26.ts new file mode 100644 index 00000000000..88b7d168d64 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty26.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return ""; + } +} + +class C2 extends C1 { + [Symbol.toStringTag]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty27.ts b/tests/cases/conformance/es6/Symbols/symbolProperty27.ts new file mode 100644 index 00000000000..c6283595575 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty27.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return {}; + } +} + +class C2 extends C1 { + [Symbol.toStringTag]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty28.ts b/tests/cases/conformance/es6/Symbols/symbolProperty28.ts new file mode 100644 index 00000000000..7f68444a75e --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty28.ts @@ -0,0 +1,11 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} + +class C2 extends C1 { } + +var c: C2; +var obj = c[Symbol.toStringTag]().x; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty29.ts b/tests/cases/conformance/es6/Symbols/symbolProperty29.ts new file mode 100644 index 00000000000..8d1b8491d37 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty29.ts @@ -0,0 +1,7 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: symbol]: () => { x: string }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty3.ts b/tests/cases/conformance/es6/Symbols/symbolProperty3.ts new file mode 100644 index 00000000000..027e93a86ad --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty3.ts @@ -0,0 +1,9 @@ +//@target: ES6 +var s = Symbol; +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty30.ts b/tests/cases/conformance/es6/Symbols/symbolProperty30.ts new file mode 100644 index 00000000000..a75f77d6056 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty30.ts @@ -0,0 +1,7 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: symbol]: () => { x: number }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty31.ts b/tests/cases/conformance/es6/Symbols/symbolProperty31.ts new file mode 100644 index 00000000000..d41f5d6b0fe --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty31.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 extends C1 { + [s: symbol]: () => { x: string }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty32.ts b/tests/cases/conformance/es6/Symbols/symbolProperty32.ts new file mode 100644 index 00000000000..52da68fc57c --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty32.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 extends C1 { + [s: symbol]: () => { x: number }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty33.ts b/tests/cases/conformance/es6/Symbols/symbolProperty33.ts new file mode 100644 index 00000000000..8c7a4d274f3 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty33.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 { + [s: symbol]: () => { x: string }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty34.ts b/tests/cases/conformance/es6/Symbols/symbolProperty34.ts new file mode 100644 index 00000000000..6e8bb521f0a --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty34.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 { + [s: symbol]: () => { x: number }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty35.ts b/tests/cases/conformance/es6/Symbols/symbolProperty35.ts new file mode 100644 index 00000000000..2d9527e2fd4 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty35.ts @@ -0,0 +1,9 @@ +//@target: ES6 +interface I1 { + [Symbol.toStringTag](): { x: string } +} +interface I2 { + [Symbol.toStringTag](): { x: number } +} + +interface I3 extends I1, I2 { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty36.ts b/tests/cases/conformance/es6/Symbols/symbolProperty36.ts new file mode 100644 index 00000000000..709ea39cd5d --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty36.ts @@ -0,0 +1,5 @@ +//@target: ES6 +var x = { + [Symbol.isConcatSpreadable]: 0, + [Symbol.isConcatSpreadable]: 1 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty37.ts b/tests/cases/conformance/es6/Symbols/symbolProperty37.ts new file mode 100644 index 00000000000..7a6c86a7bea --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty37.ts @@ -0,0 +1,5 @@ +//@target: ES6 +interface I { + [Symbol.isConcatSpreadable]: string; + [Symbol.isConcatSpreadable]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty38.ts b/tests/cases/conformance/es6/Symbols/symbolProperty38.ts new file mode 100644 index 00000000000..c8683344edc --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty38.ts @@ -0,0 +1,7 @@ +//@target: ES6 +interface I { + [Symbol.isConcatSpreadable]: string; +} +interface I { + [Symbol.isConcatSpreadable]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty39.ts b/tests/cases/conformance/es6/Symbols/symbolProperty39.ts new file mode 100644 index 00000000000..af3a95eb155 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty39.ts @@ -0,0 +1,11 @@ +//@target: ES6 +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } + [Symbol.iterator](x: any) { + return undefined; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty4.ts b/tests/cases/conformance/es6/Symbols/symbolProperty4.ts new file mode 100644 index 00000000000..b6079bb31b3 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty4.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var x = { + [Symbol()]: 0, + [Symbol()]() { }, + get [Symbol()]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty40.ts b/tests/cases/conformance/es6/Symbols/symbolProperty40.ts new file mode 100644 index 00000000000..91fd953a4d7 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty40.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } +} + +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator](0); diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty41.ts b/tests/cases/conformance/es6/Symbols/symbolProperty41.ts new file mode 100644 index 00000000000..9c9583264cd --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty41.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C { + [Symbol.iterator](x: string): { x: string }; + [Symbol.iterator](x: "hello"): { x: string; hello: string }; + [Symbol.iterator](x: any) { + return undefined; + } +} + +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator]("hello"); diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty42.ts b/tests/cases/conformance/es6/Symbols/symbolProperty42.ts new file mode 100644 index 00000000000..79fbce7bb90 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty42.ts @@ -0,0 +1,8 @@ +//@target: ES6 +class C { + [Symbol.iterator](x: string): string; + static [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty43.ts b/tests/cases/conformance/es6/Symbols/symbolProperty43.ts new file mode 100644 index 00000000000..c524b6423a5 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty43.ts @@ -0,0 +1,5 @@ +//@target: ES6 +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty44.ts b/tests/cases/conformance/es6/Symbols/symbolProperty44.ts new file mode 100644 index 00000000000..a6281592605 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty44.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C { + get [Symbol.hasInstance]() { + return ""; + } + get [Symbol.hasInstance]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty45.ts b/tests/cases/conformance/es6/Symbols/symbolProperty45.ts new file mode 100644 index 00000000000..cfdcc317646 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty45.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C { + get [Symbol.hasInstance]() { + return ""; + } + get [Symbol.toPrimitive]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty46.ts b/tests/cases/conformance/es6/Symbols/symbolProperty46.ts new file mode 100644 index 00000000000..84ce050ac1c --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty46.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C { + get [Symbol.hasInstance]() { + return ""; + } + // Should take a string + set [Symbol.hasInstance](x) { + } +} + +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty47.ts b/tests/cases/conformance/es6/Symbols/symbolProperty47.ts new file mode 100644 index 00000000000..05e46aaee75 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty47.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C { + get [Symbol.hasInstance]() { + return ""; + } + // Should take a string + set [Symbol.hasInstance](x: number) { + } +} + +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty48.ts b/tests/cases/conformance/es6/Symbols/symbolProperty48.ts new file mode 100644 index 00000000000..77ce9303b44 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty48.ts @@ -0,0 +1,8 @@ +//@target: ES6 +module M { + var Symbol; + + class C { + [Symbol.iterator]() { } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty49.ts b/tests/cases/conformance/es6/Symbols/symbolProperty49.ts new file mode 100644 index 00000000000..bc34e146f2c --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty49.ts @@ -0,0 +1,8 @@ +//@target: ES6 +module M { + export var Symbol; + + class C { + [Symbol.iterator]() { } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty5.ts b/tests/cases/conformance/es6/Symbols/symbolProperty5.ts new file mode 100644 index 00000000000..84cb12a9de8 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty5.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var x = { + [Symbol.iterator]: 0, + [Symbol.isRegExp]() { }, + get [Symbol.toStringTag]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty50.ts b/tests/cases/conformance/es6/Symbols/symbolProperty50.ts new file mode 100644 index 00000000000..8bcf25fab29 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty50.ts @@ -0,0 +1,8 @@ +//@target: ES6 +module M { + interface Symbol { } + + class C { + [Symbol.iterator]() { } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty51.ts b/tests/cases/conformance/es6/Symbols/symbolProperty51.ts new file mode 100644 index 00000000000..3da5d45bf84 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty51.ts @@ -0,0 +1,8 @@ +//@target: ES6 +module M { + module Symbol { } + + class C { + [Symbol.iterator]() { } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty52.ts b/tests/cases/conformance/es6/Symbols/symbolProperty52.ts new file mode 100644 index 00000000000..b14838a6914 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty52.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var obj = { + [Symbol.nonsense]: 0 +}; + +obj = {}; + +obj[Symbol.nonsense]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty53.ts b/tests/cases/conformance/es6/Symbols/symbolProperty53.ts new file mode 100644 index 00000000000..c58b6e885af --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty53.ts @@ -0,0 +1,6 @@ +//@target: ES6 +var obj = { + [Symbol.for]: 0 +}; + +obj[Symbol.for]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty54.ts b/tests/cases/conformance/es6/Symbols/symbolProperty54.ts new file mode 100644 index 00000000000..b3eab2a54a1 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty54.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var obj = { + [Symbol.prototype]: 0 +}; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty55.ts b/tests/cases/conformance/es6/Symbols/symbolProperty55.ts new file mode 100644 index 00000000000..3c6ceb69b0e --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty55.ts @@ -0,0 +1,11 @@ +//@target: ES6 +var obj = { + [Symbol.iterator]: 0 +}; + +module M { + var Symbol: SymbolConstructor; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol.iterator]; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty56.ts b/tests/cases/conformance/es6/Symbols/symbolProperty56.ts new file mode 100644 index 00000000000..ae9e5232b9b --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty56.ts @@ -0,0 +1,11 @@ +//@target: ES6 +var obj = { + [Symbol.iterator]: 0 +}; + +module M { + var Symbol: {}; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol["iterator"]]; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty57.ts b/tests/cases/conformance/es6/Symbols/symbolProperty57.ts new file mode 100644 index 00000000000..b60c18a05ee --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty57.ts @@ -0,0 +1,7 @@ +//@target: ES6 +var obj = { + [Symbol.iterator]: 0 +}; + +// Should give type 'any'. +obj[Symbol["nonsense"]]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty58.ts b/tests/cases/conformance/es6/Symbols/symbolProperty58.ts new file mode 100644 index 00000000000..48cc6eb90f3 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty58.ts @@ -0,0 +1,8 @@ +//@target: ES6 +interface SymbolConstructor { + foo: string; +} + +var obj = { + [Symbol.foo]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty59.ts b/tests/cases/conformance/es6/Symbols/symbolProperty59.ts new file mode 100644 index 00000000000..bdea9dab62c --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty59.ts @@ -0,0 +1,4 @@ +//@target: ES6 +interface I { + [Symbol.keyFor]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty6.ts b/tests/cases/conformance/es6/Symbols/symbolProperty6.ts new file mode 100644 index 00000000000..ff17b977c38 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty6.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C { + [Symbol.iterator] = 0; + [Symbol.unscopables]: number; + [Symbol.isRegExp]() { } + get [Symbol.toStringTag]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty7.ts b/tests/cases/conformance/es6/Symbols/symbolProperty7.ts new file mode 100644 index 00000000000..972e96c282b --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty7.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C { + [Symbol()] = 0; + [Symbol()]: number; + [Symbol()]() { } + get [Symbol()]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty8.ts b/tests/cases/conformance/es6/Symbols/symbolProperty8.ts new file mode 100644 index 00000000000..14b4a32688f --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty8.ts @@ -0,0 +1,5 @@ +//@target: ES6 +interface I { + [Symbol.unscopables]: number; + [Symbol.isRegExp](); +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty9.ts b/tests/cases/conformance/es6/Symbols/symbolProperty9.ts new file mode 100644 index 00000000000..33ffcb5ee25 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty9.ts @@ -0,0 +1,11 @@ +//@target: ES6 +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]: { x }; +} + +var i: I; +i = new C; +var c: C = i; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType1.ts b/tests/cases/conformance/es6/Symbols/symbolType1.ts new file mode 100644 index 00000000000..3a7339fbeb7 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType1.ts @@ -0,0 +1,5 @@ +//@target: ES6 +Symbol() instanceof Symbol; +Symbol instanceof Symbol(); +(Symbol() || {}) instanceof Object; // This one should be okay, it's a valid way of distinguishing types +Symbol instanceof (Symbol() || {}); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType10.ts b/tests/cases/conformance/es6/Symbols/symbolType10.ts new file mode 100644 index 00000000000..a1ee87de159 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType10.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var s = Symbol.for("bitwise"); +s & s; +s | s; +s ^ s; + +s & 0; +0 | s; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType11.ts b/tests/cases/conformance/es6/Symbols/symbolType11.ts new file mode 100644 index 00000000000..8b9661bb046 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType11.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var s = Symbol.for("logical"); +s && s; +s && []; +0 && s; +s || s; +s || 1; +({}) || s; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType12.ts b/tests/cases/conformance/es6/Symbols/symbolType12.ts new file mode 100644 index 00000000000..44852bc10e6 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType12.ts @@ -0,0 +1,29 @@ +//@target: ES6 +var s = Symbol.for("assign"); +var str = ""; +s *= s; +s *= 0; +s /= s; +s /= 0; +s %= s; +s %= 0; +s += s; +s += 0; +s += ""; +str += s; +s -= s; +s -= 0; +s <<= s; +s <<= 0; +s >>= s; +s >>= 0; +s >>>= s; +s >>>= 0; +s &= s; +s &= 0; +s ^= s; +s ^= 0; +s |= s; +s |= 0; + +str += (s || str); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType13.ts b/tests/cases/conformance/es6/Symbols/symbolType13.ts new file mode 100644 index 00000000000..4b657c4c37a --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType13.ts @@ -0,0 +1,7 @@ +//@target: ES6 +var s = Symbol(); +var x: any; + +for (s in {}) { } +for (x in s) { } +for (var y in s) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType14.ts b/tests/cases/conformance/es6/Symbols/symbolType14.ts new file mode 100644 index 00000000000..c20a8be874b --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType14.ts @@ -0,0 +1,2 @@ +//@target: ES6 +new Symbol(); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType15.ts b/tests/cases/conformance/es6/Symbols/symbolType15.ts new file mode 100644 index 00000000000..22f1f9662c0 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType15.ts @@ -0,0 +1,6 @@ +//@target: ES6 +var sym: symbol; +var symObj: Symbol; + +symObj = sym; +sym = symObj; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType16.ts b/tests/cases/conformance/es6/Symbols/symbolType16.ts new file mode 100644 index 00000000000..0421e0ccc02 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType16.ts @@ -0,0 +1,7 @@ +//@target: ES6 +interface Symbol { + newSymbolProp: number; +} + +var sym: symbol; +sym.newSymbolProp; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType17.ts b/tests/cases/conformance/es6/Symbols/symbolType17.ts new file mode 100644 index 00000000000..95824f1794b --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType17.ts @@ -0,0 +1,11 @@ +//@target: ES6 +interface Foo { prop } +var x: symbol | Foo; + +x; +if (typeof x === "symbol") { + x; +} +else { + x; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType18.ts b/tests/cases/conformance/es6/Symbols/symbolType18.ts new file mode 100644 index 00000000000..caa84171737 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType18.ts @@ -0,0 +1,11 @@ +//@target: ES6 +interface Foo { prop } +var x: symbol | Foo; + +x; +if (typeof x === "object") { + x; +} +else { + x; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType19.ts b/tests/cases/conformance/es6/Symbols/symbolType19.ts new file mode 100644 index 00000000000..85d13b2cbdd --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType19.ts @@ -0,0 +1,11 @@ +//@target: ES6 +enum E { } +var x: symbol | E; + +x; +if (typeof x === "number") { + x; +} +else { + x; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType2.ts b/tests/cases/conformance/es6/Symbols/symbolType2.ts new file mode 100644 index 00000000000..54954c17bd3 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType2.ts @@ -0,0 +1,3 @@ +//@target: ES6 +Symbol.isConcatSpreadable in {}; +"" in Symbol.toPrimitive; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType20.ts b/tests/cases/conformance/es6/Symbols/symbolType20.ts new file mode 100644 index 00000000000..ef14e34048b --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType20.ts @@ -0,0 +1,2 @@ +//@target: ES6 +interface symbol { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType3.ts b/tests/cases/conformance/es6/Symbols/symbolType3.ts new file mode 100644 index 00000000000..b5855ecab41 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType3.ts @@ -0,0 +1,13 @@ +//@target: ES6 +var s = Symbol(); +delete Symbol.iterator; +void Symbol.toPrimitive; +typeof Symbol.toStringTag; +++s; +--s; ++ Symbol(); +- Symbol(); +~ Symbol(); +! Symbol(); + ++(Symbol() || 0); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType4.ts b/tests/cases/conformance/es6/Symbols/symbolType4.ts new file mode 100644 index 00000000000..bd5b5ba1a06 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType4.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var s = Symbol.for("postfix"); +s++; +s--; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType5.ts b/tests/cases/conformance/es6/Symbols/symbolType5.ts new file mode 100644 index 00000000000..302cfcafdf3 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType5.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var s = Symbol.for("multiply"); +s * s; +s / s; +s % s; + +s * 0; +0 / s; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType6.ts b/tests/cases/conformance/es6/Symbols/symbolType6.ts new file mode 100644 index 00000000000..2efa682b98f --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType6.ts @@ -0,0 +1,16 @@ +//@target: ES6 +var s = Symbol.for("add"); +var a: any; +s + s; +s - s; +s + ""; +s + a; +s + 0; +"" + s; +a + s; +0 + s; +s - 0; +0 - s; + +(s || "") + ""; +"" + (s || ""); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType7.ts b/tests/cases/conformance/es6/Symbols/symbolType7.ts new file mode 100644 index 00000000000..841ca9e8b10 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType7.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var s = Symbol.for("shift"); +s << s; +s << 0; +s >> s; +s >> 0; +s >>> s; +s >>> 0; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType8.ts b/tests/cases/conformance/es6/Symbols/symbolType8.ts new file mode 100644 index 00000000000..b3bc68094c7 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType8.ts @@ -0,0 +1,13 @@ +//@target: ES6 +var s = Symbol.for("compare"); +s < s; +s < 0; +s > s; +s > 0; +s <= s; +s <= 0; +s >= s; +s >= 0; + +0 >= (s || 0); +(s || 0) >= s; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType9.ts b/tests/cases/conformance/es6/Symbols/symbolType9.ts new file mode 100644 index 00000000000..1fa43143640 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType9.ts @@ -0,0 +1,10 @@ +//@target: ES6 +var s = Symbol.for("equal"); +s == s; +s == true; +s != s; +0 != s; +s === s; +s === 1; +s !== s; +false !== s; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts new file mode 100644 index 00000000000..59a8e9d3420 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +var v = { + [s]() { }, + [n]() { }, + [s + s]() { }, + [s + n]() { }, + [+s]() { }, + [""]() { }, + [0]() { }, + [a]() { }, + [true]() { }, + [`hello bye`]() { }, + [`hello ${a} bye`]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames10.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames10.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts new file mode 100644 index 00000000000..33288184b16 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +var 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; } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames11.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames11.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts new file mode 100644 index 00000000000..365ca67c1a3 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +class C { + [s]: number; + [n] = n; + static [s + s]: string; + [s + n] = 2; + [+s]: typeof s; + static [""]: number; + [0]: number; + [a]: number; + static [true]: number; + [`hello bye`] = 0; + static [`hello ${a} bye`] = 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts new file mode 100644 index 00000000000..fb44bfb4145 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +class C { + [s]() {} + [n]() { } + static [s + s]() { } + [s + n]() { } + [+s]() { } + static [""]() { } + [0]() { } + [a]() { } + static [true]() { } + [`hello bye`]() { } + static [`hello ${a} bye`]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames13.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames13.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts new file mode 100644 index 00000000000..8f78f279eba --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +var b: boolean; +class C { + [b]() {} + static [true]() { } + [[]]() { } + static [{}]() { } + [undefined]() { } + static [null]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts new file mode 100644 index 00000000000..2baa39cf61a --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +var p1: number | string; +var p2: number | number[]; +var p3: string | boolean; +class C { + [p1]() { } + [p2]() { } + [p3]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts new file mode 100644 index 00000000000..01204a1e619 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +class C { + get [s]() { return 0;} + set [n](v) { } + static get [s + s]() { return 0; } + set [s + n](v) { } + get [+s]() { return 0; } + static set [""](v) { } + get [0]() { return 0; } + set [a](v) { } + static get [true]() { return 0; } + set [`hello bye`](v) { } + get [`hello ${a} bye`]() { return 0; } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames16.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames16.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts new file mode 100644 index 00000000000..e52067cc7f4 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +var b: boolean; +class C { + get [b]() { return 0;} + static set [true](v) { } + get [[]]() { return 0; } + set [{}](v) { } + static get [undefined]() { return 0; } + set [null](v) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts new file mode 100644 index 00000000000..3c929b20ddf --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +function foo() { + var obj = { + [this.bar]: 0 + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames18.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames18.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts new file mode 100644 index 00000000000..87a1bf81178 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +module M { + var obj = { + [this.bar]: 0 + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts new file mode 100644 index 00000000000..70ba98a818c --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts @@ -0,0 +1,5 @@ +// @target: es5 +var v = { + get [0 + 1]() { return 0 }, + set [0 + 1](v: string) { } //No error +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts new file mode 100644 index 00000000000..6cff3715d83 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts @@ -0,0 +1,4 @@ +// @target: es5 +var obj = { + [this.bar]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames20.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames20.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts new file mode 100644 index 00000000000..caee82c8ea3 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +class C { + bar() { + return 0; + } + [this.bar()]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts new file mode 100644 index 00000000000..41142951421 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +class C { + bar() { + var obj = { + [this.bar()]() { } + }; + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames22.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames22.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts new file mode 100644 index 00000000000..e0a86c21842 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +class C { + bar() { + return 0; + } + [ + { [this.bar()]: 1 }[0] + ]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts new file mode 100644 index 00000000000..ff94b6c9617 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Base { + bar() { + return 0; + } +} +class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [super.bar()]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts new file mode 100644 index 00000000000..d791b8b9178 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts @@ -0,0 +1,14 @@ +// @target: es5 +class Base { + bar() { + return 0; + } +} +class C extends Base { + foo() { + var obj = { + [super.bar()]() { } + }; + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames25.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames25.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts new file mode 100644 index 00000000000..4b0d794b1a7 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts @@ -0,0 +1,13 @@ +// @target: es5 +class Base { + bar() { + return 0; + } +} +class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [ + { [super.bar()]: 1 }[0] + ]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts new file mode 100644 index 00000000000..1cae37aa093 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +class Base { +} +class C extends Base { + [(super(), "prop")]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts new file mode 100644 index 00000000000..c82d7b000e2 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Base { +} +class C extends Base { + constructor() { + super(); + var obj = { + [(super(), "prop")]() { } + }; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames28.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames28.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts new file mode 100644 index 00000000000..c650c6e6c3f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class C { + bar() { + () => { + var obj = { + [this.bar()]() { } // needs capture + }; + } + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames29.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames29.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts new file mode 100644 index 00000000000..7c2517cd514 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +var methodName = "method"; +var accessorName = "accessor"; +class C { + [methodName]() { } + static [methodName]() { } + get [accessorName]() { } + set [accessorName](v) { } + static get [accessorName]() { } + static set [accessorName](v) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts new file mode 100644 index 00000000000..528e9b7c583 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts @@ -0,0 +1,16 @@ +// @target: es5 +class Base { +} +class C extends Base { + constructor() { + super(); + () => { + var obj = { + // Ideally, we would capture this. But the reference is + // illegal, and not capturing this is consistent with + //treatment of other similar violations. + [(super(), "prop")]() { } + }; + } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts new file mode 100644 index 00000000000..39c5ca2b747 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts @@ -0,0 +1,16 @@ +// @target: es5 +class Base { + bar() { + return 0; + } +} +class C extends Base { + foo() { + () => { + var obj = { + [super.bar()]() { } // needs capture + }; + } + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames31.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames31.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts new file mode 100644 index 00000000000..f9c17c632ae --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts @@ -0,0 +1,8 @@ +// @target: es5 +function foo() { return '' } +class C { + bar() { + return 0; + } + [foo()]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts new file mode 100644 index 00000000000..0dcbabf4063 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +function foo() { return '' } +class C { + bar() { + var obj = { + [foo()]() { } + }; + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames33.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames33.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts new file mode 100644 index 00000000000..b6892f1bd80 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +function foo() { return '' } +class C { + static bar() { + var obj = { + [foo()]() { } + }; + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts new file mode 100644 index 00000000000..7d3df135b10 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +function foo() { return '' } +interface I { + bar(): string; + [foo()](): void; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts new file mode 100644 index 00000000000..95099715ad8 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames36.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames36.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts new file mode 100644 index 00000000000..cb931fc31d6 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: number]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames37.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames37.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts new file mode 100644 index 00000000000..5ea07aa1605 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + set [1 << 6](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames38.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames38.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts new file mode 100644 index 00000000000..929332c5d32 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: number]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + set [1 << 6](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames39.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames39.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts new file mode 100644 index 00000000000..1f34f9ad287 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +var id; +class C { + [0 + 1]() { } + static [() => { }]() { } + get [delete id]() { } + set [[0, 1]](v) { } + static get [""]() { } + static set [id.toString()](v) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts new file mode 100644 index 00000000000..bba1068fef3 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: () => Foo2; + + // Computed properties + [""]() { return new Foo } + [""]() { return new Foo2 } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames40.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames40.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts new file mode 100644 index 00000000000..1e8ed7d6cd1 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: () => Foo2; + + // Computed properties + static [""]() { return new Foo } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames41.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames41.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts new file mode 100644 index 00000000000..fc181d5a548 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + [""]: Foo; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts new file mode 100644 index 00000000000..c130692c118 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts @@ -0,0 +1,13 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; +} + +class D extends C { + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames43.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames43.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts new file mode 100644 index 00000000000..4c9422ed44e --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts @@ -0,0 +1,12 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + get ["get1"]() { return new Foo } +} + +class D extends C { + set ["set1"](p: Foo) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts new file mode 100644 index 00000000000..c1eb09275c5 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts @@ -0,0 +1,13 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + get ["get1"]() { return new Foo } +} + +class D extends C { + // No error when the indexer is in a class more derived than the computed property + [s: string]: Foo2; + set ["set1"](p: Foo) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames45.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames45.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts new file mode 100644 index 00000000000..d009c960d6b --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts @@ -0,0 +1,4 @@ +// @target: es5 +var o = { + ["" || 0]: 0 +}; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames46.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames46.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts new file mode 100644 index 00000000000..b158ef76447 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +enum E1 { x } +enum E2 { x } +var o = { + [E1.x || E2.x]: 0 +}; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames47.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames47.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts new file mode 100644 index 00000000000..1c854603b09 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts @@ -0,0 +1,18 @@ +// @target: es5 +declare function extractIndexer(p: { [n: number]: T }): T; + +enum E { x } + +var a: any; + +extractIndexer({ + [a]: "" +}); // Should return string + +extractIndexer({ + [E.x]: "" +}); // Should return string + +extractIndexer({ + ["" || 0]: "" +}); // Should return any (widened form of undefined) \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames48.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames48.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts new file mode 100644 index 00000000000..611d6a7d30f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts @@ -0,0 +1,25 @@ + +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts new file mode 100644 index 00000000000..58f97a80feb --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts @@ -0,0 +1,26 @@ +// @target: es6 + +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts new file mode 100644 index 00000000000..17089b7244f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +var 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 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames4.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames4.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts new file mode 100644 index 00000000000..f7411e7cb4f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts @@ -0,0 +1,25 @@ + +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts new file mode 100644 index 00000000000..c599477c2e2 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts @@ -0,0 +1,26 @@ +// @target: es6 + +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts new file mode 100644 index 00000000000..e9d7d6ffab4 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +var b: boolean; +var v = { + [b]: 0, + [true]: 1, + [[]]: 0, + [{}]: 0, + [undefined]: undefined, + [null]: null +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts new file mode 100644 index 00000000000..0521873d70c --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +var p1: number | string; +var p2: number | number[]; +var p3: string | boolean; +var v = { + [p1]: 0, + [p2]: 1, + [p3]: 2 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts new file mode 100644 index 00000000000..e3b379602b9 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +enum E { + member +} +var v = { + [E.member]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames7.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames7.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts new file mode 100644 index 00000000000..0723552edc2 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +function f() { + var t: T; + var u: U; + var v = { + [t]: 0, + [u]: 1 + }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts new file mode 100644 index 00000000000..e1c675d95e4 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +function f(s: string): string; +function f(n: number): number; +function f(x: T): T; +function f(x): any { } + +var v = { + [f("")]: 0, + [f(0)]: 0, + [f(true)]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts new file mode 100644 index 00000000000..dd208340520 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +interface I { + [s: number]: boolean; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts new file mode 100644 index 00000000000..d8aad5bf468 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: (x: string) => number; + [s: number]: (x: any) => number; // Doesn't get hit +} + +var o: I = { + ["" + 0](y) { return y.length; }, + ["" + 1]: y => y.length +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts new file mode 100644 index 00000000000..c9a425b5a99 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: (x: any) => number; // Doesn't get hit + [s: number]: (x: string) => number; +} + +var o: I = { + [+"foo"](y) { return y.length; }, + [+"bar"]: y => y.length +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts new file mode 100644 index 00000000000..3f5a6f7f91f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +interface I { + [s: string]: (x: string) => number; +} + +var o: I = { + [+"foo"](y) { return y.length; }, + [+"bar"]: y => y.length +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts new file mode 100644 index 00000000000..8ce0503c449 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: any; + [s: number]: any; +} + +var o: I = { + [""+"foo"]: "", + [""+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts new file mode 100644 index 00000000000..42acf42ee2a --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: any; + [s: number]: any; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts new file mode 100644 index 00000000000..9e6248878b9 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts @@ -0,0 +1,14 @@ +// @target: es5 +interface I { + [s: string]: T; +} + +declare function foo(obj: I): T + +foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts new file mode 100644 index 00000000000..722891c2f6a --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts @@ -0,0 +1,14 @@ +// @target: es5 +interface I { + [s: number]: T; +} + +declare function foo(obj: I): T + +foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts new file mode 100644 index 00000000000..5e6835b5948 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: boolean; + [s: number]: boolean; +} + +var o: I = { + [""+"foo"]: "", + [""+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts new file mode 100644 index 00000000000..aa30d333d11 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: boolean; + [s: number]: boolean; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts new file mode 100644 index 00000000000..1091304b6b2 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +// @declaration: true +class C { + ["" + ""]() { } + get ["" + ""]() { return 0; } + set ["" + ""](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts new file mode 100644 index 00000000000..b30b8e13062 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +// @declaration: true +class C { + static ["" + ""]() { } + static get ["" + ""]() { return 0; } + static set ["" + ""](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts new file mode 100644 index 00000000000..aa4e3b2cf2f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts @@ -0,0 +1,5 @@ +// @target: es5 +// @declaration: true +interface I { + ["" + ""](): void; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts new file mode 100644 index 00000000000..9a6e17f4c93 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts @@ -0,0 +1,5 @@ +// @target: es5 +// @declaration: true +var v: { + ["" + ""](): void; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts new file mode 100644 index 00000000000..eb12ea9b471 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts @@ -0,0 +1,8 @@ +// @target: es5 +// @declaration: true +var v = { + ["" + ""]: 0, + ["" + ""]() { }, + get ["" + ""]() { return 0; }, + set ["" + ""](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts new file mode 100644 index 00000000000..a025a074e31 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts @@ -0,0 +1,8 @@ +// @target: es5 +var methodName = "method"; +var accessorName = "accessor"; +class C { + [methodName](v: string); + [methodName](); + [methodName](v?: string) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts new file mode 100644 index 00000000000..9454483cdb4 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +// @sourceMap: true +class C { + ["hello"]() { + debugger; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts new file mode 100644 index 00000000000..3d35cd12430 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +// @sourceMap: true +var v = { + ["hello"]() { + debugger; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.ts diff --git a/tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts b/tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts new file mode 100644 index 00000000000..1b03c533e7d --- /dev/null +++ b/tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts @@ -0,0 +1,11 @@ +function foo1([...r] = null) { +} + +function foo2([...r] = undefined) { +} + +function foo3([...r] = {}) { +} + +function foo4([...r] = []) { +} diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts new file mode 100644 index 00000000000..8f9a4072f42 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var i of e) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts new file mode 100644 index 00000000000..3a6f932e821 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (const v of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts new file mode 100644 index 00000000000..94ca9330ab0 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (const [a, b] of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts new file mode 100644 index 00000000000..7d4655e4b36 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (const {a, b} of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts new file mode 100644 index 00000000000..7a11d2e073e --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (let {a, b} of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts new file mode 100644 index 00000000000..c39939a1a08 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (let [a, b] of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts new file mode 100644 index 00000000000..95c5c2c53ee --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var [a, b] of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts new file mode 100644 index 00000000000..9a68bad827c --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var {a, b} of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement17.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement17.ts new file mode 100644 index 00000000000..882ae938d6c --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement17.ts @@ -0,0 +1,2 @@ +//@target: ES5 +for (var of; ;) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts new file mode 100644 index 00000000000..a7dff6f225b --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts @@ -0,0 +1,2 @@ +//@target: ES5 +for (var of of of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts new file mode 100644 index 00000000000..730f574be33 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts @@ -0,0 +1,2 @@ +//@target: ES5 +for (var of in of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts new file mode 100644 index 00000000000..7ef97688115 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts new file mode 100644 index 00000000000..edffb88a1e3 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts @@ -0,0 +1,2 @@ +//@target: ES5 +for (var of = 0 in of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts new file mode 100644 index 00000000000..a61edfbd050 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts @@ -0,0 +1,2 @@ +//@target: ES5 +for (var of of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts new file mode 100644 index 00000000000..1b183225b74 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var a, b of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts new file mode 100644 index 00000000000..a99b69a2f4a --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var a = 1 of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts new file mode 100644 index 00000000000..c3c434b605c --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var a: number of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts new file mode 100644 index 00000000000..4e03b361e73 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var a = 1, b = 2 of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts new file mode 100644 index 00000000000..8340bab563b --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var a: number = 1, b: string = "" of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts new file mode 100644 index 00000000000..39ecbcfbcb3 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var v of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts new file mode 100644 index 00000000000..63fe58a93f8 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (let v of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts new file mode 100644 index 00000000000..5c10e2d487b --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts @@ -0,0 +1,4 @@ +//@target: ES5 +interface I { + [s: symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts new file mode 100644 index 00000000000..e5d29c08f7d --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts @@ -0,0 +1,4 @@ +//@target: ES5 +class C { + [s: symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts new file mode 100644 index 00000000000..d4bd13aa1d6 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts @@ -0,0 +1,4 @@ +//@target: ES5 +var x: { + [s: symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts new file mode 100644 index 00000000000..64ca01bba6c --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts @@ -0,0 +1,4 @@ +//@target: ES5 +interface I { + [Symbol.iterator]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts new file mode 100644 index 00000000000..cc606c2e6a3 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts @@ -0,0 +1,4 @@ +//@target: ES5 +interface I { + [Symbol.unscopables](): string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts new file mode 100644 index 00000000000..978d4ef95f0 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts @@ -0,0 +1,4 @@ +//@target: ES5 +declare class C { + [Symbol.unscopables](): string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts new file mode 100644 index 00000000000..7f16672ebd2 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts @@ -0,0 +1,4 @@ +//@target: ES5 +declare class C { + [Symbol.isRegExp]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts new file mode 100644 index 00000000000..fb7f00d7694 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts @@ -0,0 +1,4 @@ +//@target: ES5 +class C { + [Symbol.isRegExp]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts new file mode 100644 index 00000000000..3fc8e6f8979 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts @@ -0,0 +1,4 @@ +//@target: ES5 +class C { + [Symbol.toStringTag]: string = ""; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts new file mode 100644 index 00000000000..a27636388c0 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts @@ -0,0 +1,4 @@ +//@target: ES5 +class C { + [Symbol.toStringTag](): void { } +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts new file mode 100644 index 00000000000..78e5738f7da --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts @@ -0,0 +1,4 @@ +//@target: ES5 +var x: { + [Symbol.toPrimitive](): string +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts new file mode 100644 index 00000000000..7838df4d8fc --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts @@ -0,0 +1,4 @@ +//@target: ES5 +var x: { + [Symbol.toPrimitive]: string +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts new file mode 100644 index 00000000000..9248d2fb45c --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var i of e) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts new file mode 100644 index 00000000000..9febb87d74f --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (const v of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts new file mode 100644 index 00000000000..dbcf40c36ab --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (const [a, b] of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts new file mode 100644 index 00000000000..8bb57d3a356 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (const {a, b} of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts new file mode 100644 index 00000000000..5da8edc65c4 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (let {a, b} of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts new file mode 100644 index 00000000000..ddd1216471f --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (let [a, b] of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts new file mode 100644 index 00000000000..43e18b460ca --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var [a, b] of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts new file mode 100644 index 00000000000..e042179fbba --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var {a, b} of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement17.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement17.ts new file mode 100644 index 00000000000..f088b36f4fd --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement17.ts @@ -0,0 +1,2 @@ +//@target: ES6 +for (var of; ;) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts new file mode 100644 index 00000000000..268dc163dde --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts @@ -0,0 +1,2 @@ +//@target: ES6 +for (var of of of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts new file mode 100644 index 00000000000..4dff469112b --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts @@ -0,0 +1,2 @@ +//@target: ES6 +for (var of in of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts new file mode 100644 index 00000000000..8274876781d --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts new file mode 100644 index 00000000000..d0b7b75175d --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts @@ -0,0 +1,2 @@ +//@target: ES6 +for (var of = 0 in of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts new file mode 100644 index 00000000000..f480ac371a2 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts @@ -0,0 +1,2 @@ +//@target: ES6 +for (var of of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts new file mode 100644 index 00000000000..d16c99e6c3d --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var a, b of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts new file mode 100644 index 00000000000..f7cd4b34d26 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var a = 1 of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts new file mode 100644 index 00000000000..789e5f9725d --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var a: number of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts new file mode 100644 index 00000000000..946e5ba1574 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var a = 1, b = 2 of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts new file mode 100644 index 00000000000..e7e56f74c4e --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var a: number = 1, b: string = "" of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts new file mode 100644 index 00000000000..7a528a9898e --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var v of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts new file mode 100644 index 00000000000..741a56a8cf7 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (let v of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts new file mode 100644 index 00000000000..805584ef078 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts @@ -0,0 +1,4 @@ +//@target: ES6 +interface I { + [s: symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts new file mode 100644 index 00000000000..c593d0a4b0a --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts @@ -0,0 +1,4 @@ +//@target: ES6 +class C { + [s: symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts new file mode 100644 index 00000000000..183ecea6e63 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts @@ -0,0 +1,4 @@ +//@target: ES6 +class C { + static [s: symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts new file mode 100644 index 00000000000..c6f9077f648 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var x: { + [s: symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts new file mode 100644 index 00000000000..a028a3b6488 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var x = { + [s: symbol]: "" +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty1.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty1.ts new file mode 100644 index 00000000000..d29272fd561 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty1.ts @@ -0,0 +1,4 @@ +//@target: ES6 +interface I { + [Symbol.iterator]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty2.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty2.ts new file mode 100644 index 00000000000..3ef11e99aa9 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty2.ts @@ -0,0 +1,4 @@ +//@target: ES6 +interface I { + [Symbol.unscopables](): string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty3.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty3.ts new file mode 100644 index 00000000000..d63302991d0 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty3.ts @@ -0,0 +1,4 @@ +//@target: ES6 +declare class C { + [Symbol.unscopables](): string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty4.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty4.ts new file mode 100644 index 00000000000..6a0962f15cb --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty4.ts @@ -0,0 +1,4 @@ +//@target: ES6 +declare class C { + [Symbol.isRegExp]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty5.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty5.ts new file mode 100644 index 00000000000..5f3fbaeaaea --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty5.ts @@ -0,0 +1,4 @@ +//@target: ES6 +class C { + [Symbol.isRegExp]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty6.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty6.ts new file mode 100644 index 00000000000..24d67c8b707 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty6.ts @@ -0,0 +1,4 @@ +//@target: ES6 +class C { + [Symbol.toStringTag]: string = ""; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty7.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty7.ts new file mode 100644 index 00000000000..69f2f4b30f8 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty7.ts @@ -0,0 +1,4 @@ +//@target: ES6 +class C { + [Symbol.toStringTag](): void { } +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts new file mode 100644 index 00000000000..dcc6d5b7615 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var x: { + [Symbol.toPrimitive](): string +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts new file mode 100644 index 00000000000..b7093f188d2 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var x: { + [Symbol.toPrimitive]: string +} \ No newline at end of file diff --git a/tests/cases/fourslash/definition.ts b/tests/cases/fourslash/definition.ts new file mode 100644 index 00000000000..531e4562843 --- /dev/null +++ b/tests/cases/fourslash/definition.ts @@ -0,0 +1,12 @@ +/// + +// @Filename: b.ts +////import n = require('a/*1*/'); +////var x = new n.Foo(); + +// @Filename: a.ts +//// /*2*/export class Foo {} + +goTo.marker('1'); +goTo.definition(); +verify.caretAtMarker('2'); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingForOfKeyword.ts b/tests/cases/fourslash/formattingForOfKeyword.ts new file mode 100644 index 00000000000..33b3d83c00f --- /dev/null +++ b/tests/cases/fourslash/formattingForOfKeyword.ts @@ -0,0 +1,8 @@ +/// + +/////**/for ([]of[]) { } + + +format.document(); +goTo.marker(); +verify.currentLineContentIs('for ([] of []) { }'); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingMultilineTemplateLiterals.ts b/tests/cases/fourslash/formattingMultilineTemplateLiterals.ts new file mode 100644 index 00000000000..37e6f5782e0 --- /dev/null +++ b/tests/cases/fourslash/formattingMultilineTemplateLiterals.ts @@ -0,0 +1,13 @@ +/// + +/////*1*/new Error(`Failed to expand glob: ${projectSpec.filesGlob} +/////*2*/ at projectPath : ${projectFile} +/////*3*/ with error: ${ex.message}`) + +format.document(); +goTo.marker("1"); +verify.currentLineContentIs("new Error(`Failed to expand glob: ${projectSpec.filesGlob}"); +goTo.marker("2"); +verify.currentLineContentIs(" at projectPath : ${projectFile}"); +goTo.marker("3"); +verify.currentLineContentIs(" with error: ${ex.message}`)"); \ No newline at end of file diff --git a/tests/cases/fourslash/scriptLexicalStructureSymbols1.ts b/tests/cases/fourslash/scriptLexicalStructureSymbols1.ts new file mode 100644 index 00000000000..e3dde6738e9 --- /dev/null +++ b/tests/cases/fourslash/scriptLexicalStructureSymbols1.ts @@ -0,0 +1,17 @@ +/// + +////{| "itemName": "C", "kind": "class", "parentName": "" |} +////class C { +//// {| "itemName": "[Symbol.isRegExp]", "kind": "property", "parentName": "C" |} +//// [Symbol.isRegExp] = 0; +//// {| "itemName": "[Symbol.iterator]", "kind": "method", "parentName": "C" |} +//// [Symbol.iterator]() { } +//// {| "itemName": "[Symbol.isConcatSpreadable]", "kind": "getter", "parentName": "C" |} +//// get [Symbol.isConcatSpreadable]() { } +////} + +test.markers().forEach(marker => { + verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); +}); + +verify.getScriptLexicalStructureListCount(test.markers().length); \ No newline at end of file diff --git a/tests/cases/fourslash/scriptLexicalStructureSymbols2.ts b/tests/cases/fourslash/scriptLexicalStructureSymbols2.ts new file mode 100644 index 00000000000..d048de895ec --- /dev/null +++ b/tests/cases/fourslash/scriptLexicalStructureSymbols2.ts @@ -0,0 +1,15 @@ +/// + +////{| "itemName": "I", "kind": "interface", "parentName": "" |} +////interface I { +//// {| "itemName": "[Symbol.isRegExp]", "kind": "property", "parentName": "I" |} +//// [Symbol.isRegExp]: string; +//// {| "itemName": "[Symbol.iterator]", "kind": "method", "parentName": "I" |} +//// [Symbol.iterator](): string; +////} + +test.markers().forEach(marker => { + verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); +}); + +verify.getScriptLexicalStructureListCount(test.markers().length); \ No newline at end of file diff --git a/tests/cases/fourslash/scriptLexicalStructureSymbols3.ts b/tests/cases/fourslash/scriptLexicalStructureSymbols3.ts new file mode 100644 index 00000000000..19f81037559 --- /dev/null +++ b/tests/cases/fourslash/scriptLexicalStructureSymbols3.ts @@ -0,0 +1,13 @@ +/// + +////{| "itemName": "E", "kind": "enum", "parentName": "" |} +////enum E { +//// // No nav bar entry for this +//// [Symbol.isRegExp] = 0 +////} + +test.markers().forEach(marker => { + verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); +}); + +verify.getScriptLexicalStructureListCount(test.markers().length); \ No newline at end of file diff --git a/tests/cases/fourslash/server/brace.ts b/tests/cases/fourslash/server/brace.ts new file mode 100644 index 00000000000..fc8a71197db --- /dev/null +++ b/tests/cases/fourslash/server/brace.ts @@ -0,0 +1,43 @@ +/// + +//////curly braces +////module Foo [|{ +//// class Bar [|{ +//// private f() [|{ +//// }|] +//// +//// private f2() [|{ +//// if (true) [|{ }|] [|{ }|]; +//// }|] +//// }|] +////}|] +//// +//////parenthesis +////class FooBar { +//// private f[|()|] { +//// return [|([|(1 + 1)|])|]; +//// } +//// +//// private f2[|()|] { +//// if [|(true)|] { } +//// } +////} +//// +//////square brackets +////class Baz { +//// private f() { +//// var a: any[|[]|] = [|[[|[1, 2]|], [|[3, 4]|], 5]|]; +//// } +////} +//// +////// angular brackets +////class TemplateTest [||] { +//// public foo(a, b) { +//// return [||] a; +//// } +////} + +test.ranges().forEach((range) => { + verify.matchingBracePositionInCurrentFile(range.start, range.end - 1); + verify.matchingBracePositionInCurrentFile(range.end - 1, range.start); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/server/completions.ts b/tests/cases/fourslash/server/completions.ts new file mode 100644 index 00000000000..82d3b5b2400 --- /dev/null +++ b/tests/cases/fourslash/server/completions.ts @@ -0,0 +1,17 @@ +/// + +////var x: string[] = []; +////x.forEach(function (y) { y/*1*/ +////x.forEach(y => y/*2*/ + +goTo.marker('1'); +edit.insert('.'); +verify.memberListContains('trim'); +verify.memberListCount(20); +edit.insert('});'); // need the following lines to not have parse errors in order for completion list to appear + +goTo.marker('2'); +edit.insert('.'); +verify.memberListContains('trim'); +verify.memberListCount(20); + \ No newline at end of file diff --git a/tests/cases/fourslash/server/completions2.ts b/tests/cases/fourslash/server/completions2.ts new file mode 100644 index 00000000000..b34aad66ba2 --- /dev/null +++ b/tests/cases/fourslash/server/completions2.ts @@ -0,0 +1,18 @@ +/// + +////class Foo { +////} +////module Foo { +//// export var x: number; +////} +////Foo./**/ + +goTo.marker(""); +verify.completionListContains("x"); + +// Make an edit +edit.insert("a"); +edit.backspace(); + +// Checking for completion details after edit should work too +verify.completionEntryDetailIs("x", "(var) Foo.x: number"); diff --git a/tests/cases/fourslash/server/definition.ts b/tests/cases/fourslash/server/definition.ts new file mode 100644 index 00000000000..531e4562843 --- /dev/null +++ b/tests/cases/fourslash/server/definition.ts @@ -0,0 +1,12 @@ +/// + +// @Filename: b.ts +////import n = require('a/*1*/'); +////var x = new n.Foo(); + +// @Filename: a.ts +//// /*2*/export class Foo {} + +goTo.marker('1'); +goTo.definition(); +verify.caretAtMarker('2'); \ No newline at end of file diff --git a/tests/cases/fourslash/server/format.ts b/tests/cases/fourslash/server/format.ts new file mode 100644 index 00000000000..75d06eef0c2 --- /dev/null +++ b/tests/cases/fourslash/server/format.ts @@ -0,0 +1,8 @@ +/// + +/////**/module Default{var x= ( { } ) ;} + + +format.document(); +goTo.marker(); +verify.currentLineContentIs('module Default { var x = ({}); }'); \ No newline at end of file diff --git a/tests/cases/fourslash/server/formatonkey.ts b/tests/cases/fourslash/server/formatonkey.ts new file mode 100644 index 00000000000..64cd74ca858 --- /dev/null +++ b/tests/cases/fourslash/server/formatonkey.ts @@ -0,0 +1,12 @@ +/// + +////switch (1) { +//// case 1: +//// { +//// /*1*/ +//// break; +////} + +goTo.marker("1"); +edit.insert("}"); +verify.currentLineContentIs(" }"); diff --git a/tests/cases/fourslash/server/navbar.ts b/tests/cases/fourslash/server/navbar.ts new file mode 100644 index 00000000000..e18f49c1db9 --- /dev/null +++ b/tests/cases/fourslash/server/navbar.ts @@ -0,0 +1,52 @@ +/// + +////// Interface +////{| "itemName": "IPoint", "kind": "interface", "parentName": "" |}interface IPoint { +//// {| "itemName": "getDist", "kind": "method", "parentName": "IPoint" |}getDist(): number; +//// {| "itemName": "new()", "kind": "construct", "parentName": "IPoint" |}new(): IPoint; +//// {| "itemName": "()", "kind": "call", "parentName": "IPoint" |}(): any; +//// {| "itemName": "[]", "kind": "index", "parentName": "IPoint" |}[x:string]: number; +//// {| "itemName": "prop", "kind": "property", "parentName": "IPoint" |}prop: string; +////} +//// +/////// Module +////{| "itemName": "Shapes", "kind": "module", "parentName": "" |}module Shapes { +//// +//// // Class +//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes" |}export class Point implements IPoint { +//// {| "itemName": "constructor", "kind": "constructor", "parentName": "Shapes.Point" |}constructor (public x: number, public y: number) { } +//// +//// // Instance member +//// {| "itemName": "getDist", "kind": "method", "parentName": "Shapes.Point" |}getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } +//// +//// // Getter +//// {| "itemName": "value", "kind": "getter", "parentName": "Shapes.Point" |}get value(): number { return 0; } +//// +//// // Setter +//// {| "itemName": "value", "kind": "setter", "parentName": "Shapes.Point" |}set value(newValue: number) { return; } +//// +//// // Static member +//// {| "itemName": "origin", "kind": "property", "parentName": "Shapes.Point" |}static origin = new Point(0, 0); +//// +//// // Static method +//// {| "itemName": "getOrigin", "kind": "method", "parentName": "Shapes.Point" |}private static getOrigin() { return Point.origin;} +//// } +//// +//// {| "itemName": "Values", "kind": "enum", "parentName": "Shapes" |}enum Values { +//// value1, +//// {| "itemName": "value2", "kind": "property", "parentName": "Shapes.Values" |}value2, +//// value3, +//// } +////} +//// +////// Local variables +////{| "itemName": "p", "kind": "var", "parentName": "" |}var p: IPoint = new Shapes.Point(3, 4); +////{| "itemName": "dist", "kind": "var", "parentName": "" |}var dist = p.getDist(); + +test.markers().forEach((marker) => { + if (marker.data) { + verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + } +}); + +verify.getScriptLexicalStructureListCount(23); diff --git a/tests/cases/fourslash/server/navto.ts b/tests/cases/fourslash/server/navto.ts new file mode 100644 index 00000000000..8dc42a2365e --- /dev/null +++ b/tests/cases/fourslash/server/navto.ts @@ -0,0 +1,28 @@ +/// + +/////// Module +////{| "itemName": "Shapes", "kind": "module", "parentName": "", "matchKind": "substring" |}module Shapes { +//// +//// // Class +//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes", "matchKind": "substring" |}export class Point { +//// // Instance member +//// {| "itemName": "originPointAttheHorizon", "kind": "property", "parentName": "Point", "matchKind": "substring"|}private originPointAttheHorizon = 0.0; +//// +//// // Getter +//// {| "itemName": "distanceFromOrigin", "kind": "getter", "parentName": "Point", "matchKind": "substring" |}get distanceFromOrigin(): number { return 0; } +//// +//// } +////} +//// +////// Local variables +////{| "itemName": "myPointThatIJustInitiated", "kind": "var", "parentName": "", "matchKind": "substring"|}var myPointThatIJustInitiated = new Shapes.Point(); + +//// Testing for substring matching of navigationItems +//var searchValue = "FromOrigin horizon INITIATED Shape Point"; + +test.markers().forEach((marker) => { + if (marker.data) { + var name = marker.data.itemName; + verify.navigationItemsListContains(name, marker.data.kind, name.substr(1), marker.data.matchKind, marker.fileName, marker.data.parentName); + } +}); \ No newline at end of file diff --git a/tests/cases/fourslash/server/quickinfo.ts b/tests/cases/fourslash/server/quickinfo.ts new file mode 100644 index 00000000000..b5c7dc0a01c --- /dev/null +++ b/tests/cases/fourslash/server/quickinfo.ts @@ -0,0 +1,27 @@ +/// + +////interface One { +//// commonProperty: number; +//// commonFunction(): number; +////} +//// +////interface Two { +//// commonProperty: string +//// commonFunction(): number; +////} +//// +////var /*1*/x : One | Two; +//// +////x./*2*/commonProperty; +////x./*3*/commonFunction; + + +goTo.marker("1"); +verify.quickInfoIs('(var) x: One | Two'); + + +goTo.marker("2"); +verify.quickInfoIs('(property) commonProperty: string | number'); + +goTo.marker("3"); +verify.quickInfoIs('(method) commonFunction(): number'); diff --git a/tests/cases/fourslash/server/references.ts b/tests/cases/fourslash/server/references.ts new file mode 100644 index 00000000000..55b21615551 --- /dev/null +++ b/tests/cases/fourslash/server/references.ts @@ -0,0 +1,18 @@ +/// + +// Global class reference. + +// @Filename: referencesForGlobals_1.ts +////class /*2*/globalClass { +//// public f() { } +////} + +// @Filename: referencesForGlobals_2.ts +/////// +////var c = /*1*/globalClass(); + +goTo.marker("1"); +verify.referencesCountIs(2); + +goTo.marker("2"); +verify.referencesCountIs(2); \ No newline at end of file diff --git a/tests/cases/fourslash/server/rename.ts b/tests/cases/fourslash/server/rename.ts new file mode 100644 index 00000000000..4f8b7b98cd4 --- /dev/null +++ b/tests/cases/fourslash/server/rename.ts @@ -0,0 +1,11 @@ +/// + +/////// + +////function /**/[|Bar|]() { +//// // This is a reference to [|Bar|] in a comment. +//// "this is a reference to [|Bar|] in a string" +////} + +goTo.marker(); +verify.renameLocations(/*findInStrings:*/ true, /*findInComments:*/ true); \ No newline at end of file diff --git a/tests/cases/fourslash/signatureHelpTaggedTemplatesNegatives2.ts b/tests/cases/fourslash/signatureHelpTaggedTemplatesNegatives2.ts new file mode 100644 index 00000000000..e7a5078dcd0 --- /dev/null +++ b/tests/cases/fourslash/signatureHelpTaggedTemplatesNegatives2.ts @@ -0,0 +1,11 @@ +/// + +//// function foo(strs, ...rest) { +//// } +//// +//// /*1*/fo/*2*/o /*3*/`abcd${0 + 1}abcd{1 + 1}`/*4*/ /*5*/ + +test.markers().forEach(m => { + goTo.position(m.position); + verify.not.signatureHelpPresent(); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/signatureHelpTaggedTemplatesNegatives3.ts b/tests/cases/fourslash/signatureHelpTaggedTemplatesNegatives3.ts new file mode 100644 index 00000000000..c84b92fee4f --- /dev/null +++ b/tests/cases/fourslash/signatureHelpTaggedTemplatesNegatives3.ts @@ -0,0 +1,11 @@ +/// + +//// function foo(strs, ...rest) { +//// } +//// +//// /*1*/fo/*2*/o /*3*/`abcd${0 + 1}abcd{1 + 1}abcd`/*4*/ /*5*/ + +test.markers().forEach(m => { + goTo.position(m.position); + verify.not.signatureHelpPresent(); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/signatureHelpTaggedTemplatesNegatives4.ts b/tests/cases/fourslash/signatureHelpTaggedTemplatesNegatives4.ts new file mode 100644 index 00000000000..338a8dc65ca --- /dev/null +++ b/tests/cases/fourslash/signatureHelpTaggedTemplatesNegatives4.ts @@ -0,0 +1,11 @@ +/// + +//// function foo(strs, ...rest) { +//// } +//// +//// /*1*/fo/*2*/o /*3*/``/*4*/ /*5*/ + +test.markers().forEach(m => { + goTo.position(m.position); + verify.not.signatureHelpPresent(); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/signatureHelpTaggedTemplatesNegatives5.ts b/tests/cases/fourslash/signatureHelpTaggedTemplatesNegatives5.ts new file mode 100644 index 00000000000..02383df9267 --- /dev/null +++ b/tests/cases/fourslash/signatureHelpTaggedTemplatesNegatives5.ts @@ -0,0 +1,11 @@ +/// + +//// function foo(strs, ...rest) { +//// } +//// +//// /*1*/fo/*2*/o /*3*/`abcd`/*4*/ + +test.markers().forEach(m => { + goTo.position(m.position); + verify.not.signatureHelpPresent(); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/syntacticClassificationsForOfKeyword.ts b/tests/cases/fourslash/syntacticClassificationsForOfKeyword.ts new file mode 100644 index 00000000000..a7a8c704ce6 --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationsForOfKeyword.ts @@ -0,0 +1,16 @@ +/// + +//// for (var of of of) { } + +var c = classification; +verify.syntacticClassificationsAre( + c.keyword("for"), + c.punctuation("("), + c.keyword("var"), + c.text("of"), + c.keyword("of"), + c.text("of"), + c.punctuation(")"), + c.punctuation("{"), + c.punctuation("}") + ); \ No newline at end of file diff --git a/tests/cases/fourslash/syntacticClassificationsForOfKeyword2.ts b/tests/cases/fourslash/syntacticClassificationsForOfKeyword2.ts new file mode 100644 index 00000000000..30cfaea51e0 --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationsForOfKeyword2.ts @@ -0,0 +1,16 @@ +/// + +//// for (var of in of) { } + +var c = classification; +verify.syntacticClassificationsAre( + c.keyword("for"), + c.punctuation("("), + c.keyword("var"), + c.text("of"), + c.keyword("in"), + c.text("of"), + c.punctuation(")"), + c.punctuation("{"), + c.punctuation("}") + ); \ No newline at end of file diff --git a/tests/cases/fourslash/syntacticClassificationsForOfKeyword3.ts b/tests/cases/fourslash/syntacticClassificationsForOfKeyword3.ts new file mode 100644 index 00000000000..3af4733f3b2 --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationsForOfKeyword3.ts @@ -0,0 +1,18 @@ +/// + +//// for (var of; of; of) { } + +var c = classification; +verify.syntacticClassificationsAre( + c.keyword("for"), + c.punctuation("("), + c.keyword("var"), + c.text("of"), + c.punctuation(";"), + c.text("of"), + c.punctuation(";"), + c.text("of"), + c.punctuation(")"), + c.punctuation("{"), + c.punctuation("}") + ); \ No newline at end of file diff --git a/tests/cases/unittests/incrementalParser.ts b/tests/cases/unittests/incrementalParser.ts index 7c4213e22c2..54adcaf345f 100644 --- a/tests/cases/unittests/incrementalParser.ts +++ b/tests/cases/unittests/incrementalParser.ts @@ -248,7 +248,7 @@ module ts { var oldText = ScriptSnapshot.fromString(source); var newTextAndChange = withChange(oldText, index, 2, "+"); - compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 21); + compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 24); }); it('Strict mode 1',() => { diff --git a/tests/cases/unittests/services/colorization.ts b/tests/cases/unittests/services/colorization.ts index 01149764305..6c685cdb174 100644 --- a/tests/cases/unittests/services/colorization.ts +++ b/tests/cases/unittests/services/colorization.ts @@ -4,6 +4,7 @@ interface ClassificationEntry { value: any; classification: ts.TokenClass; + position?: number; } describe('Colorization', function () { @@ -23,19 +24,26 @@ describe('Colorization', function () { return undefined; } - function punctuation(text: string): ClassificationEntry { return { value: text, classification: ts.TokenClass.Punctuation }; } - function keyword(text: string): ClassificationEntry { return { value: text, classification: ts.TokenClass.Keyword }; } - function operator(text: string): ClassificationEntry { return { value: text, classification: ts.TokenClass.Operator }; } - function comment(text: string): ClassificationEntry { return { value: text, classification: ts.TokenClass.Comment }; } - function whitespace(text: string): ClassificationEntry { return { value: text, classification: ts.TokenClass.Whitespace }; } - function identifier(text: string): ClassificationEntry { return { value: text, classification: ts.TokenClass.Identifier }; } - function numberLiteral(text: string): ClassificationEntry { return { value: text, classification: ts.TokenClass.NumberLiteral }; } - function stringLiteral(text: string): ClassificationEntry { return { value: text, classification: ts.TokenClass.StringLiteral }; } - function regExpLiteral(text: string): ClassificationEntry { return { value: text, classification: ts.TokenClass.RegExpLiteral }; } - function finalEndOfLineState(value: number): ClassificationEntry { return { value: value, classification: undefined }; } + function punctuation(text: string, position?: number) { return createClassification(text, ts.TokenClass.Punctuation, position); } + function keyword(text: string, position?: number) { return createClassification(text, ts.TokenClass.Keyword, position); } + function operator(text: string, position?: number) { return createClassification(text, ts.TokenClass.Operator, position); } + function comment(text: string, position?: number) { return createClassification(text, ts.TokenClass.Comment, position); } + function whitespace(text: string, position?: number) { return createClassification(text, ts.TokenClass.Whitespace, position); } + function identifier(text: string, position?: number) { return createClassification(text, ts.TokenClass.Identifier, position); } + function numberLiteral(text: string, position?: number) { return createClassification(text, ts.TokenClass.NumberLiteral, position); } + function stringLiteral(text: string, position?: number) { return createClassification(text, ts.TokenClass.StringLiteral, position); } + function regExpLiteral(text: string, position?: number) { return createClassification(text, ts.TokenClass.RegExpLiteral, position); } + function finalEndOfLineState(value: number): ClassificationEntry { return { value: value, classification: undefined, position: 0 }; } + function createClassification(text: string, tokenClass: ts.TokenClass, position?: number): ClassificationEntry { + return { + value: text, + classification: tokenClass, + position: position, + }; + } function testLexicalClassification(text: string, initialEndOfLineState: ts.EndOfLineState, ...expectedEntries: ClassificationEntry[]): void { - var result = classifier.getClassificationsForLine(text, initialEndOfLineState); + var result = classifier.getClassificationsForLine(text, initialEndOfLineState, /*syntacticClassifierAbsent*/ false); for (var i = 0, n = expectedEntries.length; i < n; i++) { var expectedEntry = expectedEntries[i]; @@ -44,7 +52,7 @@ describe('Colorization', function () { assert.equal(result.finalLexState, expectedEntry.value, "final endOfLineState does not match expected."); } else { - var actualEntryPosition = text.indexOf(expectedEntry.value); + var actualEntryPosition = expectedEntry.position !== undefined ? expectedEntry.position : text.indexOf(expectedEntry.value); assert(actualEntryPosition >= 0, "token: '" + expectedEntry.value + "' does not exit in text: '" + text + "'."); var actualEntry = getEntryAtPosistion(result, actualEntryPosition); @@ -254,6 +262,106 @@ describe('Colorization', function () { finalEndOfLineState(ts.EndOfLineState.Start)); }); + it("classifies a single line no substitution template string correctly", () => { + testLexicalClassification("`number number public string`", + ts.EndOfLineState.Start, + stringLiteral("`number number public string`"), + finalEndOfLineState(ts.EndOfLineState.Start)); + }); + it("classifies substitution parts of a template string correctly", () => { + testLexicalClassification("`number '${ 1 + 1 }' string '${ 'hello' }'`", + ts.EndOfLineState.Start, + stringLiteral("`number '${"), + numberLiteral("1"), + operator("+"), + numberLiteral("1"), + stringLiteral("}' string '${"), + stringLiteral("'hello'"), + stringLiteral("}'`"), + finalEndOfLineState(ts.EndOfLineState.Start)); + }); + it("classifies an unterminated no substitution template string correctly", () => { + testLexicalClassification("`hello world", + ts.EndOfLineState.Start, + stringLiteral("`hello world"), + finalEndOfLineState(ts.EndOfLineState.InTemplateHeadOrNoSubstitutionTemplate)); + }); + it("classifies the entire line of an unterminated multiline no-substitution/head template", () => { + testLexicalClassification("...", + ts.EndOfLineState.InTemplateHeadOrNoSubstitutionTemplate, + stringLiteral("..."), + finalEndOfLineState(ts.EndOfLineState.InTemplateHeadOrNoSubstitutionTemplate)); + }); + it("classifies the entire line of an unterminated multiline template middle/end",() => { + testLexicalClassification("...", + ts.EndOfLineState.InTemplateMiddleOrTail, + stringLiteral("..."), + finalEndOfLineState(ts.EndOfLineState.InTemplateMiddleOrTail)); + }); + it("classifies a termination of a multiline template head", () => { + testLexicalClassification("...${", + ts.EndOfLineState.InTemplateHeadOrNoSubstitutionTemplate, + stringLiteral("...${"), + finalEndOfLineState(ts.EndOfLineState.InTemplateSubstitutionPosition)); + }); + it("classifies the termination of a multiline no substitution template", () => { + testLexicalClassification("...`", + ts.EndOfLineState.InTemplateHeadOrNoSubstitutionTemplate, + stringLiteral("...`"), + finalEndOfLineState(ts.EndOfLineState.Start)); + }); + it("classifies the substitution parts and middle/tail of a multiline template string", () => { + testLexicalClassification("${ 1 + 1 }...`", + ts.EndOfLineState.InTemplateHeadOrNoSubstitutionTemplate, + stringLiteral("${"), + numberLiteral("1"), + operator("+"), + numberLiteral("1"), + stringLiteral("}...`"), + finalEndOfLineState(ts.EndOfLineState.Start)); + }); + it("classifies a template middle and propagates the end of line state",() => { + testLexicalClassification("${ 1 + 1 }...`", + ts.EndOfLineState.InTemplateHeadOrNoSubstitutionTemplate, + stringLiteral("${"), + numberLiteral("1"), + operator("+"), + numberLiteral("1"), + stringLiteral("}...`"), + finalEndOfLineState(ts.EndOfLineState.Start)); + }); + it("classifies substitution expressions with curly braces appropriately", () => { + var pos = 0; + var lastLength = 0; + + testLexicalClassification("...${ () => { } } ${ { x: `1` } }...`", + ts.EndOfLineState.InTemplateHeadOrNoSubstitutionTemplate, + stringLiteral(track("...${"), pos), + punctuation(track(" ", "("), pos), + punctuation(track(")"), pos), + punctuation(track(" ", "=>"), pos), + punctuation(track(" ", "{"), pos), + punctuation(track(" ", "}"), pos), + stringLiteral(track(" ", "} ${"), pos), + punctuation(track(" ", "{"), pos), + identifier(track(" ", "x"), pos), + punctuation(track(":"), pos), + stringLiteral(track(" ", "`1`"), pos), + punctuation(track(" ", "}"), pos), + stringLiteral(track(" ", "}...`"), pos), + finalEndOfLineState(ts.EndOfLineState.Start)); + + // Adjusts 'pos' by accounting for the length of each portion of the string, + // but only return the last given string + function track(...vals: string[]): string { + for (var i = 0, n = vals.length; i < n; i++) { + pos += lastLength; + lastLength = vals[i].length; + } + return ts.lastOrUndefined(vals); + } + }); + it("classifies partially written generics correctly.", function () { testLexicalClassification("Foo>>>>>> Branch - a"), finalEndOfLineState(ts.EndOfLineState.Start)); }); + + it("'of' keyword", function () { + testLexicalClassification("for (var of of of) { }", + ts.EndOfLineState.Start, + keyword("for"), + punctuation("("), + keyword("var"), + keyword("of"), + keyword("of"), + keyword("of"), + punctuation(")"), + punctuation("{"), + punctuation("}"), + finalEndOfLineState(ts.EndOfLineState.Start)); + }); }); }); \ No newline at end of file diff --git a/tests/cases/unittests/services/patternMatcher.ts b/tests/cases/unittests/services/patternMatcher.ts new file mode 100644 index 00000000000..ddf1f9fe344 --- /dev/null +++ b/tests/cases/unittests/services/patternMatcher.ts @@ -0,0 +1,532 @@ +/// +/// + +describe('PatternMatcher', function () { + describe("BreakIntoCharacterSpans", function () { + it("EmptyIdentifier", () => { + verifyBreakIntoCharacterSpans("") + }); + + it("SimpleIdentifier", () => { + verifyBreakIntoCharacterSpans("foo", "foo"); + }); + + it("PrefixUnderscoredIdentifier", () => { + verifyBreakIntoCharacterSpans("_foo", "_", "foo"); + }); + + it("UnderscoredIdentifier", () => { + verifyBreakIntoCharacterSpans("f_oo", "f", "_", "oo"); + }); + + it("PostfixUnderscoredIdentifier", () => { + verifyBreakIntoCharacterSpans("foo_", "foo", "_"); + }); + + it("PrefixUnderscoredIdentifierWithCapital", () => { + verifyBreakIntoCharacterSpans("_Foo", "_", "Foo"); + }); + + it("MUnderscorePrefixed", () => { + verifyBreakIntoCharacterSpans("m_foo", "m", "_", "foo"); + }); + + it("CamelCaseIdentifier", () => { + verifyBreakIntoCharacterSpans("FogBar", "Fog", "Bar"); + }); + + it("MixedCaseIdentifier", () => { + verifyBreakIntoCharacterSpans("fogBar", "fog", "Bar"); + }); + + it("TwoCharacterCapitalIdentifier", () => { + verifyBreakIntoCharacterSpans("UIElement", "U", "I", "Element"); + }); + + it("NumberSuffixedIdentifier", () => { + verifyBreakIntoCharacterSpans("Foo42", "Foo", "42"); + }); + + it("NumberContainingIdentifier", () => { + verifyBreakIntoCharacterSpans("Fog42Bar", "Fog", "42", "Bar"); + }); + + it("NumberPrefixedIdentifier", () => { + verifyBreakIntoCharacterSpans("42Bar", "42", "Bar"); + }); + }); + + describe("BreakIntoWordSpans", function () { + it("VarbatimIdentifier", () => { + verifyBreakIntoWordSpans("@int:", "int"); + }); + + it("AllCapsConstant", () => { + verifyBreakIntoWordSpans("C_STYLE_CONSTANT", "C", "_", "STYLE", "_", "CONSTANT"); + }); + + it("SingleLetterPrefix1", () => { + verifyBreakIntoWordSpans("UInteger", "U", "Integer"); + }); + + it("SingleLetterPrefix2", () => { + verifyBreakIntoWordSpans("IDisposable", "I", "Disposable"); + }); + + it("TwoCharacterCapitalIdentifier", () => { + verifyBreakIntoWordSpans("UIElement", "UI", "Element"); + }); + + it("XDocument", () => { + verifyBreakIntoWordSpans("XDocument", "X", "Document"); + }); + + it("XMLDocument1", () => { + verifyBreakIntoWordSpans("XMLDocument", "XML", "Document"); + }); + + it("XMLDocument2", () => { + verifyBreakIntoWordSpans("XmlDocument", "Xml", "Document"); + }); + + it("TwoUppercaseCharacters", () => { + verifyBreakIntoWordSpans("SimpleUIElement", "Simple", "UI", "Element"); + }); + }); + + describe("SingleWordPattern", () => { + it("PreferCaseSensitiveExact", () => { + debugger; + var match = getFirstMatch("Foo", "Foo"); + + assert.equal(ts.PatternMatchKind.Exact, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveExactInsensitive", () => { + var match = getFirstMatch("foo", "Foo"); + + assert.equal(ts.PatternMatchKind.Exact, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitivePrefix", () => { + var match = getFirstMatch("Foo", "Fo"); + + assert.equal(ts.PatternMatchKind.Prefix, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitivePrefixCaseInsensitive", () => { + var match = getFirstMatch("Foo", "fo"); + + assert.equal(ts.PatternMatchKind.Prefix, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveCamelCaseMatchSimple", () => { + debugger; + var match = getFirstMatch("FogBar", "FB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + assertInRange(match.camelCaseWeight, 1, 1 << 30); + }); + + it("PreferCaseSensitiveCamelCaseMatchPartialPattern", () => { + var match = getFirstMatch("FogBar", "FoB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveCamelCaseMatchToLongPattern1", () => { + var match = getFirstMatch("FogBar", "FBB"); + + assert.isTrue(match === undefined); + }); + + it("PreferCaseSensitiveCamelCaseMatchToLongPattern2", () => { + var match = getFirstMatch("FogBar", "FoooB"); + + assert.isTrue(match === undefined); + }); + + it("CamelCaseMatchPartiallyUnmatched", () => { + var match = getFirstMatch("FogBarBaz", "FZ"); + + assert.isTrue(match === undefined); + }); + + it("CamelCaseMatchCompletelyUnmatched", () => { + var match = getFirstMatch("FogBarBaz", "ZZ"); + + assert.isTrue(match === undefined); + }); + + it("TwoUppercaseCharacters", () => { + var match = getFirstMatch("SimpleUIElement", "SiUI"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveLowercasePattern", () => { + debugger; + var match = getFirstMatch("FogBar", "b"); + + assert.equal(ts.PatternMatchKind.Substring, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveLowercasePattern2", () => { + var match = getFirstMatch("FogBar", "fB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveTryUnderscoredName", () => { + var match = getFirstMatch("_fogBar", "_fB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveTryUnderscoredName2", () => { + var match = getFirstMatch("_fogBar", "fB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveTryUnderscoredNameInsensitive", () => { + var match = getFirstMatch("_FogBar", "_fB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveMiddleUnderscore", () => { + var match = getFirstMatch("Fog_Bar", "FB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveMiddleUnderscore2", () => { + var match = getFirstMatch("Fog_Bar", "F_B"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveMiddleUnderscore3", () => { + var match = getFirstMatch("Fog_Bar", "F__B"); + + assert.isTrue(undefined === match); + }); + + it("PreferCaseSensitiveMiddleUnderscore4", () => { + var match = getFirstMatch("Fog_Bar", "f_B"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveMiddleUnderscore5", () => { + var match = getFirstMatch("Fog_Bar", "F_b"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveRelativeWeights1", () => { + var match1 = getFirstMatch("FogBarBaz", "FB"); + var match2 = getFirstMatch("FooFlobBaz", "FB"); + + // We should prefer something that starts at the beginning if possible + assertInRange(match1.camelCaseWeight, match2.camelCaseWeight + 1, 1 << 30); + }); + + it("PreferCaseSensitiveRelativeWeights2", () => { + var match1 = getFirstMatch("BazBarFooFooFoo", "FFF"); + var match2 = getFirstMatch("BazFogBarFooFoo", "FFF"); + + // Contiguous things should also be preferred + assertInRange(match1.camelCaseWeight, match2.camelCaseWeight + 1, 1 << 30); + }); + + it("PreferCaseSensitiveRelativeWeights3", () => { + var match1 = getFirstMatch("FogBarFooFoo", "FFF"); + var match2 = getFirstMatch("BarFooFooFoo", "FFF"); + + // The weight of being first should be greater than the weight of being contiguous + assertInRange(match1.camelCaseWeight, match2.camelCaseWeight + 1, 1 << 30); + }); + + it("AllLowerPattern1", () => { + debugger; + var match = getFirstMatch("FogBarChangedEventArgs", "changedeventargs"); + + assert.isTrue(undefined !== match); + }); + + it("AllLowerPattern2", () => { + var match = getFirstMatch("FogBarChangedEventArgs", "changedeventarrrgh"); + + assert.isTrue(undefined === match); + }); + + it("AllLowerPattern3", () => { + var match = getFirstMatch("ABCDEFGH", "bcd"); + + assert.isTrue(undefined !== match); + }); + + it("AllLowerPattern4", () => { + var match = getFirstMatch("AbcdefghijEfgHij", "efghij"); + + assert.isTrue(undefined === match); + }); + }); + + describe("MultiWordPattern", () => { + it("ExactWithLowercase", () => { + var matches = getAllMatches("AddMetadataReference", "addmetadatareference"); + + assertContainsKind(ts.PatternMatchKind.Exact, matches); + }); + + it("SingleLowercasedSearchWord1", () => { + var matches = getAllMatches("AddMetadataReference", "add"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + }); + + it("SingleLowercasedSearchWord2", () => { + var matches = getAllMatches("AddMetadataReference", "metadata"); + + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("SingleUppercaseSearchWord1", () => { + var matches = getAllMatches("AddMetadataReference", "Add"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + }); + + it("SingleUppercaseSearchWord2", () => { + var matches = getAllMatches("AddMetadataReference", "Metadata"); + + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("SingleUppercaseSearchLetter1", () => { + var matches = getAllMatches("AddMetadataReference", "A"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + }); + + it("SingleUppercaseSearchLetter2", () => { + var matches = getAllMatches("AddMetadataReference", "M"); + + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("TwoLowercaseWords", () => { + var matches = getAllMatches("AddMetadataReference", "add metadata"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("TwoLowercaseWords", () => { + var matches = getAllMatches("AddMetadataReference", "A M"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("TwoLowercaseWords", () => { + var matches = getAllMatches("AddMetadataReference", "AM"); + + assertContainsKind(ts.PatternMatchKind.CamelCase, matches); + }); + + it("TwoLowercaseWords", () => { + var matches = getAllMatches("AddMetadataReference", "ref Metadata") + + assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.Substring, ts.PatternMatchKind.Substring]); + }); + + it("TwoLowercaseWords", () => { + var matches = getAllMatches("AddMetadataReference", "ref M") + + assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.Substring, ts.PatternMatchKind.Substring]); + }); + + it("MixedCamelCase", () => { + var matches = getAllMatches("AddMetadataReference", "AMRe"); + + assertContainsKind(ts.PatternMatchKind.CamelCase, matches); + }); + + it("BlankPattern", () => { + var matches = getAllMatches("AddMetadataReference", ""); + + assert.isTrue(matches === undefined); + }); + + it("WhitespaceOnlyPattern", () => { + var matches = getAllMatches("AddMetadataReference", " "); + + assert.isTrue(matches === undefined); + }); + + it("EachWordSeparately1", () => { + var matches = getAllMatches("AddMetadataReference", "add Meta"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("EachWordSeparately2", () => { + var matches = getAllMatches("AddMetadataReference", "Add meta"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("EachWordSeparately3", () => { + var matches = getAllMatches("AddMetadataReference", "Add Meta"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("MixedCasing", () => { + var matches = getAllMatches("AddMetadataReference", "mEta"); + + assert.isTrue(matches === undefined); + }); + + it("MixedCasing2", () => { + var matches = getAllMatches("AddMetadataReference", "Data"); + + assert.isTrue(matches === undefined); + }); + + it("AsteriskSplit", () => { + var matches = getAllMatches("GetKeyWord", "K*W"); + + assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.Substring, ts.PatternMatchKind.Substring]); + }); + + it("LowercaseSubstring1", () => { + var matches = getAllMatches("Operator", "a"); + + assert.isTrue(matches === undefined); + }); + + it("LowercaseSubstring2", () => { + var matches = getAllMatches("FooAttribute", "a"); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + assert.isFalse(matches[0].isCaseSensitive); + }); + }); + + describe("DottedPattern", () => { + it("DottedPattern1", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "B.Q"); + + assert.equal(ts.PatternMatchKind.Prefix, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("DottedPattern2", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "C.Q"); + assert.isTrue(match === undefined); + }); + + it("DottedPattern3", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "B.B.Q"); + assert.equal(ts.PatternMatchKind.Prefix, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("DottedPattern4", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "Baz.Quux"); + assert.equal(ts.PatternMatchKind.Exact, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("DottedPattern5", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "F.B.B.Quux"); + assert.equal(ts.PatternMatchKind.Exact, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("DottedPattern6", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "F.F.B.B.Quux"); + assert.isTrue(match === undefined); + }); + + it("DottedPattern7", () => { + debugger; + var match = getFirstMatch("UIElement", "UIElement"); + var match = getFirstMatch("GetKeyword", "UIElement"); + assert.isTrue(match === undefined); + }); + }); + + function getFirstMatch(candidate: string, pattern: string): ts.PatternMatch { + var matches = ts.createPatternMatcher(pattern).getMatchesForLastSegmentOfPattern(candidate); + return matches ? matches[0] : undefined; + } + + function getAllMatches(candidate: string, pattern: string): ts.PatternMatch[] { + return ts.createPatternMatcher(pattern).getMatchesForLastSegmentOfPattern(candidate); + } + + function getFirstMatchForDottedPattern(dottedContainer: string, candidate: string, pattern: string): ts.PatternMatch { + var matches = ts.createPatternMatcher(pattern).getMatches(candidate, dottedContainer); + return matches ? matches[0] : undefined; + } + + function spanListToSubstrings(identifier: string, spans: ts.TextSpan[]) { + return ts.map(spans, s => identifier.substr(s.start, s.length)); + } + + function breakIntoCharacterSpans(identifier: string) { + return spanListToSubstrings(identifier, ts.breakIntoCharacterSpans(identifier)); + } + + function breakIntoWordSpans(identifier: string) { + return spanListToSubstrings(identifier, ts.breakIntoWordSpans(identifier)); + } + function assertArrayEquals(array1: T[], array2: T[]) { + assert.equal(array1.length, array2.length); + + for (var i = 0, n = array1.length; i < n; i++) { + assert.equal(array1[i], array2[i]); + } + } + + function assertInRange(val: number, low: number, high: number) { + assert.isTrue(val >= low); + assert.isTrue(val <= high); + } + + function verifyBreakIntoCharacterSpans(original: string, ...parts: string[]): void { + assertArrayEquals(parts, breakIntoCharacterSpans(original)); + } + + function verifyBreakIntoWordSpans(original: string, ...parts: string[]): void { + assertArrayEquals(parts, breakIntoWordSpans(original)); + } + + function assertContainsKind(kind: ts.PatternMatchKind, results: ts.PatternMatch[]) { + assert.isTrue(ts.forEach(results, r => r.kind === kind)); + } +}); \ No newline at end of file